mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-09-03 01:50:23 +08:00
feat: add automatic update functionality for Electron app
Closes #613 - Add electron-updater for Windows NSIS and Linux AppImage auto-update - macOS and Linux DEB fall back to GitHub API check with download link - Add "Check for Updates" menu item with i18n (en, zh, ja, zh-Hant) - Fix Windows CI workflow to publish correct latest.yml after code signing - Add update toast notifications in renderer via sonner
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { contextBridge, ipcRenderer } from "electron"
|
||||
import { contextBridge, type IpcRendererEvent, ipcRenderer } from "electron"
|
||||
|
||||
/**
|
||||
* Expose safe APIs to the renderer process
|
||||
@@ -31,4 +31,13 @@ contextBridge.exposeInMainWorld("electronAPI", {
|
||||
getUserLocale: () => ipcRenderer.invoke("get-user-locale"),
|
||||
setUserLocale: (locale: string) =>
|
||||
ipcRenderer.invoke("set-user-locale", locale),
|
||||
|
||||
// Auto-update
|
||||
onUpdateStatus: (callback: (data: UpdateStatusData) => void) => {
|
||||
const handler = (_event: IpcRendererEvent, data: UpdateStatusData) =>
|
||||
callback(data)
|
||||
ipcRenderer.on("update-status", handler)
|
||||
return () => ipcRenderer.removeListener("update-status", handler)
|
||||
},
|
||||
startDownload: () => ipcRenderer.invoke("updater:start-download"),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user