Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
fix(update): stop non-downloaded outcomes short of the restart prompt
超超超超超级喜欢你的达妮娅f2359f33dd0f
diff --git a/electron/background-update.test.ts b/electron/background-update.test.tsindex 5a86aa99d..53f92b0c5 100644--- a/electron/background-update.test.ts+++ b/electron/background-update.test.ts@@ -75,4 +75,22 @@ describe("background update policy", () => {});expect(failed).toEqual({ status: "failed", error });});++ it("never reaches the restart prompt without a downloaded update", async () => {+ // downloadSelfUpdate cannot return these today, but the type admits+ // them; a current/unsupported outcome must not prompt or install.+ for (const kind of ["current", "unsupported"] as const) {+ const confirmRestart = vi.fn(async () => 0);+ const install = vi.fn();+ const result = await runUnblockedDownloadAndInstall({+ download: async () => ({ kind }),+ blocked: () => null,+ confirmRestart,+ install,+ });+ expect(result).toEqual({ status: "unavailable" });+ expect(confirmRestart).not.toHaveBeenCalled();+ expect(install).not.toHaveBeenCalled();+ }+ });});diff --git a/electron/background-update.ts b/electron/background-update.tsindex b04119da9..ec17e3431 100644--- a/electron/background-update.ts+++ b/electron/background-update.ts@@ -54,6 +54,7 @@ export function shouldQuitAndInstallAfterRestartPrompt(response: number): boolea* caller. */export type DownloadAndInstallResult =| { status: "failed"; error: Error }+ | { status: "unavailable" }| { status: "blocked" }| { status: "cancelled" }| { status: "installed" };@@ -66,6 +67,10 @@ export async function runUnblockedDownloadAndInstall(deps: {}): Promise<DownloadAndInstallResult> {const downloaded = await deps.download();if (downloaded.kind === "failed") return { status: "failed", error: downloaded.error };+ // `downloadSelfUpdate` only ever reports downloaded|failed today, but the+ // UpdateOutcome type admits current|unsupported — neither of which may+ // reach the restart prompt, let alone quitAndInstall.+ if (downloaded.kind !== "downloaded") return { status: "unavailable" };if (deps.blocked()) return { status: "blocked" };const choice = await deps.confirmRestart();if (!shouldQuitAndInstallAfterRestartPrompt(choice)) return { status: "cancelled" };