Fix: Replace /sw/check to /sw/img in service worker checkCache

This commit is contained in:
RH+
2025-02-07 19:33:31 +09:00
parent 7b57bdf5f1
commit ca387909ea

View File

@@ -87,8 +87,19 @@ self.addEventListener('fetch', (event) => {
async function checkCache(url){
const cache = await caches.open('risuCache')
const origURL = url.pathname;
if(url.pathname.startsWith("/sw/check")) {
url.pathname = "/sw/img" + url.pathname.slice(9);
return new Response(JSON.stringify({
"able": !!(await cache.match(url)),
"origURL": origURL,
}))
}
return new Response(JSON.stringify({
"able": !!(await cache.match(url))
"able": !!(await cache.match(url)),
"origURL": origURL,
}))
}