From e758ad7822e59ba26509db88a71d30b491b41e78 Mon Sep 17 00:00:00 2001 From: Nofated095 Date: Tue, 28 Nov 2023 21:01:31 +0800 Subject: [PATCH] update sw.js --- source/sw.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/source/sw.js b/source/sw.js index 765608a..da530aa 100644 --- a/source/sw.js +++ b/source/sw.js @@ -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