From 87b6142117b7e32c0e18788eefe4d218fb44122f Mon Sep 17 00:00:00 2001 From: tamaina Date: Sat, 13 Feb 2021 18:47:23 +0900 Subject: [PATCH 1/4] Resolve #7192 --- src/client/sw/sw.ts | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/src/client/sw/sw.ts b/src/client/sw/sw.ts index a18d305ea1..7966f82c3b 100644 --- a/src/client/sw/sw.ts +++ b/src/client/sw/sw.ts @@ -27,15 +27,7 @@ get('lang').then(async prelang => { //#region Lifecycle: Install self.addEventListener('install', ev => { - ev.waitUntil( - caches.open(cacheName) - .then(cache => { - return cache.addAll([ - `/?v=${version}` - ]); - }) - .then(() => self.skipWaiting()) - ); + // Nothing to do }); //#endregion @@ -53,19 +45,9 @@ 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(() => { - return caches.match(`/?v=${version}`); - }) - ); + // Nothing to do }); //#endregion From 640c848c41030af3dfb0609f0975d999adb41d93 Mon Sep 17 00:00:00 2001 From: tamaina Date: Sat, 13 Feb 2021 18:51:56 +0900 Subject: [PATCH 2/4] skip waiting --- src/client/sw/sw.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/sw/sw.ts b/src/client/sw/sw.ts index 7966f82c3b..7accbb2861 100644 --- a/src/client/sw/sw.ts +++ b/src/client/sw/sw.ts @@ -27,7 +27,7 @@ get('lang').then(async prelang => { //#region Lifecycle: Install self.addEventListener('install', ev => { - // Nothing to do + self.skipWaiting() }); //#endregion From 134725d2cba43b282f8ddcdd0a4048eb50a6bbb4 Mon Sep 17 00:00:00 2001 From: tamaina Date: Sat, 13 Feb 2021 18:52:36 +0900 Subject: [PATCH 3/4] fix --- src/client/sw/sw.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/sw/sw.ts b/src/client/sw/sw.ts index 7accbb2861..1a419a53e4 100644 --- a/src/client/sw/sw.ts +++ b/src/client/sw/sw.ts @@ -27,7 +27,7 @@ get('lang').then(async prelang => { //#region Lifecycle: Install self.addEventListener('install', ev => { - self.skipWaiting() + self.skipWaiting(); }); //#endregion From 0d36ee37179b647a3a1fa189799bbbe46c3132b4 Mon Sep 17 00:00:00 2001 From: tamaina Date: Sat, 13 Feb 2021 19:08:18 +0900 Subject: [PATCH 4/4] refactor --- src/client/sw/sw.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/client/sw/sw.ts b/src/client/sw/sw.ts index 1a419a53e4..68c650c771 100644 --- a/src/client/sw/sw.ts +++ b/src/client/sw/sw.ts @@ -10,7 +10,6 @@ import { I18n } from '@/scripts/i18n'; //#region Variables const version = _VERSION_; const cacheName = `mk-cache-${version}`; -const apiUrl = `${location.origin}/api/`; let lang: string; let i18n: I18n;