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:
dayuan.jiang
2026-04-03 17:46:27 +09:00
parent f593901fee
commit e27afe6f0d
13 changed files with 739 additions and 38 deletions

View File

@@ -2,6 +2,14 @@
* Type declarations for Electron API exposed via preload script
*/
/** Update status data sent from main process */
type UpdateStatusData =
| { status: "available"; version: string }
| { status: "available-manual"; version: string; url: string }
| { status: "downloading"; percent: number }
| { status: "downloaded" }
| { status: "error"; message: string }
/** Configuration preset interface */
interface ConfigPreset {
id: string
@@ -74,6 +82,12 @@ declare global {
>
/** Set user's preferred locale */
setUserLocale: (locale: string) => Promise<SetUserLocaleResult>
/** Listen for update status events from main process */
onUpdateStatus: (
callback: (data: UpdateStatusData) => void,
) => () => void
/** Start downloading the available update */
startDownload: () => Promise<void>
}
/** Settings window Electron API */