fix(updater): separate Windows 7 offline update path

This commit is contained in:
zipg authored and GitHub committed 2026-07-27 16:44:47 +08:00
1 parent 0b7a886cfd
commit 0aced0012c
29 files changed
+1851 -24

No files matched your search

+20
View File
@@ -14,6 +14,7 @@ const mountedApps: App[] = [];
interface DialogState {
open: boolean;
portableMode: boolean;
manualUpdateOnly: boolean;
isDownloadingUpdate: boolean;
downloadProgress: number;
updateDownloaded: boolean;
@@ -30,6 +31,7 @@ async function mountDialog(activeTaskCount: number, initialState: Partial<Dialog
const state = reactive<DialogState>({
open: true,
portableMode: false,
manualUpdateOnly: false,
isDownloadingUpdate: false,
downloadProgress: 0,
updateDownloaded: false,
@@ -67,6 +69,7 @@ async function mountDialog(activeTaskCount: number, initialState: Partial<Dialog
latest_version: "0.5.61",
update_available: true,
portable_mode: state.portableMode,
manual_update_only: state.manualUpdateOnly,
release_name: "DBX v0.5.61",
release_url: "https://github.com/t8y2/dbx/releases/tag/v0.5.61",
release_notes: "",
@@ -136,6 +139,23 @@ describe("UpdateDialog active task guard", () => {
expect(downloadButton()?.disabled).toBe(false);
});
it("routes Windows 7 builds to the dedicated installer", async () => {
await mountDialog(0, { manualUpdateOnly: true });
expect(document.body.textContent).toContain("WebView2 109 offline installer");
expect(downloadButton()).toBeUndefined();
expect(buttonWithText("Open Release")).toBeDefined();
});
it("prevents Windows 7 portable builds from installing the regular x64 portable update", async () => {
await mountDialog(0, { portableMode: true, manualUpdateOnly: true });
expect(document.body.textContent).toContain("WebView2 109 offline installer");
expect(document.body.textContent).not.toContain("signed portable ZIP");
expect(downloadButton()).toBeUndefined();
expect(buttonWithText("Open Release")).toBeDefined();
});
it("retains the downloaded update and enables installation only after tasks finish", async () => {
await mountDialog(1, { updateDownloaded: true, downloadProgress: 100 });
@@ -106,9 +106,12 @@ watch(
<code class="bg-muted px-1 py-0.5 rounded text-[11px]">docker compose pull && docker compose up -d</code>
{{ t("updates.toUpdate") }}
</p>
<p v-if="isDesktop && updateInfo?.update_available && updateInfo.portable_mode" class="text-xs text-muted-foreground">
<p v-if="isDesktop && updateInfo?.update_available && updateInfo.portable_mode && !updateInfo.manual_update_only" class="text-xs text-muted-foreground">
{{ t("updates.portableAutomaticUpdate") }}
</p>
<p v-if="isDesktop && updateInfo?.update_available && updateInfo.manual_update_only" class="text-xs text-muted-foreground">
{{ t("updates.windows7ManualUpdate") }}
</p>
<div v-if="canDownloadAndInstallUpdate(updateInfo, isDesktop) && activeTaskCount > 0" role="alert" class="flex items-start gap-2 rounded-md border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-xs text-amber-700 dark:text-amber-300">
<AlertTriangle class="mt-0.5 h-4 w-4 shrink-0" />
<span>{{ t("updates.activeTasksBlockUpdate", { count: activeTaskCount }) }}</span>