fix: wire Settings update button — was a console.log stub
All checks were successful
Build & Sign Wraith / Build Windows + Sign (push) Successful in 1m5s
All checks were successful
Build & Sign Wraith / Build Windows + Sign (push) Successful in 1m5s
The "click to download" button in Settings > About only logged to console. Now calls DownloadUpdate + ApplyUpdate via Wails bindings, matching the working flow in StatusBar.vue. Added "downloading" state with spinner. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
c31563c8c6
commit
ea53ca42f0
@ -197,7 +197,7 @@
|
|||||||
:class="updateCheckState === 'found'
|
:class="updateCheckState === 'found'
|
||||||
? 'border-[#3fb950] text-[#3fb950] hover:bg-[#3fb950]/10'
|
? 'border-[#3fb950] text-[#3fb950] hover:bg-[#3fb950]/10'
|
||||||
: 'border-[#30363d] text-[var(--wraith-text-primary)] hover:bg-[#30363d]'"
|
: 'border-[#30363d] text-[var(--wraith-text-primary)] hover:bg-[#30363d]'"
|
||||||
:disabled="updateCheckState === 'checking'"
|
:disabled="updateCheckState === 'checking' || updateCheckState === 'downloading'"
|
||||||
@click="checkForUpdates"
|
@click="checkForUpdates"
|
||||||
>
|
>
|
||||||
<template v-if="updateCheckState === 'idle'">
|
<template v-if="updateCheckState === 'idle'">
|
||||||
@ -219,6 +219,13 @@
|
|||||||
</svg>
|
</svg>
|
||||||
v{{ latestVersion }} available — click to download
|
v{{ latestVersion }} available — click to download
|
||||||
</template>
|
</template>
|
||||||
|
<template v-else-if="updateCheckState === 'downloading'">
|
||||||
|
<svg class="w-3.5 h-3.5 animate-spin" viewBox="0 0 16 16" fill="currentColor">
|
||||||
|
<path d="M8 0a8 8 0 1 0 0 16A8 8 0 0 0 8 0ZM1.5 8a6.5 6.5 0 1 1 13 0 6.5 6.5 0 0 1-13 0Z" opacity=".25" />
|
||||||
|
<path d="M8 0a8 8 0 0 1 8 8h-1.5A6.5 6.5 0 0 0 8 1.5V0Z" />
|
||||||
|
</svg>
|
||||||
|
Downloading...
|
||||||
|
</template>
|
||||||
<template v-else-if="updateCheckState === 'up-to-date'">
|
<template v-else-if="updateCheckState === 'up-to-date'">
|
||||||
<svg class="w-3.5 h-3.5" viewBox="0 0 16 16" fill="currentColor">
|
<svg class="w-3.5 h-3.5" viewBox="0 0 16 16" fill="currentColor">
|
||||||
<path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z" />
|
<path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z" />
|
||||||
@ -361,11 +368,12 @@ watch(() => settings.value.scrollbackBuffer, (val) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// --- Update check state ---
|
// --- Update check state ---
|
||||||
type UpdateCheckState = "idle" | "checking" | "found" | "up-to-date" | "error";
|
type UpdateCheckState = "idle" | "checking" | "found" | "downloading" | "up-to-date" | "error";
|
||||||
const updateCheckState = ref<UpdateCheckState>("idle");
|
const updateCheckState = ref<UpdateCheckState>("idle");
|
||||||
const APP = "github.com/vstockwell/wraith/internal/app.WraithApp";
|
const APP = "github.com/vstockwell/wraith/internal/app.WraithApp";
|
||||||
const currentVersion = ref("loading...");
|
const currentVersion = ref("loading...");
|
||||||
const latestVersion = ref("");
|
const latestVersion = ref("");
|
||||||
|
const updateInfo = ref<{ available: boolean; currentVersion: string; latestVersion: string; downloadUrl: string; sha256: string } | null>(null);
|
||||||
|
|
||||||
function open(): void {
|
function open(): void {
|
||||||
visible.value = true;
|
visible.value = true;
|
||||||
@ -410,10 +418,15 @@ function importVault(): void {
|
|||||||
async function checkForUpdates(): Promise<void> {
|
async function checkForUpdates(): Promise<void> {
|
||||||
if (updateCheckState.value === "checking") return;
|
if (updateCheckState.value === "checking") return;
|
||||||
|
|
||||||
if (updateCheckState.value === "found") {
|
if (updateCheckState.value === "found" && updateInfo.value) {
|
||||||
// Second click — trigger download
|
updateCheckState.value = "downloading";
|
||||||
// TODO: replace with Wails binding — UpdateService.DownloadUpdate() + ApplyUpdate()
|
try {
|
||||||
console.log("Download update:", latestVersion.value);
|
const path = await Call.ByName(`${UPDATER}.DownloadUpdate`, updateInfo.value) as string;
|
||||||
|
await Call.ByName(`${UPDATER}.ApplyUpdate`, path);
|
||||||
|
} catch (err) {
|
||||||
|
console.error("Update failed:", err);
|
||||||
|
updateCheckState.value = "found";
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -429,6 +442,7 @@ async function checkForUpdates(): Promise<void> {
|
|||||||
currentVersion.value = info.currentVersion || currentVersion.value;
|
currentVersion.value = info.currentVersion || currentVersion.value;
|
||||||
if (info.available) {
|
if (info.available) {
|
||||||
latestVersion.value = info.latestVersion;
|
latestVersion.value = info.latestVersion;
|
||||||
|
updateInfo.value = info;
|
||||||
updateCheckState.value = "found";
|
updateCheckState.value = "found";
|
||||||
} else {
|
} else {
|
||||||
updateCheckState.value = "up-to-date";
|
updateCheckState.value = "up-to-date";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user