fix: wire auto-updater to real Go backend — check, download, install via Wails bindings

This commit is contained in:
Vantz Stockwell 2026-03-17 10:30:09 -04:00
parent 75afa70155
commit 1f5d643056

View File

@ -60,6 +60,7 @@
<script setup lang="ts">
import { computed, ref, onMounted } from "vue";
import { Call } from "@wailsio/runtime";
import { useSessionStore } from "@/stores/session.store";
import { useConnectionStore } from "@/stores/connection.store";
@ -97,12 +98,13 @@ const connectionInfo = computed(() => {
/** Check for updates on mount. */
onMounted(async () => {
try {
// TODO: replace with Wails binding UpdateService.CheckForUpdate()
// const info = await UpdateService.CheckForUpdate();
// if (info.available) {
// updateAvailable.value = true;
// updateInfo.value = info;
// }
const info = await Call.ByName(
"github.com/vstockwell/wraith/internal/updater.UpdateService.CheckForUpdate"
) as UpdateInfoData | null;
if (info && info.available) {
updateAvailable.value = true;
updateInfo.value = info;
}
} catch {
// Silent fail update check is non-critical.
}
@ -113,10 +115,14 @@ async function handleUpdate(): Promise<void> {
if (!updateInfo.value || updateState.value === "downloading") return;
updateState.value = "downloading";
try {
// TODO: replace with Wails bindings
// const path = await UpdateService.DownloadUpdate(updateInfo.value);
// await UpdateService.ApplyUpdate(path);
console.log("Update download triggered for", updateInfo.value.latestVersion);
const path = await Call.ByName(
"github.com/vstockwell/wraith/internal/updater.UpdateService.DownloadUpdate",
updateInfo.value.latestVersion
) as string;
await Call.ByName(
"github.com/vstockwell/wraith/internal/updater.UpdateService.ApplyUpdate",
path
);
} catch (e) {
console.error("Update failed:", e);
updateState.value = "idle";