fix: sw.js POST cache error + manifest icon refs
This commit is contained in:
@@ -10,21 +10,21 @@
|
||||
"categories": ["utilities", "productivity"],
|
||||
"icons": [
|
||||
{
|
||||
"src": "/icon-192.png",
|
||||
"src": "/icon-192.svg",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png",
|
||||
"type": "image/svg+xml",
|
||||
"purpose": "any maskable"
|
||||
},
|
||||
{
|
||||
"src": "/icon-512.png",
|
||||
"src": "/icon-512.svg",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png",
|
||||
"type": "image/svg+xml",
|
||||
"purpose": "any maskable"
|
||||
},
|
||||
{
|
||||
"src": "/icon-512.png",
|
||||
"src": "/icon-512.svg",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png",
|
||||
"type": "image/svg+xml",
|
||||
"purpose": "maskable"
|
||||
}
|
||||
]
|
||||
|
||||
+9
-7
@@ -1,4 +1,4 @@
|
||||
/* ── IPFS Portal — Service Worker v2 ──
|
||||
/* ── IPFS Portal — Service Worker v3 ──
|
||||
*
|
||||
* Cache strategieën per route type:
|
||||
* - Precache: app shell (alle pages)
|
||||
@@ -7,9 +7,9 @@
|
||||
* - Stale-while-revalidate: navigatie requests
|
||||
*/
|
||||
|
||||
const CACHE = 'ipfs-portal-v2';
|
||||
const STATIC_CACHE = 'ipfs-portal-static-v2';
|
||||
const DATA_CACHE = 'ipfs-portal-data-v2';
|
||||
const CACHE = 'ipfs-portal-v3';
|
||||
const STATIC_CACHE = 'ipfs-portal-static-v3';
|
||||
const DATA_CACHE = 'ipfs-portal-data-v3';
|
||||
|
||||
const PRECACHE_URLS = [
|
||||
'/',
|
||||
@@ -103,7 +103,8 @@ async function cacheFirst(request, cacheName) {
|
||||
if (cached) return cached;
|
||||
try {
|
||||
const response = await fetch(request);
|
||||
if (response.ok) {
|
||||
// Cache API supports GET/HEAD only
|
||||
if (response.ok && request.method === 'GET') {
|
||||
const cache = await caches.open(cacheName);
|
||||
cache.put(request, response.clone());
|
||||
}
|
||||
@@ -116,7 +117,8 @@ async function cacheFirst(request, cacheName) {
|
||||
async function networkFirst(request, cacheName) {
|
||||
try {
|
||||
const response = await fetch(request);
|
||||
if (response.ok) {
|
||||
// Cache API supports GET/HEAD only — POST/PUT/DELETE must be skipped
|
||||
if (response.ok && request.method === 'GET') {
|
||||
const cache = await caches.open(cacheName);
|
||||
cache.put(request, response.clone());
|
||||
}
|
||||
@@ -134,7 +136,7 @@ async function staleWhileRevalidate(request, cacheName) {
|
||||
|
||||
const fetchPromise = fetch(request)
|
||||
.then((response) => {
|
||||
if (response.ok) cache.put(request, response.clone());
|
||||
if (response.ok && request.method === 'GET') cache.put(request, response.clone());
|
||||
return response;
|
||||
})
|
||||
.catch(() => cached);
|
||||
|
||||
Reference in New Issue
Block a user