fix: purge stale 1-tap mobile pins, make remove pin button bold and prominent, and bust service worker cache

This commit is contained in:
2026-09-12 09:18:33 -07:00
parent 872be94476
commit 2bd6ebe302
4 changed files with 69 additions and 25 deletions
+30 -12
View File
@@ -1,35 +1,53 @@
// Service Worker for FlockRadar Offline Driving & Caching
const CACHE_NAME = 'flockradar-v2';
// Service Worker for FlockRadar Offline Driving & Live Updates
const CACHE_NAME = 'flockradar-v6';
const ASSETS_TO_CACHE = [
'./',
'./index.html',
'./css/styles.css',
'./js/app.js',
'./js/auth.js',
'./js/radar.js',
'./data/portals.js',
'./css/styles.css?v=6',
'./js/app.js?v=6',
'./js/auth.js?v=6',
'./js/radar.js?v=6',
'./data/portals.js?v=6',
'./manifest.json'
];
self.addEventListener('install', event => {
self.skipWaiting();
event.waitUntil(
caches.open(CACHE_NAME).then(cache => cache.addAll(ASSETS_TO_CACHE))
);
self.skipWaiting();
});
self.addEventListener('activate', event => {
event.waitUntil(
caches.keys().then(keys => Promise.all(
keys.filter(key => key !== CACHE_NAME).map(key => caches.delete(key))
))
)).then(() => self.clients.claim())
);
self.clients.claim();
});
self.addEventListener('fetch', event => {
// Network first, fallback to cache
// Always network-first for HTML, JS and CSS to ensure instant updates
const url = new URL(event.request.url);
if (url.origin === self.location.origin) {
event.respondWith(
fetch(event.request, { cache: 'no-cache' })
.then(response => {
if (response && response.status === 200) {
const clone = response.clone();
caches.open(CACHE_NAME).then(cache => cache.put(event.request, clone));
}
return response;
})
.catch(() => caches.match(event.request))
);
return;
}
// Fallback for CDN resources (Leaflet tiles etc)
event.respondWith(
fetch(event.request).catch(() => caches.match(event.request))
caches.match(event.request).then(cached => {
return cached || fetch(event.request);
})
);
});