forked from mirror/misskey
Fix cannot update (#5890)
This commit is contained in:
parent
45cb5ff4ef
commit
cc72f91465
@ -18,7 +18,7 @@ self.addEventListener('install', ev => {
|
|||||||
caches.open(cacheName)
|
caches.open(cacheName)
|
||||||
.then(cache => {
|
.then(cache => {
|
||||||
return cache.addAll([
|
return cache.addAll([
|
||||||
'/'
|
`/?v=${version}`
|
||||||
]);
|
]);
|
||||||
})
|
})
|
||||||
.then(() => self.skipWaiting())
|
.then(() => self.skipWaiting())
|
||||||
@ -45,7 +45,7 @@ self.addEventListener('fetch', ev => {
|
|||||||
return response || fetch(ev.request);
|
return response || fetch(ev.request);
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
return caches.match('/');
|
return caches.match(`/?v=${version}`);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -327,6 +327,10 @@ const override = (source: string, target: string, depth: number = 0) =>
|
|||||||
router.get('/othello', async ctx => ctx.redirect(override(ctx.URL.pathname, 'games/reversi', 1)));
|
router.get('/othello', async ctx => ctx.redirect(override(ctx.URL.pathname, 'games/reversi', 1)));
|
||||||
router.get('/reversi', async ctx => ctx.redirect(override(ctx.URL.pathname, 'games')));
|
router.get('/reversi', async ctx => ctx.redirect(override(ctx.URL.pathname, 'games')));
|
||||||
|
|
||||||
|
router.get('/flash', async ctx => {
|
||||||
|
await ctx.render('flash');
|
||||||
|
});
|
||||||
|
|
||||||
// Render base html for all requests
|
// Render base html for all requests
|
||||||
router.get('*', async ctx => {
|
router.get('*', async ctx => {
|
||||||
const meta = await fetchMeta();
|
const meta = await fetchMeta();
|
||||||
|
20
src/server/web/views/flash.pug
Normal file
20
src/server/web/views/flash.pug
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
doctype html
|
||||||
|
|
||||||
|
html
|
||||||
|
script.
|
||||||
|
localStorage.removeItem('locale');
|
||||||
|
|
||||||
|
try {
|
||||||
|
navigator.serviceWorker.controller.postMessage('clear');
|
||||||
|
|
||||||
|
navigator.serviceWorker.getRegistrations().then(registrations => {
|
||||||
|
return Promise.all(registrations.map(registration => registration.unregister()));
|
||||||
|
}).then(() => {
|
||||||
|
location = '/';
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
setTimeout(() => {
|
||||||
|
location = '/';
|
||||||
|
}, 10000)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user