diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2022-10-23 14:05:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-23 14:05:18 +0200 |
commit | c2c14331b2c04293d8c3f94950027cf9633fd18a (patch) | |
tree | 3e048fffccab360f7aa7cdb027ec8d49d5844ad4 /app/javascript | |
parent | a43a8237681187f6e56524aa3effcfc998a877de (diff) |
Fix PWA manifest using `/web` paths (#19421)
Diffstat (limited to 'app/javascript')
-rw-r--r-- | app/javascript/mastodon/service_worker/entry.js | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/app/javascript/mastodon/service_worker/entry.js b/app/javascript/mastodon/service_worker/entry.js index e4c66cc00..4ec16d8e2 100644 --- a/app/javascript/mastodon/service_worker/entry.js +++ b/app/javascript/mastodon/service_worker/entry.js @@ -60,24 +60,15 @@ registerRoute( self.addEventListener('install', function(event) { event.waitUntil(Promise.all([openWebCache(), fetchRoot()]).then(([cache, root]) => cache.put('/', root))); }); + self.addEventListener('activate', function(event) { event.waitUntil(self.clients.claim()); }); + self.addEventListener('fetch', function(event) { const url = new URL(event.request.url); - if (url.pathname.startsWith('/web/')) { - const asyncResponse = fetchRoot(); - const asyncCache = openWebCache(); - - event.respondWith(asyncResponse.then( - response => { - const clonedResponse = response.clone(); - asyncCache.then(cache => cache.put('/', clonedResponse)).catch(); - return response; - }, - () => asyncCache.then(cache => cache.match('/')))); - } else if (url.pathname === '/auth/sign_out') { + if (url.pathname === '/auth/sign_out') { const asyncResponse = fetch(event.request); const asyncCache = openWebCache(); |