2020-02-09 12:47:50 +09:00
|
|
|
doctype html
|
|
|
|
|
|
|
|
html
|
2020-05-23 13:19:31 +09:00
|
|
|
#msg
|
2020-02-09 12:47:50 +09:00
|
|
|
script.
|
2020-05-23 13:19:31 +09:00
|
|
|
const msg = document.getElementById('msg');
|
2020-02-09 12:47:50 +09:00
|
|
|
|
|
|
|
try {
|
2020-05-23 13:19:31 +09:00
|
|
|
localStorage.clear();
|
|
|
|
message('localStorage cleared');
|
2020-02-09 12:47:50 +09:00
|
|
|
|
2020-05-23 13:19:31 +09:00
|
|
|
const delidb = indexedDB.deleteDatabase('MisskeyClient');
|
|
|
|
delidb.onsuccess = () => message('indexedDB cleared');
|
|
|
|
|
|
|
|
if (navigator.serviceWorker.controller) {
|
|
|
|
navigator.serviceWorker.controller.postMessage('clear');
|
|
|
|
navigator.serviceWorker.getRegistrations()
|
|
|
|
.then(registrations => {
|
|
|
|
return Promise.all(registrations.map(registration => registration.unregister()));
|
|
|
|
})
|
|
|
|
.then(() => {
|
|
|
|
message('Success Flush! Please reopen Misskey.\n成功しました。Misskeyを開き直してください。');
|
|
|
|
})
|
|
|
|
.catch(e => { throw Error(e) });
|
|
|
|
} else {
|
|
|
|
message('Success Flush! Please reopen Misskey.\n成功しました。Misskeyを開き直してください。');
|
|
|
|
}
|
2020-02-09 12:47:50 +09:00
|
|
|
} catch (e) {
|
|
|
|
console.error(e);
|
2020-05-23 13:19:31 +09:00
|
|
|
message(`${e}¥n¥nFlush Failed. Please reopen Misskey.\n失敗しました。Misskeyを開き直してください。`);
|
2020-02-09 12:47:50 +09:00
|
|
|
setTimeout(() => {
|
|
|
|
location = '/';
|
|
|
|
}, 10000)
|
|
|
|
}
|
2020-05-23 13:19:31 +09:00
|
|
|
|
|
|
|
function message(text) {
|
|
|
|
msg.insertAdjacentHTML('beforeend', `<p>[${(new Date()).toString()}] ${text.replace(/¥n/g,'<br>')}</p>`)
|
|
|
|
}
|