Add base kubernetes support
This commit is contained in:
1
frontend/public/favicon.ico
Normal file
1
frontend/public/favicon.ico
Normal 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 |
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user