feat(desktop): show what's changed in auto-update prompt

Publish HEALTHCHAT_CHANGES.md release notes into the update feeds so users
see what changed. macOS gets them natively via releases.json's notes field;
Windows fetches a published notes.txt, since Squirrel.Windows only delivers
releaseName through the update-downloaded event.
This commit is contained in:
2026-06-28 10:24:31 +02:00
parent 87cc3351d2
commit 981fd62b8f
2 changed files with 65 additions and 3 deletions
+31 -3
View File
@@ -78,6 +78,7 @@ export async function start(updateBaseUrl: string): Promise<void> {
if (!updateBaseUrl.endsWith("/")) {
updateBaseUrl = updateBaseUrl + "/";
}
updateFeedBaseUrl = updateBaseUrl;
try {
let url: string;
@@ -184,6 +185,27 @@ interface ICachedUpdate {
updateURL: string;
}
// The feed base URL passed to start(), retained so the update-downloaded handler can fetch
// release notes out-of-band on Windows (see below).
let updateFeedBaseUrl: string | undefined;
// On Windows the autoUpdater never provides release notes: "With Squirrel.Windows only
// releaseName is available" (https://www.electronjs.org/docs/latest/api/auto-updater). We
// publish a notes.txt alongside the per-arch Squirrel feed and fetch it here so the renderer's
// update toast can show "what's changed" the same way it does on macOS (where Squirrel.Mac
// carries the notes natively via releases.json).
async function fetchWindowsReleaseNotes(): Promise<string> {
if (process.platform !== "win32" || !updateFeedBaseUrl) return "";
try {
const res = await fetch(`${updateFeedBaseUrl}win32/${process.arch}/notes.txt`);
if (!res.ok) return "";
return await res.text();
} catch (err) {
console.log("Couldn't fetch Windows release notes", err);
return "";
}
}
// cache the latest update which has been downloaded as electron offers no api to read it
let latestUpdateDownloaded: ICachedUpdate | undefined;
autoUpdater
@@ -205,7 +227,13 @@ autoUpdater
});
autoUpdater.on("update-downloaded", (ev, releaseNotes, releaseName, releaseDate, updateURL) => {
// forward to renderer
latestUpdateDownloaded = { releaseNotes, releaseName, releaseDate, updateURL };
global.mainWindow?.webContents.send("update-downloaded", latestUpdateDownloaded);
void (async (): Promise<void> => {
// Windows delivers no release notes via the event, so fetch them out-of-band.
if (!releaseNotes) {
releaseNotes = await fetchWindowsReleaseNotes();
}
// forward to renderer
latestUpdateDownloaded = { releaseNotes, releaseName, releaseDate, updateURL };
global.mainWindow?.webContents.send("update-downloaded", latestUpdateDownloaded);
})();
});