feat: add auto-update functionality with settings UI

- Implement electron-updater integration with IPC handlers for update operations
- Add Pinia store for managing update state and user preferences
- Create settings UI with version display, update controls, and auto-update toggles
- Update IPC constants and preload API for update-related communication
- Refactor preload invoke methods to use async IPC consistently
- Add rounded corners to settings page layout for better visual consistency
This commit is contained in:
DEV_DSW
2026-04-09 15:15:23 +08:00
parent a8bfbff0e9
commit 1aa28a7808
10 changed files with 411 additions and 96 deletions

View File

@@ -23,17 +23,11 @@ const api: WindowApi = {
// 通过 IPC 调用主进程
readFile: (filePath: string) => ipcRenderer.invoke(IPC_EVENTS.READ_FILE, filePath),
// 步调用
invoke: (channel: IPC_EVENTS, ...args: any[]) => ipcRenderer.sendSync(IPC_EVENTS.INVOKE, channel, ...args),
// 步调用(映射为 electron 的 invoke)
invoke: (channel: IPC_EVENTS, ...args: any[]) => ipcRenderer.invoke(channel, ...args),
// 异步调用
invokeAsync: (channel: IPC_EVENTS, ...args: any[]) => {
try {
ipcRenderer.invoke(IPC_EVENTS.INVOKE_ASYNC, channel, ...args)
} catch (error) {
throw error
}
},
// 异步调用(为了兼容老代码)
invokeAsync: (channel: IPC_EVENTS, ...args: any[]) => ipcRenderer.invoke(channel, ...args),
// 监听主进程消息
on: (event: IPC_EVENTS, callback: (...args: any[]) => void) => {