fix(updates): guard portable builds from installer updates (#550)

This commit is contained in:
skyler authored and GitHub committed 2026-05-30 19:15:37 +08:00
1 parent 398e040d5c
commit 528b51fb8d
10 files changed
+92 -4

No files matched your search

@@ -6,6 +6,7 @@ import { Button } from "@/components/ui/button";
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
import type { UpdateInfo } from "@/lib/api";
import { isTauriRuntime } from "@/lib/tauriRuntime";
import { canDownloadAndInstallUpdate } from "@/composables/useAppUpdater";
const open = defineModel<boolean>("open", { required: true });
@@ -98,6 +99,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"
>
{{ t("updates.portableManualUpdate") }}
</p>
</div>
<DialogFooter>
<Button v-if="!isDownloadingUpdate && !updateReady" variant="outline" @click="open = false">{{
@@ -105,7 +112,7 @@ watch(
}}</Button>
<template v-if="updateInfo?.update_available">
<Button variant="outline" @click="emit('open-latest-release')">{{ t("updates.openRelease") }}</Button>
<template v-if="isDesktop">
<template v-if="canDownloadAndInstallUpdate(updateInfo, isDesktop)">
<div v-if="updateReady" class="flex flex-col items-end gap-1">
<Button @click="emit('restart')">{{ t("updates.restart") }}</Button>
<span class="text-xs text-muted-foreground">{{ t("updates.reopenHint") }}</span>
@@ -8,6 +8,10 @@ export function shouldOpenUpdateDialog(options: { silent?: boolean }) {
return options.silent !== true;
}
export function canDownloadAndInstallUpdate(info: api.UpdateInfo | null, isDesktop: boolean) {
return isDesktop && info?.update_available === true && info.portable_mode !== true;
}
export async function resolveUpdaterProxy(): Promise<string | undefined> {
if (!isTauriRuntime()) return undefined;
try {
@@ -80,6 +84,10 @@ export function useAppUpdater() {
async function downloadAndInstallUpdate() {
if (!isTauriRuntime() || isDownloadingUpdate.value) return;
if (!canDownloadAndInstallUpdate(updateInfo.value, true)) {
openLatestRelease();
return;
}
isDownloadingUpdate.value = true;
downloadProgress.value = 0;
try {
+2
View File
@@ -55,6 +55,8 @@ export default {
"GitHub update checks are temporarily rate limited. You can still open the release page to check manually.",
openRelease: "Open Release",
downloadAndInstall: "Download & Install",
portableManualUpdate:
"Portable builds cannot use the in-app installer. Download the portable ZIP from the release page, then extract it over the current DBX folder to keep portable.dbx and data.",
downloading: "Downloading {progress}%",
downloadFailed: "Update download failed: {error}",
restart: "Exit & Restart",
+2
View File
@@ -55,6 +55,8 @@ export default {
"Las verificaciones de actualizaciones de GitHub están temporalmente limitadas. Puedes abrir la página de lanzamientos para verificar manualmente.",
openRelease: "Abrir lanzamiento",
downloadAndInstall: "Descargar e instalar",
portableManualUpdate:
"Las versiones portables no pueden usar el instalador integrado. Descarga el ZIP portable desde la página de lanzamiento y extráelo sobre la carpeta actual de DBX para conservar portable.dbx y data.",
downloading: "Descargando {progress}%",
downloadFailed: "Error al descargar la actualización: {error}",
restart: "Salir y reiniciar",
+2
View File
@@ -54,6 +54,8 @@ export default {
rateLimited: "GitHub 更新检查暂时触发频率限制。你仍然可以打开下载页手动查看。",
openRelease: "打开下载页",
downloadAndInstall: "下载并安装",
portableManualUpdate:
"便携版不能使用应用内安装器更新。请从 release 下载便携版 ZIP,并解压覆盖当前 DBX 目录,以保留 portable.dbx 和 data。",
downloading: "下载中 {progress}%",
downloadFailed: "更新下载失败:{error}",
restart: "退出并重启",
+1
View File
@@ -908,6 +908,7 @@ export interface UpdateInfo {
current_version: string;
latest_version: string;
update_available: boolean;
portable_mode: boolean;
release_name: string;
release_url: string;
release_notes: string;