From 4b5ddf4d4f57a443c41b6f5fe8b1f09a8040c046 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 22 Feb 2018 05:05:19 +0900 Subject: [PATCH] wip --- src/web/app/app.vue | 2 +- src/web/app/common/mios.ts | 9 +- .../connect-failed.troubleshooter.vue | 4 +- src/web/app/mobile/views/pages/welcome.vue | 145 +++++++++++++++++- webpack/module/rules/base64.ts | 18 --- webpack/webpack.config.ts | 13 +- 6 files changed, 165 insertions(+), 26 deletions(-) delete mode 100644 webpack/module/rules/base64.ts diff --git a/src/web/app/app.vue b/src/web/app/app.vue index 497d47003..321e00393 100644 --- a/src/web/app/app.vue +++ b/src/web/app/app.vue @@ -1,3 +1,3 @@ diff --git a/src/web/app/common/mios.ts b/src/web/app/common/mios.ts index a37c5d6f7..e3a66f5b1 100644 --- a/src/web/app/common/mios.ts +++ b/src/web/app/common/mios.ts @@ -1,3 +1,4 @@ +import Vue from 'vue'; import { EventEmitter } from 'eventemitter3'; import api from './scripts/api'; import signout from './scripts/signout'; @@ -8,6 +9,8 @@ import ServerStreamManager from './scripts/streaming/server-stream-manager'; import RequestsStreamManager from './scripts/streaming/requests-stream-manager'; import MessagingIndexStreamManager from './scripts/streaming/messaging-index-stream-manager'; +import Err from '../common/views/components/connect-failed.vue'; + //#region environment variables declare const _VERSION_: string; declare const _LANG_: string; @@ -214,8 +217,10 @@ export default class MiOS extends EventEmitter { // When failure .catch(() => { // Render the error screen - //document.body.innerHTML = ''; - //riot.mount('*'); + document.body.innerHTML = '
'; + new Vue({ + render: createEl => createEl(Err) + }).$mount('#err'); Progress.done(); }); diff --git a/src/web/app/common/views/components/connect-failed.troubleshooter.vue b/src/web/app/common/views/components/connect-failed.troubleshooter.vue index 49396d158..bede504b5 100644 --- a/src/web/app/common/views/components/connect-failed.troubleshooter.vue +++ b/src/web/app/common/views/components/connect-failed.troubleshooter.vue @@ -41,8 +41,8 @@ export default Vue.extend({ return { network: navigator.onLine, end: false, - internet: false, - server: false + internet: null, + server: null }; }, mounted() { diff --git a/src/web/app/mobile/views/pages/welcome.vue b/src/web/app/mobile/views/pages/welcome.vue index 959d8cfca..84e5ae550 100644 --- a/src/web/app/mobile/views/pages/welcome.vue +++ b/src/web/app/mobile/views/pages/welcome.vue @@ -1,5 +1,146 @@ + + + + diff --git a/webpack/module/rules/base64.ts b/webpack/module/rules/base64.ts deleted file mode 100644 index c2f6b9339..000000000 --- a/webpack/module/rules/base64.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Replace base64 symbols - */ - -import * as fs from 'fs'; - -export default () => ({ - enforce: 'pre', - test: /\.(vue|js)$/, - exclude: /node_modules/, - loader: 'string-replace-loader', - query: { - search: /%base64:(.+?)%/g, - replace: (_, key) => { - return fs.readFileSync(__dirname + '/../../../src/web/' + key, 'base64'); - } - } -}); diff --git a/webpack/webpack.config.ts b/webpack/webpack.config.ts index bd8c6d120..76d298078 100644 --- a/webpack/webpack.config.ts +++ b/webpack/webpack.config.ts @@ -2,6 +2,7 @@ * webpack configuration */ +import * as fs from 'fs'; const minify = require('html-minifier').minify; import I18nReplacer from '../src/common/build/i18n'; import { pattern as faPattern, replacement as faReplacement } from '../src/common/build/fa'; @@ -19,7 +20,11 @@ global['collapseSpacesReplacement'] = html => { collapseWhitespace: true, collapseInlineTagWhitespace: true, keepClosingSlash: true - }); + }).replace(/\t/g, ''); +}; + +global['base64replacement'] = (_, key) => { + return fs.readFileSync(__dirname + '/../src/web/' + key, 'base64'); }; module.exports = Object.keys(langs).map(lang => { @@ -59,6 +64,12 @@ module.exports = Object.keys(langs).map(lang => { cssSourceMap: false, preserveWhitespace: false } + }, { + loader: 'replace', + query: { + search: /%base64:(.+?)%/g.toString(), + replace: 'base64replacement' + } }, { loader: 'webpack-replace-loader', options: {