1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-12-12 21:58:58 +09:00
This commit is contained in:
syuilo 2017-12-08 14:56:10 +09:00
parent 973d446358
commit 8c70c9d6a0
5 changed files with 12 additions and 36 deletions

View File

@ -95,6 +95,10 @@
// Clear cache (serive worker) // Clear cache (serive worker)
try { try {
navigator.serviceWorker.controller.postMessage('clear'); navigator.serviceWorker.controller.postMessage('clear');
navigator.serviceWorker.getRegistrations().then(registrations => {
registrations.forEach(registration => registration.unregister());
});
} catch (e) { } catch (e) {
console.error(e); console.error(e);
} }

View File

@ -11,6 +11,10 @@ export default async function(mios: MiOS) {
// Clear cache (serive worker) // Clear cache (serive worker)
try { try {
navigator.serviceWorker.controller.postMessage('clear'); navigator.serviceWorker.controller.postMessage('clear');
navigator.serviceWorker.getRegistrations().then(registrations => {
registrations.forEach(registration => registration.unregister());
});
} catch (e) { } catch (e) {
console.error(e); console.error(e);
} }

View File

@ -5,6 +5,10 @@ if (yn) {
// Clear cache (serive worker) // Clear cache (serive worker)
try { try {
navigator.serviceWorker.controller.postMessage('clear'); navigator.serviceWorker.controller.postMessage('clear');
navigator.serviceWorker.getRegistrations().then(registrations => {
registrations.forEach(registration => registration.unregister());
});
} catch (e) { } catch (e) {
console.error(e); console.error(e);
} }

View File

@ -1,34 +0,0 @@
<!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>

View File

@ -44,8 +44,6 @@ app.use('/assets', (req, res) => {
res.sendStatus(404); res.sendStatus(404);
}); });
app.use('/recover', (req, res) => res.sendFile(`${__dirname}/assets/recover.html`));
/** /**
* ServiceWroker * ServiceWroker
*/ */