diff --git a/client/shared/model/config.ts b/client/shared/model/config.ts index 60835dc0..7578b146 100644 --- a/client/shared/model/config.ts +++ b/client/shared/model/config.ts @@ -40,6 +40,11 @@ export interface GlobalConfig { * 是否禁用创建群组功能 */ disableCreateGroup?: boolean; + + /** + * 是否禁用插件中心 + */ + disablePluginStore?: boolean; } export function getGlobalConfig(): GlobalConfig { diff --git a/client/shared/utils/consts.ts b/client/shared/utils/consts.ts index 50fa02ae..be828de1 100644 --- a/client/shared/utils/consts.ts +++ b/client/shared/utils/consts.ts @@ -25,4 +25,5 @@ export const defaultGlobalConfig: GlobalConfig = { disableUserRegister: false, disableGuestLogin: false, disableCreateGroup: false, + disablePluginStore: false, }; diff --git a/client/web/src/routes/Main/Content/Personal/Sidebar.tsx b/client/web/src/routes/Main/Content/Personal/Sidebar.tsx index 238f3148..11e20b46 100644 --- a/client/web/src/routes/Main/Content/Personal/Sidebar.tsx +++ b/client/web/src/routes/Main/Content/Personal/Sidebar.tsx @@ -6,6 +6,7 @@ import { useDMConverseList, useUserInfo, DevContainer, + useGlobalConfigStore, } from 'tailchat-shared'; import { SidebarDMItem } from './SidebarDMItem'; import { openModal } from '@/components/Modal'; @@ -38,6 +39,9 @@ SidebarSection.displayName = 'SidebarSection'; export const PersonalSidebar: React.FC = React.memo(() => { const converseList = useDMConverseList(); const userInfo = useUserInfo(); + const { disablePluginStore } = useGlobalConfigStore((state) => ({ + disablePluginStore: state.disablePluginStore, + })); return ( @@ -49,11 +53,14 @@ export const PersonalSidebar: React.FC = React.memo(() => { icon={} to="/main/personal/friends" /> - } - to="/main/personal/plugins" - /> + + {!disablePluginStore && ( + } + to="/main/personal/plugins" + /> + )} {/* 插件自定义面板 */} {pluginCustomPanel diff --git a/server/packages/sdk/src/services/lib/settings.ts b/server/packages/sdk/src/services/lib/settings.ts index 15af08f2..3a036c55 100644 --- a/server/packages/sdk/src/services/lib/settings.ts +++ b/server/packages/sdk/src/services/lib/settings.ts @@ -51,6 +51,7 @@ export const config = { disableUserRegister: checkEnvTrusty(process.env.DISABLE_USER_REGISTER), // 是否关闭用户注册功能 disableGuestLogin: checkEnvTrusty(process.env.DISABLE_GUEST_LOGIN), // 是否关闭用户游客登录功能 disableCreateGroup: checkEnvTrusty(process.env.DISABLE_CREATE_GROUP), // 是否禁用用户创建群组功能 + disablePluginStore: checkEnvTrusty(process.env.DISABLE_PLUGIN_STORE), // 是否禁用用户用户插件中心功能 }, }; diff --git a/server/services/core/config.service.ts b/server/services/core/config.service.ts index 15e642c7..47d7714e 100644 --- a/server/services/core/config.service.ts +++ b/server/services/core/config.service.ts @@ -82,6 +82,7 @@ class ConfigService extends TcService { disableUserRegister: config.feature.disableUserRegister, disableGuestLogin: config.feature.disableGuestLogin, disableCreateGroup: config.feature.disableCreateGroup, + disablePluginStore: config.feature.disablePluginStore, ...persistConfig, }; } diff --git a/website/docs/deployment/environment.md b/website/docs/deployment/environment.md index 1bd54ae0..72b50d2e 100644 --- a/website/docs/deployment/environment.md +++ b/website/docs/deployment/environment.md @@ -25,6 +25,7 @@ title: Environment Variable | DISABLE_USER_REGISTER | - | Whether to disable the user register, if "1" or "true" turn off this method | | DISABLE_GUEST_LOGIN | - | Whether to disable the guest login, if "1" or "true" turn off this method | | DISABLE_CREATE_GROUP | - | Whether to disable user create group, if "1" or "true" turn off this method | +| DISABLE_PLUGIN_STORE | - | Whether to hide user plugin store entry, if "1" or "true" turn off this method | > Some examples of environment variables can be seen: https://github.com/msgbyte/tailchat/blob/master/server/.env.example diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/deployment/environment.md b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/deployment/environment.md index 1b75b4f1..3b78d13c 100644 --- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/deployment/environment.md +++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/deployment/environment.md @@ -25,6 +25,7 @@ title: 环境变量 | DISABLE_USER_REGISTER | - | 是否关闭用户注册功能, 如果为 "1" 或者 "true" 则关闭该功能 | | DISABLE_GUEST_LOGIN | - | 是否关闭用户游客登录功能, 如果为 "1" 或者 "true" 则关闭该功能 | | DISABLE_CREATE_GROUP | - | 是否关闭用户创建群组功能, 如果为 "1" 或者 "true" 则关闭该功能 | +| DISABLE_PLUGIN_STORE | - | 是否隐藏用户插件中心功能, 如果为 "1" 或者 "true" 则关闭该功能 | > 部分环境变量示例可见: https://github.com/msgbyte/tailchat/blob/master/server/.env.example