mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-10 08:23:09 +02:00
Fix #952
This commit is contained in:
parent
94434bd69e
commit
c157644110
3 changed files with 42 additions and 1 deletions
|
@ -2,6 +2,13 @@ const yn = window.confirm(
|
|||
'サーバー上に存在しないスクリプトがリクエストされました。お使いのMisskeyのバージョンが古いことが原因の可能性があります。Misskeyを更新しますか?');
|
||||
|
||||
if (yn) {
|
||||
// Clear cache (serive worker)
|
||||
try {
|
||||
navigator.serviceWorker.controller.postMessage('clear');
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
location.reload(true);
|
||||
} else {
|
||||
alert('問題が解決しない場合はサーバー管理者までお問い合せください。');
|
32
src/web/assets/recover.html
Normal file
32
src/web/assets/recover.html
Normal file
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Misskeyのリカバリ</title>
|
||||
<script>
|
||||
|
||||
const yn = window.confirm('キャッシュをクリアしますか?\y\yDo you want to clear caches?');
|
||||
|
||||
if (yn) {
|
||||
try {
|
||||
navigator.serviceWorker.controller.postMessage('clear');
|
||||
|
||||
navigator.serviceWorker.getRegistrations().then(registrations => {
|
||||
registrations.forEach(registration => registration.unregister());
|
||||
});
|
||||
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
localStorage.setItem('should-refresh', 'true');
|
||||
|
||||
alert('キャッシュをクリアしました。');
|
||||
} else {
|
||||
alert('問題が解決しない場合はサーバー管理者までお問い合せください。');
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
</html>
|
|
@ -39,11 +39,13 @@ 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/*.js', (req, res) => res.sendFile(`${__dirname}/assets/404.js`));
|
||||
app.use('/assets', (req, res) => {
|
||||
res.sendStatus(404);
|
||||
});
|
||||
|
||||
app.use('/recover', (req, res) => res.sendFile(`${__dirname}/assets/recover.html`));
|
||||
|
||||
/**
|
||||
* ServiceWroker
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue