forked from maik/IPFS-portal
fix: PWA icons, SW method guard, start script
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 3.0 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
@@ -10,21 +10,21 @@
|
|||||||
"categories": ["utilities", "productivity"],
|
"categories": ["utilities", "productivity"],
|
||||||
"icons": [
|
"icons": [
|
||||||
{
|
{
|
||||||
"src": "/icon-192.svg",
|
"src": "/icon-192.png",
|
||||||
"sizes": "192x192",
|
"sizes": "192x192",
|
||||||
"type": "image/svg+xml",
|
"type": "image/png",
|
||||||
"purpose": "any maskable"
|
"purpose": "any maskable"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "/icon-512.svg",
|
"src": "/icon-512.png",
|
||||||
"sizes": "512x512",
|
"sizes": "512x512",
|
||||||
"type": "image/svg+xml",
|
"type": "image/png",
|
||||||
"purpose": "any maskable"
|
"purpose": "any maskable"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "/icon-512.svg",
|
"src": "/icon-512.png",
|
||||||
"sizes": "512x512",
|
"sizes": "512x512",
|
||||||
"type": "image/svg+xml",
|
"type": "image/png",
|
||||||
"purpose": "maskable"
|
"purpose": "maskable"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -74,6 +74,11 @@ self.addEventListener('fetch', (event) => {
|
|||||||
// Same-origin only
|
// Same-origin only
|
||||||
if (url.origin !== self.location.origin) return;
|
if (url.origin !== self.location.origin) return;
|
||||||
|
|
||||||
|
// Only cache GET/HEAD — POST/PUT/DELETE/OPTIONS can't use Cache API
|
||||||
|
if (request.method !== 'GET' && request.method !== 'HEAD') {
|
||||||
|
return; // pass through, no caching
|
||||||
|
}
|
||||||
|
|
||||||
// 1. Static assets → cache-first
|
// 1. Static assets → cache-first
|
||||||
if (isStaticAsset(url)) {
|
if (isStaticAsset(url)) {
|
||||||
event.respondWith(cacheFirst(request, STATIC_CACHE));
|
event.respondWith(cacheFirst(request, STATIC_CACHE));
|
||||||
|
|||||||
+3
-1
@@ -8,4 +8,6 @@ npm install
|
|||||||
echo "=== npm run build ==="
|
echo "=== npm run build ==="
|
||||||
npm run build
|
npm run build
|
||||||
echo "=== next start port ${PORT:=3005} ==="
|
echo "=== next start port ${PORT:=3005} ==="
|
||||||
exec npx next start --port "$PORT"
|
# Consume any extra args PM2 passes (e.g. --port=3005)
|
||||||
|
shift "$(($# < 1 ? 0 : 1))" 2>/dev/null || true
|
||||||
|
exec npx next start --port "$PORT" "$@"
|
||||||
|
|||||||
Reference in New Issue
Block a user