From f1ab2e8007cc8f3956b940913fa0426d670a8a28 Mon Sep 17 00:00:00 2001 From: 7w1 Date: Tue, 24 Feb 2026 10:32:58 -0600 Subject: [PATCH] Account switcher toggle in config --- CHANGELOG.md | 1 + README.md | 2 ++ config.json | 2 ++ src/app/hooks/useClientConfig.ts | 2 ++ src/app/pages/client/sidebar/AccountSwitcherTab.tsx | 8 ++++++++ 5 files changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 816fda8f..7932ed05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - (potentially) fixed rare crash when changing rooms - Support Commet bios. - Raise bio limit to 1024 characters. +- Account switcher toggle in config.json. ## Version 1.0.0 diff --git a/README.md b/README.md index aed12bb1..a864f057 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,8 @@ After that, you can copy the dist/ directory to your server and serve it. * The default homeservers and explore pages are defined in [`config.json`](config.json). +* You can also disable the account switcher in the config.json. + * To deploy on subdirectory, you need to rebuild the app youself after updating the `base` path in [`build.config.ts`](build.config.ts). * For example, if you want to deploy on `https://sable.moe/app`, then set `base: '/app'`. diff --git a/config.json b/config.json index f5f6ea17..f3e2614a 100644 --- a/config.json +++ b/config.json @@ -4,6 +4,8 @@ "allowCustomHomeservers": true, "elementCallUrl": null, + "disableAccountSwitcher": false, + "featuredCommunities": { "openAsDefault": false, "spaces": [ diff --git a/src/app/hooks/useClientConfig.ts b/src/app/hooks/useClientConfig.ts index 70ba26bb..97079219 100644 --- a/src/app/hooks/useClientConfig.ts +++ b/src/app/hooks/useClientConfig.ts @@ -11,6 +11,8 @@ export type ClientConfig = { allowCustomHomeservers?: boolean; elementCallUrl?: string; + disableAccountSwitcher?: boolean; + featuredCommunities?: { openAsDefault?: boolean; spaces?: string[]; diff --git a/src/app/pages/client/sidebar/AccountSwitcherTab.tsx b/src/app/pages/client/sidebar/AccountSwitcherTab.tsx index e3918f41..4b8c29ec 100644 --- a/src/app/pages/client/sidebar/AccountSwitcherTab.tsx +++ b/src/app/pages/client/sidebar/AccountSwitcherTab.tsx @@ -31,6 +31,7 @@ import { useMediaAuthentication } from '../../../hooks/useMediaAuthentication'; import { useSessionProfiles } from '../../../hooks/useSessionProfiles'; import { Settings } from '../../../features/settings'; import { Modal500 } from '../../../components/Modal500'; import { createLogger } from '../../../utils/debug'; +import { useClientConfig } from '../../../hooks/useClientConfig'; const log = createLogger('AccountSwitcherTab'); @@ -141,8 +142,15 @@ export function AccountSwitcherTab() { const sessionProfiles = useSessionProfiles(sessions); + const { disableAccountSwitcher } = useClientConfig(); + const handleToggle: MouseEventHandler = (evt) => { + if (disableAccountSwitcher) { + setSettingsOpen(true); + return; + } + const cords = evt.currentTarget.getBoundingClientRect(); setMenuAnchor((cur) => (cur ? undefined : cords)); };