summaryrefslogtreecommitdiff
path: root/src/client/app/boot.js
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-04-16 15:59:43 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-04-16 15:59:43 +0900
commit172cca6ad6fe73d00686d0355bde264c6340958e (patch)
treedff22c58b7cb35d7c01b155f9d76de7446c3ca7a /src/client/app/boot.js
parentFix bug (diff)
downloadmisskey-172cca6ad6fe73d00686d0355bde264c6340958e.tar.gz
misskey-172cca6ad6fe73d00686d0355bde264c6340958e.tar.bz2
misskey-172cca6ad6fe73d00686d0355bde264c6340958e.zip
Better recovery system
Diffstat (limited to 'src/client/app/boot.js')
-rw-r--r--src/client/app/boot.js32
1 files changed, 20 insertions, 12 deletions
diff --git a/src/client/app/boot.js b/src/client/app/boot.js
index 12b0d220a9..a0709842b9 100644
--- a/src/client/app/boot.js
+++ b/src/client/app/boot.js
@@ -18,6 +18,8 @@
// ブロック内に入れてスコープを非グローバル化するとそれが防げます
// (Chrome以外のブラウザでは検証していません)
{
+ if (localStorage.getItem('shouldFlush') == 'true') refresh();
+
// Get the current url information
const url = new URL(location.href);
@@ -103,19 +105,25 @@
'\n\n' +
'New version of Misskey available. The page will be reloaded.');
- // Clear cache (serive worker)
- try {
- navigator.serviceWorker.controller.postMessage('clear');
+ refresh();
+ }
+ }, 3000);
+
+ function refresh() {
+ localStorage.setItem('shouldFlush', 'false');
- navigator.serviceWorker.getRegistrations().then(registrations => {
- registrations.forEach(registration => registration.unregister());
- });
- } catch (e) {
- console.error(e);
- }
+ // Clear cache (serive worker)
+ try {
+ navigator.serviceWorker.controller.postMessage('clear');
- // Force reload
- location.reload(true);
+ navigator.serviceWorker.getRegistrations().then(registrations => {
+ registrations.forEach(registration => registration.unregister());
+ });
+ } catch (e) {
+ console.error(e);
}
- }, 3000);
+
+ // Force reload
+ location.reload(true);
+ }
}