diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/app/common/scripts/stream.ts | 2 | ||||
| -rw-r--r-- | src/client/app/common/views/components/games/reversi/reversi.game.vue | 1 | ||||
| -rw-r--r-- | src/client/app/common/views/components/games/reversi/reversi.room.vue | 2 | ||||
| -rw-r--r-- | src/client/app/common/views/components/signin.vue | 2 | ||||
| -rw-r--r-- | src/client/app/common/views/components/ui/select.vue | 17 | ||||
| -rw-r--r-- | src/config/types.ts | 2 | ||||
| -rw-r--r-- | src/remote/activitypub/request.ts | 15 | ||||
| -rw-r--r-- | src/server/api/endpoints/users.ts | 4 | ||||
| -rw-r--r-- | src/server/api/stream/channels/games/reversi-game.ts | 7 |
9 files changed, 30 insertions, 22 deletions
diff --git a/src/client/app/common/scripts/stream.ts b/src/client/app/common/scripts/stream.ts index 23f839ae85..a1b4223b55 100644 --- a/src/client/app/common/scripts/stream.ts +++ b/src/client/app/common/scripts/stream.ts @@ -21,7 +21,7 @@ export default class Stream extends EventEmitter { const user = os.store.state.i; - this.stream = new ReconnectingWebsocket(wsUrl + (user ? `?i=${user.token}` : '')); + this.stream = new ReconnectingWebsocket(wsUrl + (user ? `?i=${user.token}` : ''), '', { minReconnectionDelay: 1 }); // https://github.com/pladaria/reconnecting-websocket/issues/91 this.stream.addEventListener('open', this.onOpen); this.stream.addEventListener('close', this.onClose); this.stream.addEventListener('message', this.onMessage); diff --git a/src/client/app/common/views/components/games/reversi/reversi.game.vue b/src/client/app/common/views/components/games/reversi/reversi.game.vue index bd0401f785..315fb464b2 100644 --- a/src/client/app/common/views/components/games/reversi/reversi.game.vue +++ b/src/client/app/common/views/components/games/reversi/reversi.game.vue @@ -200,6 +200,7 @@ export default Vue.extend({ // 通信を取りこぼしてもいいように定期的にポーリングさせる if (this.game.isStarted && !this.game.isEnded) { this.pollingClock = setInterval(() => { + if (this.game.isEnded) return; const crc32 = CRC32.str(this.logs.map(x => x.pos.toString()).join('')); this.connection.send('check', { crc32: crc32 diff --git a/src/client/app/common/views/components/games/reversi/reversi.room.vue b/src/client/app/common/views/components/games/reversi/reversi.room.vue index 9ee1a78b86..c1657f49e5 100644 --- a/src/client/app/common/views/components/games/reversi/reversi.room.vue +++ b/src/client/app/common/views/components/games/reversi/reversi.room.vue @@ -230,7 +230,7 @@ export default Vue.extend({ this.game.map = Object.values(maps).find(x => x.name == this.mapName).data; } this.$forceUpdate(); - this.updateSettings(); + this.updateSettings('map'); }, onPixelClick(pos, pixel) { diff --git a/src/client/app/common/views/components/signin.vue b/src/client/app/common/views/components/signin.vue index 671158a113..03ee51d06e 100644 --- a/src/client/app/common/views/components/signin.vue +++ b/src/client/app/common/views/components/signin.vue @@ -10,7 +10,7 @@ <span>{{ $t('password') }}</span> <template #prefix><fa icon="lock"/></template> </ui-input> - <ui-input v-if="user && user.twoFactorEnabled" v-model="token" type="number" required> + <ui-input v-if="user && user.twoFactorEnabled" v-model="token" type="text" pattern="^[0-9]{6}$" autocomplete="off" spellcheck="false" required> <span>{{ $t('@.2fa') }}</span> <template #prefix><fa icon="gavel"/></template> </ui-input> diff --git a/src/client/app/common/views/components/ui/select.vue b/src/client/app/common/views/components/ui/select.vue index e8b45a4a29..ec5145ca30 100644 --- a/src/client/app/common/views/components/ui/select.vue +++ b/src/client/app/common/views/components/ui/select.vue @@ -5,10 +5,9 @@ <span class="label" ref="label"><slot name="label"></slot></span> <div class="prefix" ref="prefix"><slot name="prefix"></slot></div> <select ref="input" - :value="v" + v-model="v" :required="required" :disabled="disabled" - @input="$emit('input', $event.target.value)" @focus="focused = true" @blur="focused = false" > @@ -56,20 +55,22 @@ export default Vue.extend({ }, data() { return { - v: this.value, focused: false }; }, computed: { + v: { + get() { + return this.value; + }, + set(v) { + this.$emit('input', v); + } + }, filled(): boolean { return this.v != '' && this.v != null; } }, - watch: { - value(v) { - this.v = v; - } - }, mounted() { if (this.$refs.prefix) { this.$refs.label.style.left = (this.$refs.prefix.offsetLeft + this.$refs.prefix.offsetWidth) + 'px'; diff --git a/src/config/types.ts b/src/config/types.ts index d1749c52f7..d312a5a181 100644 --- a/src/config/types.ts +++ b/src/config/types.ts @@ -44,6 +44,8 @@ export type Source = { clusterLimit?: number; id: string; + + outgoingAddressFamily?: 'ipv4' | 'ipv6' | 'dual'; }; /** diff --git a/src/remote/activitypub/request.ts b/src/remote/activitypub/request.ts index da2113faea..3b69dd9ae4 100644 --- a/src/remote/activitypub/request.ts +++ b/src/remote/activitypub/request.ts @@ -101,11 +101,18 @@ export default async (user: ILocalUser, url: string, object: any) => { * Resolve host (with cached, asynchrony) */ async function resolveAddr(domain: string) { + const af = config.outgoingAddressFamily || 'ipv4'; + const useV4 = af == 'ipv4' || af == 'dual'; + const useV6 = af == 'ipv6' || af == 'dual'; + + const promises = []; + + if (!useV4 && !useV6) throw 'No usable address family available'; + if (useV4) promises.push(resolveAddrInner(domain, { family: 4 })); + if (useV6) promises.push(resolveAddrInner(domain, { family: 6 })); + // v4/v6で先に取得できた方を採用する - return await promiseAny([ - resolveAddrInner(domain, { family: 4 }), - resolveAddrInner(domain, { family: 6 }) - ]); + return await promiseAny(promises); } function resolveAddrInner(domain: string, options: IRunOptions = {}): Promise<string> { diff --git a/src/server/api/endpoints/users.ts b/src/server/api/endpoints/users.ts index c710706f0c..be317223b6 100644 --- a/src/server/api/endpoints/users.ts +++ b/src/server/api/endpoints/users.ts @@ -85,8 +85,8 @@ export default define(meta, async (ps, me) => { case '-follower': query.orderBy('user.followersCount', 'ASC'); break; case '+createdAt': query.orderBy('user.createdAt', 'DESC'); break; case '-createdAt': query.orderBy('user.createdAt', 'ASC'); break; - case '+updatedAt': query.orderBy('user.updatedAt', 'DESC'); break; - case '-updatedAt': query.orderBy('user.updatedAt', 'ASC'); break; + case '+updatedAt': query.andWhere('user.updatedAt IS NOT NULL').orderBy('user.updatedAt', 'DESC'); break; + case '-updatedAt': query.andWhere('user.updatedAt IS NOT NULL').orderBy('user.updatedAt', 'ASC'); break; default: query.orderBy('user.id', 'ASC'); break; } diff --git a/src/server/api/stream/channels/games/reversi-game.ts b/src/server/api/stream/channels/games/reversi-game.ts index 7c13666c51..e600179480 100644 --- a/src/server/api/stream/channels/games/reversi-game.ts +++ b/src/server/api/stream/channels/games/reversi-game.ts @@ -302,16 +302,13 @@ export default class extends Channel { } @autobind - private async check(crc32: string) { + private async check(crc32: string | number) { const game = await ReversiGames.findOne(this.gameId!); if (game == null) throw new Error('game not found'); if (!game.isStarted) return; - // 互換性のため - if (game.crc32 == null) return; - - if (crc32 !== game.crc32) { + if (crc32.toString() !== game.crc32) { this.send('rescue', await ReversiGames.pack(game, this.user)); } } |