summaryrefslogtreecommitdiff
path: root/src/web
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-03-18 00:02:41 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-03-18 00:02:53 +0900
commit5ad77e8a3a7d3771559b02ea5c3e445ff2983533 (patch)
treed6fbaa72a612baadee18e24c9ebc7e6a1fa3eb54 /src/web
parent7.7.3 (diff)
downloadsharkey-5ad77e8a3a7d3771559b02ea5c3e445ff2983533.tar.gz
sharkey-5ad77e8a3a7d3771559b02ea5c3e445ff2983533.tar.bz2
sharkey-5ad77e8a3a7d3771559b02ea5c3e445ff2983533.zip
nanka iroiro
Diffstat (limited to 'src/web')
-rw-r--r--src/web/app/auth/view.pug5
-rw-r--r--src/web/app/base.pug10
-rw-r--r--src/web/app/boot.js20
-rw-r--r--src/web/app/client/script.js15
-rw-r--r--src/web/app/dev/view.pug3
5 files changed, 41 insertions, 12 deletions
diff --git a/src/web/app/auth/view.pug b/src/web/app/auth/view.pug
index 94ec12a9af..03ec4e6f72 100644
--- a/src/web/app/auth/view.pug
+++ b/src/web/app/auth/view.pug
@@ -1,6 +1,5 @@
extends ../base
block head
- meta(name='viewport', content='width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no')
- link(rel='stylesheet', href='/resources/auth/style.css')
- script(src='/resources/auth/script.js', async, defer)
+ meta(name='viewport' content='width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no')
+ script(src=`/resources/auth/script.${version}.js` async defer)
diff --git a/src/web/app/base.pug b/src/web/app/base.pug
index e65726fba5..90fb7b24a2 100644
--- a/src/web/app/base.pug
+++ b/src/web/app/base.pug
@@ -2,17 +2,17 @@ doctype html
!= '\r\n<!-- Thank you for using Misskey! @syuilo -->\r\n'
-html(lang='ja', dir='ltr')
+html(lang='ja' dir='ltr')
head
meta(charset='utf-8')
- meta(name='application-name', content='Misskey')
- meta(name='theme-color', content= themeColor)
- meta(name='referrer', content='origin')
+ meta(name='application-name' content='Misskey')
+ meta(name='theme-color' content=themeColor)
+ meta(name='referrer' content='origin')
title Misskey
style
include ./../../../built/web/resources/init.css
- script(src='https://use.fontawesome.com/22aba0df4f.js', async)
+ script(src='https://use.fontawesome.com/22aba0df4f.js' async)
block head
body
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
diff --git a/src/web/app/client/script.js b/src/web/app/client/script.js
index dcd6bb16f2..ffc9c892cd 100644
--- a/src/web/app/client/script.js
+++ b/src/web/app/client/script.js
@@ -1,18 +1,29 @@
+/**
+ * MISSKEY ENTRY POINT
+ */
(() => {
const head = document.getElementsByTagName('head')[0];
+
+ // Detect user agent
const ua = navigator.userAgent.toLowerCase();
const isMobile = /mobile|iphone|ipad|android/.test(ua);
isMobile ? mountMobile() : mountDesktop();
+ /**
+ * Mount the desktop app
+ */
function mountDesktop() {
const script = document.createElement('script');
- script.setAttribute('src', '/resources/desktop/script.js');
+ script.setAttribute('src', `/resources/desktop/script.${VERSION}.js`);
script.setAttribute('async', 'true');
script.setAttribute('defer', 'true');
head.appendChild(script);
}
+ /**
+ * Mount the mobile app
+ */
function mountMobile() {
const meta = document.createElement('meta');
meta.setAttribute('name', 'viewport');
@@ -20,7 +31,7 @@
head.appendChild(meta);
const script = document.createElement('script');
- script.setAttribute('src', '/resources/mobile/script.js');
+ script.setAttribute('src', `/resources/mobile/script.${VERSION}.js`);
script.setAttribute('async', 'true');
script.setAttribute('defer', 'true');
head.appendChild(script);
diff --git a/src/web/app/dev/view.pug b/src/web/app/dev/view.pug
index 5b426bcbd1..8d21c7e714 100644
--- a/src/web/app/dev/view.pug
+++ b/src/web/app/dev/view.pug
@@ -1,5 +1,4 @@
extends ../base
block head
- link(rel='stylesheet', href='/resources/dev/style.css')
- script(src='/resources/dev/script.js', async, defer)
+ script(src=`/resources/dev/script.${version}.js` async defer)