From 69802a9f004881970c0f2fe11fb646ee4c65d6d2 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 6 Feb 2020 17:21:28 +0900 Subject: [PATCH] Resolve #5850 --- locales/ja-JP.yml | 1 + src/client/app.vue | 4 ++++ src/client/pages/settings/general.vue | 8 ++++++++ src/client/store.ts | 1 + 4 files changed, 14 insertions(+) diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index e0957befa..1e0ccaeeb 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -348,6 +348,7 @@ resetPassword: "パスワードをリセット" newPasswordIs: "新しいパスワードは「{password}」です" post: "投稿" posted: "投稿しました" +autoReloadWhenDisconnected: "サーバー切断時に自動リロード" _2fa: registerDevice: "デバイスを登録" diff --git a/src/client/app.vue b/src/client/app.vue index 847a9827e..d1bc610f7 100644 --- a/src/client/app.vue +++ b/src/client/app.vue @@ -222,6 +222,10 @@ export default Vue.extend({ this.$root.stream.on('_disconnected_', () => { if (!this.disconnectedDialog) { + if (this.$store.state.device.autoReload) { + location.reload(); + return; + } this.disconnectedDialog = this.$root.dialog({ type: 'warning', showCancelButton: true, diff --git a/src/client/pages/settings/general.vue b/src/client/pages/settings/general.vue index f5c2f4cee..5b04077f3 100644 --- a/src/client/pages/settings/general.vue +++ b/src/client/pages/settings/general.vue @@ -10,6 +10,9 @@ {{ $t('removeWallpaper') }}
+ + {{ $t('autoReloadWhenDisconnected') }} + {{ $t('auto-watch') }} @@ -52,6 +55,11 @@ export default Vue.extend({ get() { return this.$store.state.settings.wallpaper; }, set(value) { this.$store.dispatch('settings/set', { key: 'wallpaper', value }); } }, + + autoReload: { + get() { return this.$store.state.device.autoReload; }, + set(value) { this.$store.commit('device/set', { key: 'autoReload', value }); } + }, }, methods: { diff --git a/src/client/store.ts b/src/client/store.ts index 73112829e..d656d932b 100644 --- a/src/client/store.ts +++ b/src/client/store.ts @@ -22,6 +22,7 @@ const defaultDeviceSettings = { loadRawImages: false, alwaysShowNsfw: false, useOsDefaultEmojis: false, + autoReload: false, accounts: [], recentEmojis: [], visibility: 'public',