commit: 96cb34fd9c8ea19d6dc35c6a83c52aaeead6d5b5
parent: b3bf2f9333f313e918a04f9edfefed6a794e1b7e
Author: Morgan Bazalgette <the@howl.moe>
Date: Sun, 1 Apr 2018 11:11:45 +0200
Hopefully fix the homepage being loaded issue
Diffstat:
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/app/javascript/mastodon/service_worker/entry.js b/app/javascript/mastodon/service_worker/entry.js
@@ -9,13 +9,13 @@ function openWebCache() {
}
function fetchRoot() {
- return fetch('/', { credentials: 'include' });
+ return fetch('/web', { credentials: 'include' });
}
// Cause a new version of a registered Service Worker to replace an existing one
// that is already installed, and replace the currently active worker on open pages.
self.addEventListener('install', function(event) {
- event.waitUntil(Promise.all([openWebCache(), fetchRoot()]).then(([cache, root]) => cache.put('/', root)));
+ event.waitUntil(Promise.all([openWebCache(), fetchRoot()]).then(([cache, root]) => cache.put('/web', root)));
});
self.addEventListener('activate', function(event) {
event.waitUntil(self.clients.claim());
@@ -23,19 +23,19 @@ self.addEventListener('activate', function(event) {
self.addEventListener('fetch', function(event) {
const url = new URL(event.request.url);
- if (url.pathname.startsWith('/web/')) {
+ if (url.pathname.startsWith('/web')) {
const asyncResponse = fetchRoot();
const asyncCache = openWebCache();
event.respondWith(asyncResponse.then(async response => {
if (response.ok) {
const cache = await asyncCache;
- await cache.put('/', response);
+ await cache.put('/web', response);
return response.clone();
}
throw null;
- }).catch(() => asyncCache.then(cache => cache.match('/'))));
+ }).catch(() => asyncCache.then(cache => cache.match('/web'))));
} else if (url.pathname === '/auth/sign_out') {
const asyncResponse = fetch(event.request);
const asyncCache = openWebCache();
@@ -43,7 +43,7 @@ self.addEventListener('fetch', function(event) {
event.respondWith(asyncResponse.then(async response => {
if (response.ok || response.type === 'opaqueredirect') {
const cache = await asyncCache;
- await cache.delete('/');
+ await cache.delete('/web');
}
return response;