6b3cd288b1
- Integrate electron-store for persistent PocketBase auth backup across localStorage clears and app reinstalls - Switch build target from portable to nsis to generate latest.yml for electron-updater generic provider - Add user confirmation dialogs before download and before install - Add post-build script to copy .exe/.yml/.nupkg to NAS share and local electron-update/ directory for nginx volume mount - Mount ./electron-update into frontend nginx containers via docker-compose for automatic update file serving Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
20 lines
998 B
JavaScript
20 lines
998 B
JavaScript
const { contextBridge, ipcRenderer } = require('electron')
|
|
|
|
contextBridge.exposeInMainWorld('electronAPI', {
|
|
platform: process.platform,
|
|
|
|
// 自动更新相关 IPC
|
|
onUpdateAvailable: (callback) => ipcRenderer.on('update-available', (_event, info) => callback(info)),
|
|
onUpdateError: (callback) => ipcRenderer.on('update-error', (_event, message) => callback(message)),
|
|
onDownloadProgress: (callback) => ipcRenderer.on('download-progress', (_event, progress) => callback(progress)),
|
|
onUpdateDownloaded: (callback) => ipcRenderer.on('update-downloaded', (_event, info) => callback(info)),
|
|
|
|
checkForUpdates: () => ipcRenderer.send('check-for-updates'),
|
|
quitAndInstall: () => ipcRenderer.send('quit-and-install'),
|
|
|
|
// 持久化存储(用于记住登录状态)
|
|
storeGet: (key) => ipcRenderer.sendSync('store-get-sync', key),
|
|
storeSet: (key, value) => ipcRenderer.sendSync('store-set-sync', key, value),
|
|
storeDelete: (key) => ipcRenderer.sendSync('store-delete-sync', key),
|
|
})
|