diff --git a/src/client/sw/lang.ts b/src/client/sw/lang.ts index 247452de3d..2d05404ef9 100644 --- a/src/client/sw/lang.ts +++ b/src/client/sw/lang.ts @@ -31,7 +31,8 @@ class SwLang { const localeUrl = `/assets/locales/${await this.lang}.${_VERSION_}.json`; let localeRes = await caches.match(localeUrl); - if (!localeRes) { + // _DEV_がtrueの場合は常に最新化 + if (!localeRes || _DEV_) { localeRes = await fetch(localeUrl); const clone = localeRes?.clone(); if (!clone?.clone().ok) Error('locale fetching error'); diff --git a/src/client/sw/sw.ts b/src/client/sw/sw.ts index 2608da042c..7ad432965e 100644 --- a/src/client/sw/sw.ts +++ b/src/client/sw/sw.ts @@ -33,17 +33,19 @@ self.addEventListener('activate', ev => { }); //#endregion -// TODO: 消せるかも ref. https://github.com/syuilo/misskey/pull/7108#issuecomment-774573666 //#region When: Fetching self.addEventListener('fetch', ev => { - if (ev.request.method !== 'GET' || ev.request.url.startsWith(apiUrl)) return; - ev.respondWith( - caches.match(ev.request) - .then(response => { - return response || fetch(ev.request); - }) - .catch(() => new Response('SW cathces error while fetching. You may not be connected to the Internet, or the server may be down.', { status: 200, statusText: 'OK SW' })) - ); + /* + if (ev.request.url.startsWith(`${location.origin}/assets/locales/`)) { + ev.respondWith( + caches.match(ev.request) + .then(response => { + return response || fetch(ev.request); + }) + .catch(() => new Response('SW cathces error while fetching. You may not be connected to the Internet, or the server may be down.', { status: 200, statusText: 'OK SW' })) + ); + } + */ }); //#endregion