diff --git a/package.json b/package.json index 1e0e50551e..d82e5d2330 100644 --- a/package.json +++ b/package.json @@ -30,20 +30,16 @@ "@fortawesome/fontawesome-free-brands": "5.0.2", "@fortawesome/fontawesome-free-regular": "5.0.2", "@fortawesome/fontawesome-free-solid": "5.0.2", + "@koa/cors": "2.2.1", "@prezzemolo/rap": "0.1.2", "@prezzemolo/zip": "0.0.3", "@types/bcryptjs": "2.4.1", - "@types/body-parser": "1.16.8", "@types/chai": "4.1.2", "@types/chai-http": "3.0.4", - "@types/compression": "0.0.36", - "@types/cookie": "0.3.1", - "@types/cors": "2.8.3", "@types/debug": "0.0.30", "@types/deep-equal": "1.0.1", "@types/elasticsearch": "5.0.22", "@types/eventemitter3": "2.0.2", - "@types/express": "4.11.1", "@types/gm": "1.17.33", "@types/gulp": "3.8.36", "@types/gulp-htmlmin": "1.3.32", @@ -56,18 +52,24 @@ "@types/is-root": "1.0.0", "@types/is-url": "1.2.28", "@types/js-yaml": "3.11.1", - "@types/kue": "^0.11.8", + "@types/koa": "2.0.45", + "@types/koa-bodyparser": "4.2.0", + "@types/koa-compress": "^2.0.8", + "@types/koa-favicon": "2.0.19", + "@types/koa-mount": "3.0.1", + "@types/koa-multer": "1.0.0", + "@types/koa-router": "7.0.27", + "@types/koa-send": "4.1.1", + "@types/koa__cors": "2.2.2", + "@types/kue": "0.11.8", "@types/license-checker": "15.0.0", "@types/mkdirp": "0.5.2", "@types/mocha": "5.0.0", "@types/mongodb": "3.0.12", "@types/monk": "6.0.0", - "@types/morgan": "1.7.35", "@types/ms": "0.7.30", - "@types/multer": "1.3.6", - "@types/node": "9.6.2", + "@types/node": "9.6.4", "@types/nopt": "3.0.29", - "@types/proxy-addr": "2.0.0", "@types/pug": "2.0.4", "@types/qrcode": "0.8.1", "@types/ratelimiter": "2.1.28", @@ -76,7 +78,6 @@ "@types/request-promise-native": "1.0.14", "@types/rimraf": "2.0.2", "@types/seedrandom": "2.4.27", - "@types/serve-favicon": "2.2.30", "@types/speakeasy": "2.0.2", "@types/tmp": "0.0.33", "@types/uuid": "3.4.3", @@ -84,27 +85,22 @@ "@types/webpack-stream": "3.2.10", "@types/websocket": "0.0.38", "@types/ws": "4.0.2", - "accesses": "2.5.0", "animejs": "2.2.0", "autosize": "4.0.1", "autwh": "0.1.0", "bcryptjs": "2.4.3", - "body-parser": "1.18.2", "bootstrap-vue": "2.0.0-rc.6", "cafy": "3.2.1", "chai": "4.1.2", "chai-http": "4.0.0", "chalk": "2.3.2", - "compression": "1.7.2", - "cookie": "0.3.1", - "cors": "2.8.4", "crc-32": "1.2.0", "css-loader": "0.28.11", "debug": "3.1.0", "deep-equal": "1.0.1", "deepcopy": "0.6.3", "diskusage": "0.2.4", - "dompurify": "^1.0.3", + "dompurify": "1.0.3", "elasticsearch": "14.2.2", "element-ui": "2.3.3", "emojilib": "2.2.12", @@ -113,7 +109,6 @@ "eslint-plugin-vue": "4.4.0", "eventemitter3": "3.0.1", "exif-js": "2.3.0", - "express": "4.16.3", "file-loader": "1.1.11", "file-type": "7.6.0", "fuckadblock": "3.2.1", @@ -135,12 +130,20 @@ "hard-source-webpack-plugin": "0.6.4", "highlight.js": "9.12.0", "html-minifier": "3.5.14", - "http-signature": "^1.2.0", + "http-signature": "1.2.0", "inquirer": "5.2.0", "is-root": "2.0.0", "is-url": "1.2.4", "js-yaml": "3.11.0", "jsdom": "11.7.0", + "koa": "2.5.0", + "koa-bodyparser": "4.2.0", + "koa-compress": "^2.0.0", + "koa-favicon": "2.0.1", + "koa-mount": "3.0.0", + "koa-multer": "1.0.2", + "koa-router": "7.4.0", + "koa-send": "4.1.3", "kue": "0.11.6", "license-checker": "18.0.0", "loader-utils": "1.1.0", @@ -150,9 +153,7 @@ "moji": "0.5.1", "mongodb": "3.0.6", "monk": "6.0.5", - "morgan": "1.9.0", "ms": "2.1.1", - "multer": "1.3.0", "nan": "2.10.0", "node-sass": "4.8.3", "node-sass-json-importer": "3.1.6", @@ -163,7 +164,6 @@ "os-utils": "0.0.14", "progress-bar-webpack-plugin": "1.11.0", "prominence": "0.2.0", - "proxy-addr": "2.0.3", "pug": "2.0.3", "punycode": "2.1.0", "qrcode": "1.2.0", @@ -178,7 +178,6 @@ "s-age": "1.1.2", "sass-loader": "6.0.7", "seedrandom": "2.4.3", - "serve-favicon": "2.5.0", "speakeasy": "2.0.0", "style-loader": "0.20.3", "stylus": "0.54.5", @@ -198,7 +197,6 @@ "url-loader": "1.0.1", "uuid": "3.2.1", "v-animate-css": "0.0.2", - "vhost": "3.0.2", "vue": "2.5.16", "vue-cropperjs": "2.2.0", "vue-js-modal": "1.3.12", diff --git a/src/client/app/boot.js b/src/client/app/boot.js index 0846e4bd55..ef828d9637 100644 --- a/src/client/app/boot.js +++ b/src/client/app/boot.js @@ -97,6 +97,8 @@ // Compare versions if (meta.version != ver) { + localStorage.setItem('v', meta.version); + alert( 'Misskeyの新しいバージョンがあります。ページを再度読み込みします。' + '\n\n' + diff --git a/src/client/app/common/mios.ts b/src/client/app/common/mios.ts index 5e0c7d2f3b..ccc73eebc3 100644 --- a/src/client/app/common/mios.ts +++ b/src/client/app/common/mios.ts @@ -444,14 +444,17 @@ export default class MiOS extends EventEmitter { // Append a credential if (this.isSignedIn) (data as any).i = this.i.token; - const viaStream = localStorage.getItem('enableExperimental') == 'true'; - return new Promise((resolve, reject) => { + const viaStream = this.stream.hasConnection && + (localStorage.getItem('apiViaStream') ? localStorage.getItem('apiViaStream') == 'true' : true); + if (viaStream) { const stream = this.stream.borrow(); const id = Math.random().toString(); stream.once(`api-res:${id}`, res => { + if (--pending === 0) spinner.parentNode.removeChild(spinner); + if (res.res) { resolve(res.res); } else { @@ -503,7 +506,7 @@ export default class MiOS extends EventEmitter { reject(body.error); } }).catch(reject); - /*}*/ + } }); } diff --git a/src/client/app/common/views/components/messaging-room.vue b/src/client/app/common/views/components/messaging-room.vue index d30c64d74a..e1b775c33a 100644 --- a/src/client/app/common/views/components/messaging-room.vue +++ b/src/client/app/common/views/components/messaging-room.vue @@ -151,7 +151,7 @@ export default Vue.extend({ // サウンドを再生する if ((this as any).os.isEnableSounds) { const sound = new Audio(`${url}/assets/message.mp3`); - sound.volume = localStorage.getItem('soundVolume') ? parseInt(localStorage.getItem('soundVolume'), 10) / 100 : 1; + sound.volume = localStorage.getItem('soundVolume') ? parseInt(localStorage.getItem('soundVolume'), 10) / 100 : 0.5; sound.play(); } diff --git a/src/client/app/common/views/components/othello.game.vue b/src/client/app/common/views/components/othello.game.vue index b9d946de96..8c646cce07 100644 --- a/src/client/app/common/views/components/othello.game.vue +++ b/src/client/app/common/views/components/othello.game.vue @@ -164,7 +164,7 @@ export default Vue.extend({ // サウンドを再生する if ((this as any).os.isEnableSounds) { const sound = new Audio(`${url}/assets/othello-put-me.mp3`); - sound.volume = localStorage.getItem('soundVolume') ? parseInt(localStorage.getItem('soundVolume'), 10) / 100 : 1; + sound.volume = localStorage.getItem('soundVolume') ? parseInt(localStorage.getItem('soundVolume'), 10) / 100 : 0.5; sound.play(); } @@ -188,7 +188,7 @@ export default Vue.extend({ // サウンドを再生する if ((this as any).os.isEnableSounds && x.color != this.myColor) { const sound = new Audio(`${url}/assets/othello-put-you.mp3`); - sound.volume = localStorage.getItem('soundVolume') ? parseInt(localStorage.getItem('soundVolume'), 10) / 100 : 1; + sound.volume = localStorage.getItem('soundVolume') ? parseInt(localStorage.getItem('soundVolume'), 10) / 100 : 0.5; sound.play(); } }, diff --git a/src/client/app/common/views/components/signup.vue b/src/client/app/common/views/components/signup.vue index 30fe7b7ad0..40262b54d3 100644 --- a/src/client/app/common/views/components/signup.vue +++ b/src/client/app/common/views/components/signup.vue @@ -77,7 +77,7 @@ export default Vue.extend({ const err = !this.username.match(/^[a-zA-Z0-9_]+$/) ? 'invalid-format' : - this.username.length < 3 ? 'min-range' : + this.username.length < 1 ? 'min-range' : this.username.length > 20 ? 'max-range' : null; diff --git a/src/client/app/common/views/components/url-preview.vue b/src/client/app/common/views/components/url-preview.vue index e91e510550..fd25480f61 100644 --- a/src/client/app/common/views/components/url-preview.vue +++ b/src/client/app/common/views/components/url-preview.vue @@ -45,7 +45,7 @@ export default Vue.extend({ } else if (url.hostname == 'youtu.be') { this.youtubeId = url.pathname; } else { - fetch('/api:url?url=' + this.url).then(res => { + fetch('/url?url=' + this.url).then(res => { res.json().then(info => { this.title = info.title; this.description = info.description; diff --git a/src/client/app/desktop/views/components/settings.vue b/src/client/app/desktop/views/components/settings.vue index 4184ae82c7..9d074165e5 100644 --- a/src/client/app/desktop/views/components/settings.vue +++ b/src/client/app/desktop/views/components/settings.vue @@ -26,6 +26,12 @@ ウィンドウが開かれるとき、ポップアウト(ブラウザ外に切り離す)可能なら自動でポップアウトします。この設定はブラウザに記憶されます。 +
+ 詳細設定 + + この設定をオンにすると、websocket接続を経由してAPIリクエストが行われます(パフォーマンス向上が期待できます)。オフにすると、ネイティブの fetch APIが利用されます。この設定はこのデバイスのみ有効です。 + +
@@ -223,7 +229,8 @@ export default Vue.extend({ checkingForUpdate: false, enableSounds: localStorage.getItem('enableSounds') == 'true', autoPopout: localStorage.getItem('autoPopout') == 'true', - soundVolume: localStorage.getItem('soundVolume') ? parseInt(localStorage.getItem('soundVolume'), 10) : 100, + apiViaStream: localStorage.getItem('apiViaStream') ? localStorage.getItem('apiViaStream') == 'true' : true, + soundVolume: localStorage.getItem('soundVolume') ? parseInt(localStorage.getItem('soundVolume'), 10) : 50, lang: localStorage.getItem('lang') || '', preventUpdate: localStorage.getItem('preventUpdate') == 'true', debug: localStorage.getItem('debug') == 'true', @@ -240,6 +247,9 @@ export default Vue.extend({ autoPopout() { localStorage.setItem('autoPopout', this.autoPopout ? 'true' : 'false'); }, + apiViaStream() { + localStorage.setItem('apiViaStream', this.apiViaStream ? 'true' : 'false'); + }, enableSounds() { localStorage.setItem('enableSounds', this.enableSounds ? 'true' : 'false'); }, @@ -337,7 +347,7 @@ export default Vue.extend({ }, soundTest() { const sound = new Audio(`${url}/assets/message.mp3`); - sound.volume = localStorage.getItem('soundVolume') ? parseInt(localStorage.getItem('soundVolume'), 10) / 100 : 1; + sound.volume = localStorage.getItem('soundVolume') ? parseInt(localStorage.getItem('soundVolume'), 10) / 100 : 0.5; sound.play(); } } diff --git a/src/client/app/desktop/views/components/timeline.vue b/src/client/app/desktop/views/components/timeline.vue index e1f88b62f3..f148e840ad 100644 --- a/src/client/app/desktop/views/components/timeline.vue +++ b/src/client/app/desktop/views/components/timeline.vue @@ -97,7 +97,7 @@ export default Vue.extend({ // サウンドを再生する if ((this as any).os.isEnableSounds) { const sound = new Audio(`${url}/assets/post.mp3`); - sound.volume = localStorage.getItem('soundVolume') ? parseInt(localStorage.getItem('soundVolume'), 10) / 100 : 1; + sound.volume = localStorage.getItem('soundVolume') ? parseInt(localStorage.getItem('soundVolume'), 10) / 100 : 0.5; sound.play(); } diff --git a/src/client/app/desktop/views/components/ui.header.account.vue b/src/client/app/desktop/views/components/ui.header.account.vue index ec4635f338..61c3019294 100644 --- a/src/client/app/desktop/views/components/ui.header.account.vue +++ b/src/client/app/desktop/views/components/ui.header.account.vue @@ -18,6 +18,9 @@