parent
8c70c9d6a0
commit
a9a581adcb
5 changed files with 36 additions and 12 deletions
|
@ -95,10 +95,6 @@
|
|||
// Clear cache (serive worker)
|
||||
try {
|
||||
navigator.serviceWorker.controller.postMessage('clear');
|
||||
|
||||
navigator.serviceWorker.getRegistrations().then(registrations => {
|
||||
registrations.forEach(registration => registration.unregister());
|
||||
});
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
|
|
|
@ -11,10 +11,6 @@ export default async function(mios: MiOS) {
|
|||
// Clear cache (serive worker)
|
||||
try {
|
||||
navigator.serviceWorker.controller.postMessage('clear');
|
||||
|
||||
navigator.serviceWorker.getRegistrations().then(registrations => {
|
||||
registrations.forEach(registration => registration.unregister());
|
||||
});
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
|
|
|
@ -5,10 +5,6 @@ if (yn) {
|
|||
// Clear cache (serive worker)
|
||||
try {
|
||||
navigator.serviceWorker.controller.postMessage('clear');
|
||||
|
||||
navigator.serviceWorker.getRegistrations().then(registrations => {
|
||||
registrations.forEach(registration => registration.unregister());
|
||||
});
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
|
|
34
src/web/assets/recover.html
Normal file
34
src/web/assets/recover.html
Normal file
|
@ -0,0 +1,34 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Misskeyのリカバリ</title>
|
||||
<script>
|
||||
|
||||
const yn = window.confirm('キャッシュをクリアしますか?\n\nDo 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('キャッシュをクリアしました。');
|
||||
|
||||
location.href = '/';
|
||||
} else {
|
||||
alert('問題が解決しない場合はサーバー管理者までお問い合せください。');
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
</html>
|
|
@ -44,6 +44,8 @@ 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