summaryrefslogtreecommitdiff
path: root/src/web/app/boot.js
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-11-28 15:05:55 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-11-28 15:05:55 +0900
commit607836331103cae089487e4d517f3de5c02ed1bc (patch)
tree94ebf18d04e203d6b4c70d809546980e0e76bd64 /src/web/app/boot.js
parentFix bug (diff)
downloadmisskey-607836331103cae089487e4d517f3de5c02ed1bc.tar.gz
misskey-607836331103cae089487e4d517f3de5c02ed1bc.tar.bz2
misskey-607836331103cae089487e4d517f3de5c02ed1bc.zip
:v:
Diffstat (limited to 'src/web/app/boot.js')
-rw-r--r--src/web/app/boot.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/web/app/boot.js b/src/web/app/boot.js
index 4a8ea030a1..a5f0e04d31 100644
--- a/src/web/app/boot.js
+++ b/src/web/app/boot.js
@@ -69,4 +69,31 @@
script.setAttribute('async', 'true');
script.setAttribute('defer', 'true');
head.appendChild(script);
+
+ // 1秒経ってもスクリプトがロードされない場合はバージョンが古くて
+ // 404になっているせいかもしれないので、バージョンを確認して古ければ更新する
+ //
+ // 読み込まれたスクリプトからこのタイマーを解除できるように、
+ // グローバルにタイマーIDを代入しておく
+ window.mkBootTimer = window.setTimeout(async () => {
+ // Fetch meta
+ const res = await fetch(API + '/meta', {
+ method: 'POST',
+ cache: 'no-cache'
+ });
+
+ // Parse
+ const meta = await res.json();
+
+ // Compare versions
+ if (meta.version != VERSION) {
+ alert(
+ 'Misskeyの新しいバージョンがあります。ページを再度読み込みします。' +
+ '\n\n' +
+ 'New version of Misskey available. The page will be reloaded.');
+
+ // Force reload
+ location.reload(true);
+ }
+ }, 1000);
}