Add base kubernetes support

This commit is contained in:
Urtzi Alfaro
2025-09-27 11:18:13 +02:00
parent a27f159e24
commit 63a3f9c77a
63 changed files with 5826 additions and 170 deletions

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><text y="14" font-size="14">🍞</text></svg>

After

Width:  |  Height:  |  Size: 106 B

View File

@@ -3,8 +3,8 @@ const urlsToCache = [
'/',
'/index.html',
'/manifest.json',
'/icons/icon-192.png',
'/icons/icon-512.png',
'/manifest.webmanifest',
'/favicon.ico',
];
// Install event - cache assets
@@ -58,12 +58,28 @@ self.addEventListener('fetch', (event) => {
return;
}
// Static assets - cache first, network fallback
event.respondWith(
caches.match(event.request).then((response) => {
return response || fetch(event.request);
})
);
// Static assets - network first, cache fallback (for versioned assets)
if (event.request.destination === 'script' || event.request.destination === 'style' || event.request.destination === 'image') {
event.respondWith(
fetch(event.request).then((response) => {
// Clone the response before caching
const responseToCache = response.clone();
caches.open(CACHE_NAME).then((cache) => {
cache.put(event.request, responseToCache);
});
return response;
}).catch(() => {
return caches.match(event.request);
})
);
} else {
// Other requests - cache first, network fallback
event.respondWith(
caches.match(event.request).then((response) => {
return response || fetch(event.request);
})
);
}
});
// Background sync for offline actions
@@ -120,4 +136,4 @@ async function syncInventoryData() {
} catch (error) {
console.error('Sync failed:', error);
}
}
}