feat(installer,web): one canonical bundle per target; robust in-place upgrades; update-check feedback (#142)

Co-authored-by: Yaowei Zheng <hiyouga@buaa.edu.cn>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Laodouuu
2026-08-03 12:19:59 +08:00
committed by GitHub
parent 740f101242
commit 84949882ab
24 changed files with 1081 additions and 465 deletions
+22
View File
@@ -28,6 +28,28 @@ let updatePromise: Promise<UpdateCheckResponse> | null = null;
*/
const listeners = new Set<() => void>();
/** How one manual update check ended, for user feedback — exactly one notice per outcome. */
export type UpdateCheckOutcome =
| { kind: "disabled" }
| { kind: "failed" }
| { kind: "up-to-date" }
| { kind: "found"; latestVersion: string };
/**
* Classifies a manual check result. Order matters: `disabled` means no lookup ran, `error`
* means the lookup ran and failed (the response is fail-soft, not an exception), and only a
* result that names the newer release counts as `found` — updateAvailable without a version
* would leave the row and the toast with nothing to show.
*/
export function updateCheckOutcome(res: UpdateCheckResponse): UpdateCheckOutcome {
if (res.disabled === true) return { kind: "disabled" };
if (res.error !== undefined) return { kind: "failed" };
if (res.updateAvailable && res.latestVersion !== null) {
return { kind: "found", latestVersion: res.latestVersion };
}
return { kind: "up-to-date" };
}
export interface VersionInfo {
version: VersionResponse | null;
update: UpdateCheckResponse | null;