fix: add notifications to all updater failure paths for diagnostics
All checks were successful
Build & Release / build (push) Successful in 2m55s
All checks were successful
Build & Release / build (push) Successful in 2m55s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
581a853b6f
commit
c828a6af47
1 changed files with 18 additions and 3 deletions
|
|
@ -24,18 +24,32 @@ interface Release {
|
|||
|
||||
export async function checkForUpdates() {
|
||||
try {
|
||||
console.log("[updater] checking:", RELEASES_URL);
|
||||
notify("Checking for Updates", "Looking for a new version of Sanctum…");
|
||||
|
||||
const res = await fetch(RELEASES_URL);
|
||||
if (!res.ok) return;
|
||||
if (!res.ok) {
|
||||
console.error("[updater] releases API returned", res.status, res.statusText);
|
||||
notify("Update Check Failed", `API returned ${res.status} — check console.`);
|
||||
return;
|
||||
}
|
||||
|
||||
const release = (await res.json()) as Release;
|
||||
const latest = release.tag_name.replace(/^v/, "");
|
||||
const current = app.getVersion();
|
||||
|
||||
if (!isNewer(latest, current)) return;
|
||||
console.log(`[updater] current=${current} latest=${latest}`);
|
||||
|
||||
if (!isNewer(latest, current)) {
|
||||
notify("Already Up to Date", `You're on Sanctum ${current}.`);
|
||||
return;
|
||||
}
|
||||
|
||||
const asset = findAsset(release.assets);
|
||||
if (!asset) {
|
||||
console.error("[updater] no matching asset found for platform:", process.platform, release.assets.map(a => a.name));
|
||||
const names = release.assets.map(a => a.name).join(", ");
|
||||
console.error("[updater] no matching asset for platform:", process.platform, names);
|
||||
notify("Update Failed", `No ${process.platform} asset found. Assets: ${names}`);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -44,6 +58,7 @@ export async function checkForUpdates() {
|
|||
await downloadAndInstall(asset.browser_download_url, latest);
|
||||
} catch (err) {
|
||||
console.error("[updater] update check failed:", err);
|
||||
notify("Update Check Failed", String(err));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue