nanka iroiro

This commit is contained in:
syuilo
2017-03-18 00:02:41 +09:00
parent 6927ffa979
commit 5ad77e8a3a
10 changed files with 155 additions and 93 deletions

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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)