Files
StarPilot/openpilot/starpilot/galaxy/web/js/connection-migration.js
T
firestar5683 00364fd645 Galaxy Access
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>
2026-10-14 19:56:17 -05:00

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. */ }
}