From 5ad77e8a3a7d3771559b02ea5c3e445ff2983533 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 18 Mar 2017 00:02:41 +0900 Subject: nanka iroiro --- src/web/app/boot.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/web/app/boot.js') diff --git a/src/web/app/boot.js b/src/web/app/boot.js index 6741a44231..4d008ad66f 100644 --- a/src/web/app/boot.js +++ b/src/web/app/boot.js @@ -49,6 +49,26 @@ try { Storage.prototype.setItem = () => { }; // noop } +// クライアントを更新すべきならする +if (localStorage.getItem('should-refresh') == 'true') { + localStorage.removeItem('should-refresh'); + location.reload(true); +} + +// 更新チェック +setTimeout(() => { + fetch(CONFIG.apiUrl + '/meta', { + method: 'POST' + }).then(res => { + res.json().then(meta => { + if (meta.version != VERSION) { + localStorage.setItem('should-refresh', 'true'); + alert('Misskeyの新しいバージョンがあります。ページを再度読み込みすると更新が適用されます。'); + } + }); + }); +}, 3000); + // ユーザーをフェッチしてコールバックする module.exports = callback => { // Get cached account data -- cgit v1.3.1-freya