From bd46c5329cfca75433c6967d41af5a08b8a0f787 Mon Sep 17 00:00:00 2001 From: kakkokari-gtyih <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Sat, 22 Jun 2024 15:40:46 +0900 Subject: [PATCH] fix --- packages/frontend/src/store.ts | 5 ++++- packages/frontend/src/stream.ts | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/frontend/src/store.ts b/packages/frontend/src/store.ts index e5114b058b..02865fa565 100644 --- a/packages/frontend/src/store.ts +++ b/packages/frontend/src/store.ts @@ -454,6 +454,10 @@ export const defaultStore = markRaw(new Storage('base', { where: 'device', default: true, }, + disableWebsocket: { + where: 'device', + default: false, + }, sound_masterVolume: { where: 'device', @@ -528,7 +532,6 @@ export class ColdDeviceStorage { lightTheme, darkTheme, syncDeviceDarkMode: true, - disableWebsocket: false, plugins: [] as Plugin[], }; diff --git a/packages/frontend/src/stream.ts b/packages/frontend/src/stream.ts index d23ad8711e..992dbb0837 100644 --- a/packages/frontend/src/stream.ts +++ b/packages/frontend/src/stream.ts @@ -9,7 +9,7 @@ import { $i } from '@/account.js'; import { wsOrigin } from '@/config.js'; import { StreamMock } from '@/scripts/stream-mock.js'; import { isEmbedPage } from '@/scripts/embed-page.js'; -import { ColdDeviceStorage } from '@/store.js'; +import { defaultStore } from '@/store.js'; // heart beat interval in ms const HEART_BEAT_INTERVAL = 1000 * 60; @@ -21,7 +21,7 @@ let lastHeartbeatCall = 0; export function useStream(): Misskey.Stream { if (stream) return stream; - if (isEmbedPage() || ColdDeviceStorage.get('disableWebsocket') === true) { + if (isEmbedPage() || defaultStore.state.disableWebsocket === true) { stream = markRaw(new StreamMock(wsOrigin, null) as unknown as Misskey.Stream); return stream; } else {