✌️
This commit is contained in:
parent
10c943d28a
commit
305a620aed
4 changed files with 22 additions and 0 deletions
|
@ -92,6 +92,13 @@
|
|||
'\n\n' +
|
||||
'New version of Misskey available. The page will be reloaded.');
|
||||
|
||||
// Clear cache (serive worker)
|
||||
try {
|
||||
navigator.serviceWorker.controller.postMessage('clear');
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
// Force reload
|
||||
location.reload(true);
|
||||
}
|
||||
|
|
|
@ -63,3 +63,9 @@ self.addEventListener('push', ev => {
|
|||
});
|
||||
}));
|
||||
});
|
||||
|
||||
self.addEventListener('message', ev => {
|
||||
if (ev.data == 'clear') {
|
||||
caches.keys().then(keys => keys.forEach(key => caches.delete(key)));
|
||||
}
|
||||
});
|
||||
|
|
8
src/web/assets/help.js
Normal file
8
src/web/assets/help.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
const yn = window.confirm(
|
||||
'サーバー上に存在しないスクリプトがリクエストされました。お使いのMisskeyのバージョンが古いことが原因の可能性があります。Misskeyを更新しますか?');
|
||||
|
||||
if (yn) {
|
||||
location.reload(true);
|
||||
} else {
|
||||
alert('問題が解決しない場合はサーバー管理者までお問い合せください。');
|
||||
}
|
|
@ -39,6 +39,7 @@ app.get('/apple-touch-icon.png', (req, res) => res.sendFile(`${__dirname}/assets
|
|||
app.use('/assets', express.static(`${__dirname}/assets`, {
|
||||
maxAge: ms('7 days')
|
||||
}));
|
||||
app.use('/assets/*.js', (req, res) => res.sendFile(`${__dirname}/assets/help.js`));
|
||||
app.use('/assets', (req, res) => {
|
||||
res.sendStatus(404);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue