web: fix Beta release track unset after browser exit (#9721)

Beta cookies are set to expire after the session ends, which means update checks in the future (for example, the user puts their computer to sleep, but leaves the web app open) can erroneously suggest the latest stable on the beta release track.

Signed-off By: Chloe Oletto <NeedsChloesure@riseup.net>
This commit is contained in:
Chloe Oletto
2026-04-17 03:49:17 -07:00
committed by GitHub
parent cf3f2fc3ce
commit ebfc554cd7
2 changed files with 7 additions and 1 deletions

View File

@@ -417,6 +417,6 @@ async function switchReleaseTrack(track: string) {
if (!registration) return;
await registration.unregister();
for (const key of await caches.keys()) await caches.delete(key);
document.cookie = `release-track=${track}; Secure; Path=/`;
document.cookie = `release-track=${track}; Secure; Path=/; max-age=2147483647`;
window.location.reload();
}

View File

@@ -27,6 +27,12 @@ export async function checkForUpdate(checkOnDesktop = true) {
}
if (!IS_DESKTOP_APP) {
const releaseTrack = document.cookie.split("; ")
.find((row) => row.startsWith(`release-track=`))
?.split("=").slice(1).join("=")
if (releaseTrack){
document.cookie = `release-track=${releaseTrack}; Secure; Path=/; max-age=2147483647`;
}
AppEventManager.publish(AppEvents.checkingForUpdate);
const registrations =