update sw.js

This commit is contained in:
Nofated095 2023-11-28 21:01:31 +08:00
parent 3419083382
commit e758ad7822
1 changed files with 24 additions and 0 deletions

View File

@ -104,6 +104,23 @@ routing.registerRoute(
})
);
routing.registerRoute(
/.*comment\.9595095\.xyz/,
new CacheFirst({
cacheName: 'static-immutable' + cacheSuffixVersion,
fetchOptions: {
mode: 'cors',
credentials: 'omit'
},
plugins: [
new ExpirationPlugin({
maxAgeSeconds: 30 * 24 * 60 * 60,
purgeOnQuotaError: true
})
]
})
);
routing.registerRoute(
/.*cdn\.jsdelivr\.net/,
new CacheFirst({
@ -215,6 +232,13 @@ routing.registerRoute(
StaleWhileRevalidateInstance
);
routing.registerRoute(
// Cache CSS files
/.*\.(json)/,
// Use cache but update in the background ASAP
StaleWhileRevalidateInstance
);
/*
* sw.js - Revalidate every time
* staleWhileRevalidate