feat(pwa): make Mila app installable with PWA manifest, service worker and high-res icons

This commit is contained in:
Moritz Graf
2026-10-11 20:57:50 +02:00
parent 1ccab5e522
commit 694d0c5072
7 changed files with 254 additions and 22 deletions
+26
View File
@@ -0,0 +1,26 @@
// Minimal service worker for Mila PWA installability & offline resilience
const CACHE_NAME = 'mila-v1';
self.addEventListener('install', (event) => {
self.skipWaiting();
});
self.addEventListener('activate', (event) => {
event.waitUntil(
caches.keys().then((keys) =>
Promise.all(
keys.map((key) => {
if (key !== CACHE_NAME) return caches.delete(key);
})
)
).then(() => self.clients.claim())
);
});
self.addEventListener('fetch', (event) => {
if (event.request.method !== 'GET') return;
// Network-first strategy: Always fetch live real-time updates from MinIO
event.respondWith(
fetch(event.request).catch(() => caches.match(event.request))
);
});