mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-07-10 04:21:21 +02:00
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:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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 =
|
||||
|
||||
Reference in New Issue
Block a user