From be76a61119a043f7b0e33a583c91a8c1a4898119 Mon Sep 17 00:00:00 2001 From: Vantz Stockwell Date: Thu, 26 Mar 2026 15:16:42 -0400 Subject: [PATCH] fix: update checker uses Gitea releases API instead of Tauri updater The Tauri native updater needs update.json hosted at a static URL. Gitea packages don't support a 'latest' alias, so the endpoint returned 'package does not exist'. Reverted Settings and startup check to use check_for_updates command which queries the Gitea releases API directly and works reliably. The native auto-updater will work once we have proper static hosting for update.json (or a redirect endpoint). For now, the manual check + download page approach is functional. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/components/common/SettingsModal.vue | 33 ++++--------------------- src/layouts/MainLayout.vue | 17 ++++++------- 2 files changed, 12 insertions(+), 38 deletions(-) diff --git a/src/components/common/SettingsModal.vue b/src/components/common/SettingsModal.vue index dbb93a1..82ab4bd 100644 --- a/src/components/common/SettingsModal.vue +++ b/src/components/common/SettingsModal.vue @@ -320,25 +320,7 @@ async function checkUpdates(): Promise { updateChecking.value = true; updateInfo.value = null; try { - const { check } = await import("@tauri-apps/plugin-updater"); - const update = await check(); - if (update?.available) { - updateInfo.value = { - currentVersion: await getVersion(), - latestVersion: update.version || "unknown", - updateAvailable: true, - downloadUrl: "", - releaseNotes: update.body || "", - }; - } else { - updateInfo.value = { - currentVersion: await getVersion(), - latestVersion: await getVersion(), - updateAvailable: false, - downloadUrl: "", - releaseNotes: "", - }; - } + updateInfo.value = await invoke("check_for_updates"); } catch (err) { alert(`Update check failed: ${err}`); } @@ -346,16 +328,11 @@ async function checkUpdates(): Promise { } async function downloadUpdate(): Promise { + if (!updateInfo.value?.downloadUrl) return; try { - const { check } = await import("@tauri-apps/plugin-updater"); - const update = await check(); - if (update?.available) { - await update.downloadAndInstall(); - const { relaunch } = await import("@tauri-apps/plugin-process"); - await relaunch(); - } - } catch (err) { - alert(`Update failed: ${err}`); + await shellOpen(updateInfo.value.downloadUrl); + } catch { + window.open(updateInfo.value.downloadUrl, "_blank"); } } const currentVersion = ref("loading..."); diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index ba707f9..a79f90f 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -536,18 +536,15 @@ onMounted(async () => { } catch {} // Check for updates on startup via Tauri updater plugin (non-blocking) - import("@tauri-apps/plugin-updater").then(async ({ check }) => { - try { - const update = await check(); - if (update?.available) { - if (confirm(`Wraith v${update.version} is available. Download and install?`)) { - await update.downloadAndInstall(); - const { relaunch } = await import("@tauri-apps/plugin-process"); - await relaunch(); + invoke<{ currentVersion: string; latestVersion: string; updateAvailable: boolean; downloadUrl: string }>("check_for_updates") + .then((info) => { + if (info.updateAvailable) { + if (confirm(`Wraith v${info.latestVersion} is available (you have v${info.currentVersion}). Open download page?`)) { + import("@tauri-apps/plugin-shell").then(({ open }) => open(info.downloadUrl)).catch(() => window.open(info.downloadUrl, "_blank")); } } - } catch {} - }).catch(() => {}); + }) + .catch(() => {}); }); onUnmounted(() => {