Add sidecar update check on startup
Some checks failed
Some checks failed
On launch, after confirming the sidecar is installed, the app now checks for a newer sidecar version via the Gitea API. If an update is available, shows a prompt with "Update Now" or "Skip": - Update Now: shows the SidecarSetup download screen - Skip: launches the existing sidecar version The update check is non-blocking -- if it fails (no internet, API error), the app silently proceeds with the current version. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -9,11 +9,12 @@
|
|||||||
import { backendStore } from "$lib/stores/backend";
|
import { backendStore } from "$lib/stores/backend";
|
||||||
import { configStore } from "$lib/stores/config";
|
import { configStore } from "$lib/stores/config";
|
||||||
|
|
||||||
type SidecarState = "checking" | "needs_setup" | "starting" | "connected";
|
type SidecarState = "checking" | "needs_setup" | "update_available" | "starting" | "connected";
|
||||||
|
|
||||||
let showSettings = $state(false);
|
let showSettings = $state(false);
|
||||||
let sidecarState = $state<SidecarState>("checking");
|
let sidecarState = $state<SidecarState>("checking");
|
||||||
let debugLog = $state("");
|
let debugLog = $state("");
|
||||||
|
let availableUpdate = $state("");
|
||||||
|
|
||||||
let obsDisplayUrl = $derived(backendStore.obsUrl);
|
let obsDisplayUrl = $derived(backendStore.obsUrl);
|
||||||
let syncDisplayUrl = $derived(backendStore.syncUrl);
|
let syncDisplayUrl = $derived(backendStore.syncUrl);
|
||||||
@@ -53,6 +54,20 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check for sidecar updates before launching
|
||||||
|
try {
|
||||||
|
log("Checking for sidecar updates...");
|
||||||
|
const update = await invoke<string | null>("check_sidecar_update");
|
||||||
|
if (update) {
|
||||||
|
log(`Sidecar update available: ${update}`);
|
||||||
|
availableUpdate = update;
|
||||||
|
sidecarState = "update_available";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
log(`Update check failed (non-fatal): ${err}`);
|
||||||
|
}
|
||||||
|
|
||||||
await launchSidecar();
|
await launchSidecar();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// Not running in Tauri (browser dev mode) - skip sidecar check
|
// Not running in Tauri (browser dev mode) - skip sidecar check
|
||||||
@@ -118,6 +133,26 @@
|
|||||||
{:else if sidecarState === "needs_setup"}
|
{:else if sidecarState === "needs_setup"}
|
||||||
<SidecarSetup onComplete={onSidecarReady} />
|
<SidecarSetup onComplete={onSidecarReady} />
|
||||||
|
|
||||||
|
{:else if sidecarState === "update_available"}
|
||||||
|
<div class="connecting-overlay" style="background:#1e1e1e;color:#e0e0e0;display:flex;align-items:center;justify-content:center;height:100%;width:100%;">
|
||||||
|
<div class="connecting-content" style="text-align:center;max-width:400px;">
|
||||||
|
<h2 style="font-size:20px;margin:0 0 12px;">Sidecar Update Available</h2>
|
||||||
|
<p style="color:#a0a0a0;font-size:14px;margin:0 0 20px;">
|
||||||
|
A new version of the transcription engine is available ({availableUpdate}).
|
||||||
|
</p>
|
||||||
|
<div style="display:flex;gap:10px;justify-content:center;">
|
||||||
|
<button
|
||||||
|
style="padding:8px 20px;border:1px solid #555;border-radius:6px;background:transparent;color:#e0e0e0;cursor:pointer;"
|
||||||
|
onclick={() => launchSidecar()}
|
||||||
|
>Skip</button>
|
||||||
|
<button
|
||||||
|
style="padding:8px 20px;border:none;border-radius:6px;background:#4CAF50;color:white;cursor:pointer;font-weight:500;"
|
||||||
|
onclick={() => { sidecarState = "needs_setup"; }}
|
||||||
|
>Update Now</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{:else if !isConnected}
|
{:else if !isConnected}
|
||||||
<div class="connecting-overlay" style="background:#1e1e1e;color:#e0e0e0;display:flex;align-items:center;justify-content:center;height:100%;width:100%;">
|
<div class="connecting-overlay" style="background:#1e1e1e;color:#e0e0e0;display:flex;align-items:center;justify-content:center;height:100%;width:100%;">
|
||||||
<div class="connecting-content" style="text-align:center;">
|
<div class="connecting-content" style="text-align:center;">
|
||||||
|
|||||||
Reference in New Issue
Block a user