From 36c11e1f0f24f5fc451ad1a38fd054c2cfa4d508 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 25 Feb 2018 00:18:09 +0900 Subject: Refactor --- src/web/app/init.ts | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'src/web/app/init.ts') diff --git a/src/web/app/init.ts b/src/web/app/init.ts index 6011871e48..4a8f34f8d1 100644 --- a/src/web/app/init.ts +++ b/src/web/app/init.ts @@ -2,11 +2,6 @@ * App initializer */ -declare const _VERSION_: string; -declare const _LANG_: string; -declare const _HOST_: string; -//declare const __CONSTS__: any; - import Vue from 'vue'; import VueRouter from 'vue-router'; import VModal from 'vue-js-modal'; @@ -19,6 +14,7 @@ require('./common/views/directives'); // Register global components require('./common/views/components'); +require('./common/views/widgets'); // Register global filters require('./common/filters'); @@ -35,12 +31,13 @@ import App from './app.vue'; import checkForUpdate from './common/scripts/check-for-update'; import MiOS, { API } from './common/mios'; +import { version, host, lang } from './config'; /** * APP ENTRY POINT! */ -console.info(`Misskey v${_VERSION_} (葵 aoi)`); +console.info(`Misskey v${version} (葵 aoi)`); console.info( '%cここにコードを入力したり張り付けたりしないでください。アカウントが不正利用される可能性があります。', 'color: red; background: yellow; font-size: 16px;'); @@ -49,13 +46,13 @@ console.info( window.clearTimeout((window as any).mkBootTimer); delete (window as any).mkBootTimer; -if (_HOST_ != 'localhost') { - document.domain = _HOST_; +if (host != 'localhost') { + document.domain = host; } //#region Set lang attr const html = document.documentElement; -html.setAttribute('lang', _LANG_); +html.setAttribute('lang', lang); //#endregion //#region Set description meta tag @@ -66,9 +63,6 @@ meta.setAttribute('content', '%i18n:common.misskey%'); head.appendChild(meta); //#endregion -// Set global configuration -//(riot as any).mixin(__CONSTS__); - // iOSでプライベートモードだとlocalStorageが使えないので既存のメソッドを上書きする try { localStorage.setItem('kyoppie', 'yuppie'); @@ -132,10 +126,14 @@ export default (callback: (launch: (api: (os: MiOS) => API) => [Vue, MiOS]) => v panic(e); } - // 更新チェック - setTimeout(() => { - checkForUpdate(os); - }, 3000); + //#region 更新チェック + const preventUpdate = localStorage.getItem('preventUpdate') == 'true'; + if (!preventUpdate) { + setTimeout(() => { + checkForUpdate(os); + }, 3000); + } + //#endregion }); }; @@ -152,7 +150,7 @@ function panic(e) { + '
' + `

エラーコード: ${e.toString()}

` + `

ブラウザ バージョン: ${navigator.userAgent}

` - + `

クライアント バージョン: ${_VERSION_}

` + + `

クライアント バージョン: ${version}

` + '
' + '

問題が解決しない場合は、上記の情報をお書き添えの上 syuilotan@yahoo.co.jp までご連絡ください。

' + '

Thank you for using Misskey.

' -- cgit v1.2.3-freya