From 5c38084af523b6f21fa915b8d442a9d3f6a24f8f Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 17 May 2018 15:41:07 +0900 Subject: [PATCH 01/35] :v: --- gulpfile.ts | 2 ++ locales/index.ts | 1 + src/client/app/boot.js | 2 +- src/client/app/desktop/views/components/settings.vue | 5 +++-- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/gulpfile.ts b/gulpfile.ts index a9ccbbdb5..fa1155878 100644 --- a/gulpfile.ts +++ b/gulpfile.ts @@ -20,6 +20,7 @@ import * as replace from 'gulp-replace'; import * as htmlmin from 'gulp-htmlmin'; const uglifyes = require('uglify-es'); +import locales from './locales'; import { fa } from './src/build/fa'; const client = require('./built/client/meta.json'); import config from './src/config'; @@ -122,6 +123,7 @@ gulp.task('build:client:script', () => .pipe(replace('VERSION', JSON.stringify(client.version))) .pipe(replace('API', JSON.stringify(config.api_url))) .pipe(replace('ENV', JSON.stringify(env))) + .pipe(replace('LANGS', JSON.stringify(Object.keys(locales)))) .pipe(isProduction ? uglify({ toplevel: true } as any) : gutil.noop()) diff --git a/locales/index.ts b/locales/index.ts index 89d18190f..319d178e0 100644 --- a/locales/index.ts +++ b/locales/index.ts @@ -11,6 +11,7 @@ const loadLang = lang => yaml.safeLoad( const native = loadLang('ja'); const langs = { + 'de': loadLang('de'), 'en': loadLang('en'), 'fr': loadLang('fr'), 'ja': native, diff --git a/src/client/app/boot.js b/src/client/app/boot.js index 35d02cf9c..9338bc501 100644 --- a/src/client/app/boot.js +++ b/src/client/app/boot.js @@ -32,7 +32,7 @@ // Detect the user language // Note: The default language is Japanese let lang = navigator.language.split('-')[0]; - if (!/^(en|ja)$/.test(lang)) lang = 'ja'; + if (!LANGS.includes(lang)) lang = 'en'; if (localStorage.getItem('lang')) lang = localStorage.getItem('lang'); // Detect the user agent diff --git a/src/client/app/desktop/views/components/settings.vue b/src/client/app/desktop/views/components/settings.vue index 9439ded2f..9e13aba13 100644 --- a/src/client/app/desktop/views/components/settings.vue +++ b/src/client/app/desktop/views/components/settings.vue @@ -80,10 +80,11 @@ - - + + +
From a1692ebc7cfa7b3c6943d552ae059261fa5d18d3 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 17 May 2018 16:24:01 +0900 Subject: [PATCH 02/35] =?UTF-8?q?=E3=83=A2=E3=83=90=E3=82=A4=E3=83=AB?= =?UTF-8?q?=E7=89=88=E3=81=AE=E3=82=A6=E3=82=A3=E3=82=B8=E3=82=A7=E3=83=83?= =?UTF-8?q?=E3=83=88=E5=BE=A9=E6=B4=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/common/scripts/streaming/home.ts | 11 ++++ src/client/app/mobile/script.ts | 2 + .../app/mobile/views/components/ui.nav.vue | 1 + .../pages/{dashboard.vue => widgets.vue} | 57 +++++++------------ src/client/app/store.ts | 36 ++++++++++++ 5 files changed, 71 insertions(+), 36 deletions(-) rename src/client/app/mobile/views/pages/{dashboard.vue => widgets.vue} (77%) diff --git a/src/client/app/common/scripts/streaming/home.ts b/src/client/app/common/scripts/streaming/home.ts index 32685f3c2..09d830bec 100644 --- a/src/client/app/common/scripts/streaming/home.ts +++ b/src/client/app/common/scripts/streaming/home.ts @@ -48,6 +48,17 @@ export class HomeStream extends Stream { } }); + this.on('mobile_home_updated', x => { + if (x.home) { + os.store.commit('settings/setMobileHome', x.home); + } else { + os.store.commit('settings/setMobileHomeWidget', { + id: x.id, + data: x.data + }); + } + }); + // トークンが再生成されたとき // このままではMisskeyが利用できないので強制的にサインアウトさせる this.on('my_token_regenerated', () => { diff --git a/src/client/app/mobile/script.ts b/src/client/app/mobile/script.ts index 2e9805e0d..1405139be 100644 --- a/src/client/app/mobile/script.ts +++ b/src/client/app/mobile/script.ts @@ -23,6 +23,7 @@ import MkUser from './views/pages/user.vue'; import MkSelectDrive from './views/pages/selectdrive.vue'; import MkDrive from './views/pages/drive.vue'; import MkNotifications from './views/pages/notifications.vue'; +import MkWidgets from './views/pages/widgets.vue'; import MkMessaging from './views/pages/messaging.vue'; import MkMessagingRoom from './views/pages/messaging-room.vue'; import MkNote from './views/pages/note.vue'; @@ -56,6 +57,7 @@ init((launch) => { { path: '/i/settings', component: MkSettings }, { path: '/i/settings/profile', component: MkProfileSetting }, { path: '/i/notifications', name: 'notifications', component: MkNotifications }, + { path: '/i/widgets', name: 'widgets', component: MkWidgets }, { path: '/i/messaging', name: 'messaging', component: MkMessaging }, { path: '/i/messaging/:user', component: MkMessagingRoom }, { path: '/i/drive', name: 'drive', component: MkDrive }, diff --git a/src/client/app/mobile/views/components/ui.nav.vue b/src/client/app/mobile/views/components/ui.nav.vue index 5c65d5223..ec42dbc99 100644 --- a/src/client/app/mobile/views/components/ui.nav.vue +++ b/src/client/app/mobile/views/components/ui.nav.vue @@ -21,6 +21,7 @@
  • %fa:gamepad%ゲーム%fa:angle-right%
    • +
    • %fa:quidditch%%i18n:@widgets%%fa:angle-right%
    • %fa:cloud%%i18n:@drive%%fa:angle-right%
      diff --git a/src/client/app/mobile/views/pages/dashboard.vue b/src/client/app/mobile/views/pages/widgets.vue similarity index 77% rename from src/client/app/mobile/views/pages/dashboard.vue rename to src/client/app/mobile/views/pages/widgets.vue index a5ca6cb4a..338a5288b 100644 --- a/src/client/app/mobile/views/pages/dashboard.vue +++ b/src/client/app/mobile/views/pages/widgets.vue @@ -40,7 +40,7 @@ @@ -55,17 +55,24 @@ export default Vue.extend({ components: { XDraggable }, + data() { return { showNav: false, - widgets: [], customizing: false, widgetAdderSelected: null }; }, + + computed: { + widgets(): any[] { + return this.$store.state.settings.data.mobileHome; + } + }, + created() { - if ((this as any).clientSettings.mobileHome == null) { - Vue.set((this as any).clientSettings, 'mobileHome', [{ + if (this.widgets.length == 0) { + this.widgets = [{ name: 'calendar', id: 'a', data: {} }, { @@ -86,18 +93,9 @@ export default Vue.extend({ }, { name: 'version', id: 'g', data: {} - }]); - this.widgets = (this as any).clientSettings.mobileHome; + }]; this.saveHome(); - } else { - this.widgets = (this as any).clientSettings.mobileHome; } - - this.$watch('clientSettings', i => { - this.widgets = (this as any).clientSettings.mobileHome; - }, { - deep: true - }); }, mounted() { @@ -105,46 +103,33 @@ export default Vue.extend({ }, methods: { - onHomeUpdated(data) { - if (data.home) { - (this as any).clientSettings.mobileHome = data.home; - this.widgets = data.home; - } else { - const w = (this as any).clientSettings.mobileHome.find(w => w.id == data.id); - if (w != null) { - w.data = data.data; - this.$refs[w.id][0].preventSave = true; - this.$refs[w.id][0].props = w.data; - this.widgets = (this as any).clientSettings.mobileHome; - } - } - }, hint() { alert('ウィジェットを追加/削除したり並べ替えたりできます。ウィジェットを移動するには「三」をドラッグします。ウィジェットを削除するには「x」をタップします。いくつかのウィジェットはタップすることで表示を変更できます。'); }, + widgetFunc(id) { const w = this.$refs[id][0]; if (w.func) w.func(); }, + onWidgetSort() { this.saveHome(); }, + addWidget() { - const widget = { + this.$store.dispatch('settings/addMobileHomeWidget', { name: this.widgetAdderSelected, id: uuid(), data: {} - }; + }); + }, - this.widgets.unshift(widget); - this.saveHome(); - }, removeWidget(widget) { - this.widgets = this.widgets.filter(w => w.id != widget.id); - this.saveHome(); + this.$store.dispatch('settings/removeMobileHomeWidget', widget); }, + saveHome() { - (this as any).clientSettings.mobileHome = this.widgets; + this.$store.commit('settings/setMobileHome', this.widgets); (this as any).api('i/update_mobile_home', { home: this.widgets }); diff --git a/src/client/app/store.ts b/src/client/app/store.ts index 0bdfdef6a..e9cd952bd 100644 --- a/src/client/app/store.ts +++ b/src/client/app/store.ts @@ -3,6 +3,7 @@ import MiOS from './mios'; const defaultSettings = { home: [], + mobileHome: [], fetchOnScroll: true, showMaps: true, showPostFormOnTopOfTl: false, @@ -58,6 +59,25 @@ export default (os: MiOS) => new Vuex.Store({ addHomeWidget(state, widget) { state.data.home.unshift(widget); + }, + + setMobileHome(state, data) { + state.data.mobileHome = data; + }, + + setMobileHomeWidget(state, x) { + const w = state.data.mobileHome.find(w => w.id == x.id); + if (w) { + w.data = x.data; + } + }, + + addMobileHomeWidget(state, widget) { + state.data.mobileHome.unshift(widget); + }, + + removeMobileHomeWidget(state, widget) { + state.data.mobileHome = state.data.mobileHome.filter(w => w.id != widget.id); } }, @@ -85,6 +105,22 @@ export default (os: MiOS) => new Vuex.Store({ os.api('i/update_home', { home: ctx.state.data.home }); + }, + + addMobileHomeWidget(ctx, widget) { + ctx.commit('addMobileHomeWidget', widget); + + os.api('i/update_mobile_home', { + home: ctx.state.data.mobileHome + }); + }, + + removeMobileHomeWidget(ctx, widget) { + ctx.commit('removeMobileHomeWidget', widget); + + os.api('i/update_mobile_home', { + home: ctx.state.data.mobileHome.filter(w => w.id != widget.id) + }); } } } From cf0351225ff393cd61718cf27ff7e54682bf36ea Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 17 May 2018 17:01:07 +0900 Subject: [PATCH 03/35] Update dependencies :rocket: --- package.json | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/package.json b/package.json index 544dda603..6edc7c5be 100644 --- a/package.json +++ b/package.json @@ -35,9 +35,9 @@ "@types/chai-http": "3.0.4", "@types/debug": "0.0.30", "@types/deep-equal": "1.0.1", - "@types/elasticsearch": "5.0.22", + "@types/elasticsearch": "5.0.23", "@types/eventemitter3": "2.0.2", - "@types/gm": "1.17.33", + "@types/gm": "1.18.0", "@types/gulp": "3.8.36", "@types/gulp-htmlmin": "1.3.32", "@types/gulp-mocha": "0.0.32", @@ -64,10 +64,10 @@ "@types/license-checker": "15.0.0", "@types/mkdirp": "0.5.2", "@types/mocha": "5.2.0", - "@types/mongodb": "3.0.15", + "@types/mongodb": "3.0.18", "@types/monk": "6.0.0", "@types/ms": "0.7.30", - "@types/node": "9.6.6", + "@types/node": "10.1.0", "@types/nopt": "3.0.29", "@types/parse5": "^3.0.0", "@types/pug": "2.0.4", @@ -82,12 +82,12 @@ "@types/speakeasy": "2.0.2", "@types/tmp": "0.0.33", "@types/uuid": "3.4.3", - "@types/webpack": "4.1.4", + "@types/webpack": "4.1.7", "@types/webpack-stream": "3.2.10", - "@types/websocket": "0.0.38", - "@types/ws": "4.0.2", + "@types/websocket": "0.0.39", + "@types/ws": "5.1.1", "animejs": "2.2.0", - "autosize": "4.0.1", + "autosize": "4.0.2", "autwh": "0.1.0", "bcryptjs": "2.4.3", "bootstrap-vue": "2.0.0-rc.6", @@ -101,9 +101,9 @@ "deep-equal": "1.0.1", "deepcopy": "0.6.3", "diskusage": "0.2.4", - "dompurify": "1.0.3", + "dompurify": "1.0.4", "elasticsearch": "14.2.2", - "element-ui": "2.3.6", + "element-ui": "2.3.8", "emojilib": "2.2.12", "escape-regexp": "0.0.1", "eslint": "4.19.1", @@ -111,7 +111,7 @@ "eventemitter3": "3.1.0", "exif-js": "2.3.0", "file-loader": "1.1.11", - "file-type": "7.6.0", + "file-type": "8.0.0", "fuckadblock": "3.2.1", "gm": "1.23.1", "gulp": "3.9.1", @@ -120,15 +120,15 @@ "gulp-imagemin": "4.1.0", "gulp-mocha": "5.0.0", "gulp-pug": "4.0.1", - "gulp-rename": "1.2.2", - "gulp-replace": "0.6.1", + "gulp-rename": "1.2.3", + "gulp-replace": "1.0.0", "gulp-sourcemaps": "2.6.4", "gulp-stylus": "2.7.0", "gulp-tslint": "8.1.3", "gulp-typescript": "4.0.2", "gulp-uglify": "3.0.0", "gulp-util": "3.0.8", - "hard-source-webpack-plugin": "0.6.4", + "hard-source-webpack-plugin": "0.6.7", "highlight.js": "9.12.0", "html-minifier": "3.5.15", "http-signature": "1.2.0", @@ -136,7 +136,7 @@ "is-root": "2.0.0", "is-url": "1.2.4", "js-yaml": "3.11.0", - "jsdom": "11.9.0", + "jsdom": "11.10.0", "koa": "2.5.1", "koa-bodyparser": "4.2.0", "koa-compress": "3.0.0", @@ -150,14 +150,14 @@ "koa-slow": "2.1.0", "koa-views": "^6.1.4", "kue": "0.11.6", - "license-checker": "18.0.0", + "license-checker": "19.0.0", "loader-utils": "1.1.0", "mecab-async": "0.1.2", "mkdirp": "0.5.1", "mocha": "5.1.1", "moji": "0.5.1", - "mongodb": "3.0.7", - "monk": "6.0.5", + "mongodb": "3.0.8", + "monk": "6.0.6", "ms": "2.1.1", "nan": "2.10.0", "node-sass": "4.9.0", @@ -178,7 +178,7 @@ "recaptcha-promise": "0.1.3", "reconnecting-websocket": "3.2.2", "redis": "2.8.0", - "request": "2.85.0", + "request": "2.86.0", "request-promise-native": "1.0.5", "rimraf": "2.6.2", "rndstr": "1.0.0", @@ -196,9 +196,9 @@ "tcp-port-used": "0.1.2", "textarea-caret": "3.1.0", "tmp": "0.0.33", - "ts-loader": "4.2.0", - "ts-node": "6.0.1", - "tslint": "5.9.1", + "ts-loader": "4.3.0", + "ts-node": "6.0.3", + "tslint": "5.10.0", "typescript": "2.8.3", "typescript-eslint-parser": "15.0.0", "uglify-es": "3.3.9", @@ -209,15 +209,15 @@ "vue-cropperjs": "2.2.0", "vue-js-modal": "1.3.13", "vue-json-tree-view": "2.1.4", - "vue-loader": "15.0.3", + "vue-loader": "15.0.11", "vue-router": "3.0.1", "vue-template-compiler": "2.5.16", "vuedraggable": "2.16.0", "vuex": "3.0.1", - "web-push": "3.3.0", + "web-push": "3.3.1", "webfinger.js": "2.6.6", - "webpack": "4.6.0", - "webpack-cli": "2.0.15", + "webpack": "4.8.3", + "webpack-cli": "2.1.3", "webpack-replace-loader": "1.3.0", "websocket": "1.0.26", "ws": "5.1.1", From d253df4574a899b24ec34cbcf73096ab3faac7e1 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 17 May 2018 18:18:45 +0900 Subject: [PATCH 04/35] :v: --- package.json | 2 +- src/build/fa.ts | 5 +---- webpack.config.ts | 4 ++-- webpack/loaders/replace.js | 8 ++++---- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 6edc7c5be..0d9646acc 100644 --- a/package.json +++ b/package.json @@ -209,7 +209,7 @@ "vue-cropperjs": "2.2.0", "vue-js-modal": "1.3.13", "vue-json-tree-view": "2.1.4", - "vue-loader": "15.0.11", + "vue-loader": "15.0.5", "vue-router": "3.0.1", "vue-template-compiler": "2.5.16", "vuedraggable": "2.16.0", diff --git a/src/build/fa.ts b/src/build/fa.ts index f6f2427d0..111c19ae6 100644 --- a/src/build/fa.ts +++ b/src/build/fa.ts @@ -7,10 +7,7 @@ import * as regular from '@fortawesome/fontawesome-free-regular'; import * as solid from '@fortawesome/fontawesome-free-solid'; import * as brands from '@fortawesome/fontawesome-free-brands'; -// Add icons -fontawesome.library.add(regular); -fontawesome.library.add(solid); -fontawesome.library.add(brands); +fontawesome.library.add(regular, solid, brands); export const pattern = /%fa:(.+?)%/g; diff --git a/webpack.config.ts b/webpack.config.ts index b2f67c914..d56ed2397 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -110,14 +110,14 @@ const plugins = [ //#region i18n langs.forEach(lang => { Object.keys(entry).forEach(file => { - let src = fs.readFileSync(`${__dirname}/built/client/assets/${file}.${version}.-.${isProduction ? 'min' : 'raw'}.js`, 'utf8'); + let src = fs.readFileSync(`${__dirname}/built/client/assets/${file}.${version}.-.${isProduction ? 'min' : 'raw'}.js`, 'utf-8'); const i18nReplacer = new I18nReplacer(lang); src = src.replace(i18nReplacer.pattern, i18nReplacer.replacement); src = src.replace('%lang%', lang); - fs.writeFileSync(`${__dirname}/built/client/assets/${file}.${version}.${lang}.${isProduction ? 'min' : 'raw'}.js`, src, 'utf8'); + fs.writeFileSync(`${__dirname}/built/client/assets/${file}.${version}.${lang}.${isProduction ? 'min' : 'raw'}.js`, src, 'utf-8'); }); }); //#endregion diff --git a/webpack/loaders/replace.js b/webpack/loaders/replace.js index 0326dcdab..d8a81c245 100644 --- a/webpack/loaders/replace.js +++ b/webpack/loaders/replace.js @@ -1,12 +1,12 @@ -const loaderUtils = require('loader-utils'); +import { getOptions } from 'loader-utils'; function trim(text, g) { return text.substring(1, text.length - (g ? 2 : 0)); } -module.exports = function(src) { +export default function(src) { this.cacheable(); - const options = loaderUtils.getOptions(this); + const options = getOptions(this); const search = options.search; const g = search[search.length - 1] == 'g'; const file = this.resourcePath.replace(/\\/g, '/'); @@ -19,4 +19,4 @@ module.exports = function(src) { src = src.replace(new RegExp(trim(search, g), g ? 'g' : ''), replace); this.callback(null, src); return src; -}; +} From b2368b04db322a890029561816fd3dcac4aef1d8 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 17 May 2018 18:33:56 +0900 Subject: [PATCH 05/35] 2.7.0 --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 0d9646acc..724db93a7 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "misskey", "author": "syuilo ", - "version": "2.6.2", - "clientVersion": "1.0.5260", + "version": "2.7.0", + "clientVersion": "1.0.5345", "codename": "nighthike", "main": "./built/index.js", "private": true, From 90a4fe471d06a4a0b598d947caff2ddd69d1ed5b Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 17 May 2018 19:38:20 +0900 Subject: [PATCH 06/35] :v: --- package.json | 2 +- webpack.config.ts | 35 ++++++++++++++--------------------- webpack/loaders/replace.js | 28 ++++++++++++++++++---------- 3 files changed, 33 insertions(+), 32 deletions(-) diff --git a/package.json b/package.json index 724db93a7..356ac1f51 100644 --- a/package.json +++ b/package.json @@ -209,7 +209,7 @@ "vue-cropperjs": "2.2.0", "vue-js-modal": "1.3.13", "vue-json-tree-view": "2.1.4", - "vue-loader": "15.0.5", + "vue-loader": "15.0.11", "vue-router": "3.0.1", "vue-template-compiler": "2.5.16", "vuedraggable": "2.16.0", diff --git a/webpack.config.ts b/webpack.config.ts index d56ed2397..3aeecbd8a 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -146,27 +146,20 @@ module.exports = { }, { loader: 'replace', query: { - search: /%base64:(.+?)%/g.toString(), - replace: 'base64replacement' - } - }, { - loader: 'replace', - query: { - search: i18nPattern.toString(), - replace: 'i18nReplacement', - i18n: true - } - }, { - loader: 'replace', - query: { - search: faPattern.toString(), - replace: 'faReplacement' - } - }, { - loader: 'replace', - query: { - search: /^