feat(panel): 锁屏一次性解锁端点 POST /api/system/pin-unlock-once(写 /tmp/meow_pin_unlock_once,launcher 锁屏页消费放行一次)+ 设置页 PIN 卡「一次性解锁设备」按钮

This commit is contained in:
AskaEth committed 2026-09-02 01:01:54 +08:00
1 parent 54d2791f48
commit 85e1d03157
2 files changed
+23 -1

No files matched your search

+11 -1
View File
@@ -1681,6 +1681,9 @@
'<button class="btn btn-danger" id="pin-clear" ' + (canEdit ? '' : 'disabled') + '>清空 PIN</button>' +
(st.locked ? '<span class="muted">锁定期间不可修改/清空</span>' : '<span class="muted">修改/清空需先验证当前 PIN</span>') +
'</div>';
h += '<div class="field-row" style="margin-top:6px">' +
'<button class="btn" id="pin-unlock-once" ' + (st.session ? '' : 'disabled') + '>一次性解锁设备</button>' +
'<span class="muted">设备下次亮屏免 PIN 进入一次(不清除 PIN)</span></div>';
h += '<p class="muted" style="margin-top:6px">4 位数字 PIN,纯加盐哈希存储(不落明文);未设 PIN 时写端点一律拒绝。</p>';
box.innerHTML = h;
}
@@ -1736,9 +1739,16 @@
}
function bindPin() {
const c = $('#content');
c.addEventListener('click', function (e) {
c.addEventListener('click', async function (e) {
if (e.target.closest('#pin-change')) { pinEdit('change'); return; }
if (e.target.closest('#pin-clear')) { pinEdit('clear'); return; }
if (e.target.closest('#pin-unlock-once')) {
try {
await api('POST', '/api/system/pin-unlock-once', {});
toast('已下发:设备下次亮屏免 PIN 进入一次');
} catch (err) { toast('下发失败:' + errText(err)); }
return;
}
});
['#pindlg-old', '#pindlg-new', '#pindlg-new2'].forEach(function (sel) {
const el = $(sel);