feat: about tab with update check/download (Gitea feed first, GitHub fallback)

- updater: dual-feed state machine, manual check/download/install IPC,
  changelog from Gitea releases API with GitHub fallback
- settings: new About tab (version, channel, auto-check toggle, progress)
- system.autoCheckUpdate setting gates the startup check
This commit is contained in:
Bill committed 2026-09-07 17:18:15 +08:00
1 parent a9acdbe500
commit f25a1627f3
11 files changed
+417 -46

No files matched your search

+8
View File
@@ -8,6 +8,7 @@ import type {
SessionOpenResult
} from './ipc'
import type { AppSettings } from './settings'
import type { ReleaseNote, UpdateState } from './ipc'
import type {
HostKeyAction,
HostKeyPromptEvent,
@@ -105,4 +106,11 @@ export interface AppApi {
/** json = serialized dockview layout (DockviewApi.toJSON()) */
saveLayout(meta: LayoutMeta, json: string): Promise<void>
deleteLayout(id: string): Promise<void>
// ---- updater (domestic feed first, GitHub fallback) ----
updateCheck(): Promise<UpdateState>
updateDownload(): Promise<void>
updateInstall(): void
updateChangelog(): Promise<ReleaseNote[]>
onUpdateState(cb: (s: UpdateState) => void): () => void
}
+40 -1
View File
@@ -90,7 +90,15 @@ export const Ipc = {
ZMODEM_DONE: 'zmodem:done',
// ---- misc ----
APP_INFO: 'app:info'
APP_INFO: 'app:info',
// ---- updater (check/download/install + state broadcast) ----
UPDATE_CHECK: 'update:check',
UPDATE_DOWNLOAD: 'update:download',
UPDATE_INSTALL: 'update:install',
UPDATE_CHANGELOG: 'update:changelog',
/** main -> renderer broadcast: UpdateState */
UPDATE_STATE: 'update:state'
} as const
export interface PtyCreateOptions {
@@ -122,6 +130,37 @@ export interface AppInfo {
homeDir: string
}
// ---- updater ----
export type UpdateStatus =
| 'idle'
| 'checking'
| 'available'
| 'latest'
| 'downloading'
| 'downloaded'
| 'error'
/** dev builds have no update channel */
| 'dev'
export interface UpdateState {
status: UpdateStatus
/** running app version */
currentVersion: string
/** newer version when available/downloading/downloaded */
version?: string
/** 0-100 while downloading */
percent?: number
error?: string
/** which feed served the last check: domestic Gitea first, GitHub fallback */
feed?: 'gitea' | 'github'
}
export interface ReleaseNote {
version: string
date: string
body: string
}
export interface LayoutMeta {
id: string
name: string
+3 -1
View File
@@ -47,6 +47,8 @@ export interface SystemSettings {
globalShowHide?: string
/** close-button behavior: prompt every time / hide to tray / quit directly */
closeAction?: 'ask' | 'tray' | 'exit'
/** check for updates shortly after startup (manual check always available) */
autoCheckUpdate?: boolean
}
export interface AppSettings {
@@ -102,5 +104,5 @@ export const DEFAULT_SETTINGS: AppSettings = {
},
customThemes: [],
highlightRules: DEFAULT_HIGHLIGHT_RULES,
system: { launchAtLogin: false, preventSleep: false, globalShowHide: '', closeAction: 'ask' }
system: { launchAtLogin: false, preventSleep: false, globalShowHide: '', closeAction: 'ask', autoCheckUpdate: true }
}