diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2021-01-16 13:46:46 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2021-01-16 13:46:46 +0900 |
| commit | a44ad6344069ba9f1bfefc018313d6b46958aeef (patch) | |
| tree | 1709dc161333d0ca5c82fa4cef23add76be9a7b4 /src/server/web | |
| parent | Update boot.js (diff) | |
| download | sharkey-a44ad6344069ba9f1bfefc018313d6b46958aeef.tar.gz sharkey-a44ad6344069ba9f1bfefc018313d6b46958aeef.tar.bz2 sharkey-a44ad6344069ba9f1bfefc018313d6b46958aeef.zip | |
Better boot handling
Diffstat (limited to 'src/server/web')
| -rw-r--r-- | src/server/web/boot.js | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/server/web/boot.js b/src/server/web/boot.js index aab986ba28..eb7c21fb63 100644 --- a/src/server/web/boot.js +++ b/src/server/web/boot.js @@ -50,14 +50,9 @@ script.setAttribute('src', `/assets/app.${v}.js${salt}`); script.setAttribute('async', 'true'); script.setAttribute('defer', 'true'); - head.appendChild(script); + script.addEventListener('error', async () => { + document.documentElement.innerHTML = '読み込みに失敗しました。'; - // 3秒経ってもスクリプトがロードされない場合はバージョンが古くて - // 404になっているせいかもしれないので、バージョンを確認して古ければ更新する - // - // 読み込まれたスクリプトからこのタイマーを解除できるように、 - // グローバルにタイマーIDを代入しておく - window.mkBootTimer = window.setTimeout(async () => { // TODO: サーバーが落ちている場合などのエラーハンドリング const res = await fetch('/api/meta', { method: 'POST', @@ -74,7 +69,8 @@ 'New version of Misskey available. The page will be reloaded.'); refresh(); } - }, 3000); + }); + head.appendChild(script); //#endregion //#region Theme |