feat(security): 新增桌面端应用锁

新增 4 位 PIN、手动锁定、启动锁定和系统闲置锁定。

新增主进程与 preload 能力、桌面端设置面板、全局锁屏覆盖层及四语言界面。

Fixes #190

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
xyz-225648andClaude authored and digua committed 2026-07-18 11:49:09 +08:00
1 parent 32bd268af4
commit 84b371e73d
17 files changed
+1115 -6

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
import { ipcRenderer } from 'electron'
import type { SecurityApi } from '../../shared/types'
export const securityApi: SecurityApi = {
getConfig: () => ipcRenderer.invoke('app-lock:getConfig'),
getState: () => ipcRenderer.invoke('app-lock:getState'),
lock: () => ipcRenderer.invoke('app-lock:lock'),
unlock: (password) => ipcRenderer.invoke('app-lock:unlock', password),
setPassword: (password) => ipcRenderer.invoke('app-lock:setPassword', password),
changePassword: (oldPassword, newPassword) => ipcRenderer.invoke('app-lock:changePassword', oldPassword, newPassword),
resetPassword: () => ipcRenderer.invoke('app-lock:resetPassword'),
updateConfig: (updates) => ipcRenderer.invoke('app-lock:updateConfig', updates),
onLockStateChanged: (callback) => {
const handler = (_event: Electron.IpcRendererEvent, locked: boolean) => callback(locked)
ipcRenderer.on('app-lock-state-changed', handler)
return () => ipcRenderer.removeListener('app-lock-state-changed', handler)
},
}