mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-11-08 13:33:42 +08:00
00364fd645
Separate Galaxy authentication and local access policy from web presentation. Co-authored-by: Danny <dannyirwin31@yahoo.com> Co-authored-by: Prabhaav Pillai <prabhaav@msu.edu> Co-authored-by: dirwin31 <83434411+dirwin31@users.noreply.github.com> Co-authored-by: firestarsdog <229254897+firestarsdog@users.noreply.github.com>
14 lines
825 B
JavaScript
14 lines
825 B
JavaScript
// Retire only the old phone router and downloaded app shell. Keep map downloads,
|
|
// Galaxy authentication, push subscriptions and all other browser preferences.
|
|
export async function retireLegacyPhone(target = globalThis) {
|
|
try {
|
|
for (const key of ["galaxy-companion-link", "galaxy-companion-ble-device", "galaxy-connection-preference", "galaxy-offline", "galaxy-home-screen-added"])
|
|
target.localStorage?.removeItem(key)
|
|
} catch { /* Private browsing can deny storage. */ }
|
|
try {
|
|
const workerURL = new URL("./sentry-push-worker.js", target.location.href).href
|
|
const registration = await target.navigator?.serviceWorker?.getRegistration(workerURL)
|
|
if (registration?.active?.scriptURL === workerURL) await registration.update()
|
|
} catch { /* Never delay opening Galaxy for a worker update. */ }
|
|
}
|