Dateien nach "frontend/public" hochladen

This commit is contained in:
2026-05-25 15:57:53 +02:00
parent eaed8617e5
commit b12b854912
2 changed files with 48 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
{
"name": "Dicken Dock",
"short_name": "DickenDock",
"description": "Dein modulares Tool-Dashboard",
"start_url": "/",
"display": "standalone",
"orientation": "portrait",
"background_color": "#0d0d0f",
"theme_color": "#0d0d0f",
"icons": [
{ "src": "/icon-192.png", "sizes": "192x192", "type": "image/png", "purpose": "any" },
{ "src": "/icon-512.png", "sizes": "512x512", "type": "image/png", "purpose": "any maskable" }
]
}

34
frontend/public/sw-1.js Normal file
View File

@@ -0,0 +1,34 @@
const CACHE = 'dickendock-v1';
const ASSETS = ['/', '/index.html'];
self.addEventListener('install', e => {
e.waitUntil(
caches.open(CACHE).then(c => c.addAll(ASSETS)).then(() => self.skipWaiting())
);
});
self.addEventListener('activate', e => {
e.waitUntil(
caches.keys().then(keys =>
Promise.all(keys.filter(k => k !== CACHE).map(k => caches.delete(k)))
).then(() => self.clients.claim())
);
});
self.addEventListener('fetch', e => {
// API-Anfragen immer live holen
if (e.request.url.includes('/api/')) {
e.respondWith(fetch(e.request).catch(() => new Response('Offline', { status: 503 })));
return;
}
// Alles andere: Cache first, dann Network
e.respondWith(
caches.match(e.request).then(cached => {
const network = fetch(e.request).then(res => {
if (res.ok) caches.open(CACHE).then(c => c.put(e.request, res.clone()));
return res;
});
return cached || network;
})
);
});