Skip to content

Commit

Permalink
feat: Add disable serverDisconnectedBehavior
Browse files Browse the repository at this point in the history
  • Loading branch information
caipira113 committed Nov 23, 2024
1 parent e925d2a commit 93d50c5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/frontend/src/boot/main-boot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ export async function mainBoot() {

let reloadDialogShowing = false;
stream.on('_disconnected_', async () => {
if (defaultStore.state.serverDisconnectedBehavior === 'reload') {
if (defaultStore.state.serverDisconnectedBehavior === 'disabled') return;
else if (defaultStore.state.serverDisconnectedBehavior === 'reload') {
location.reload();
} else if (defaultStore.state.serverDisconnectedBehavior === 'dialog') {
if (reloadDialogShowing) return;
Expand Down
1 change: 1 addition & 0 deletions packages/frontend/src/pages/settings/general.vue
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<option value="reload">{{ i18n.ts._serverDisconnectedBehavior.reload }}</option>
<option value="dialog">{{ i18n.ts._serverDisconnectedBehavior.dialog }}</option>
<option value="quiet">{{ i18n.ts._serverDisconnectedBehavior.quiet }}</option>
<option value="disabled">{{ i18n.ts.disabled }}</option>
</MkSelect>
<MkSelect v-model="contextMenu">
<template #label>{{ i18n.ts._contextMenu.title }}</template>
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export const defaultStore = markRaw(new Storage('base', {
},
serverDisconnectedBehavior: {
where: 'device',
default: 'quiet' as 'quiet' | 'reload' | 'dialog',
default: 'quiet' as 'quiet' | 'reload' | 'dialog' | 'disabled',
},
nsfw: {
where: 'device',
Expand Down

1 comment on commit 93d50c5

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chromatic detects changes. Please review the changes on Chromatic.

Please sign in to comment.