feat: add env DISABLE_PLUGIN_STORE which will hide plugin store entry

pull/105/head
moonrailgun 2 years ago
parent bb30bce410
commit 51c7111621

@ -40,6 +40,11 @@ export interface GlobalConfig {
*
*/
disableCreateGroup?: boolean;
/**
*
*/
disablePluginStore?: boolean;
}
export function getGlobalConfig(): GlobalConfig {

@ -25,4 +25,5 @@ export const defaultGlobalConfig: GlobalConfig = {
disableUserRegister: false,
disableGuestLogin: false,
disableCreateGroup: false,
disablePluginStore: false,
};

@ -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 (
<CommonSidebarWrapper data-tc-role="sidebar-personal">
@ -49,11 +53,14 @@ export const PersonalSidebar: React.FC = React.memo(() => {
icon={<Icon icon="mdi:account-multiple" />}
to="/main/personal/friends"
/>
{!disablePluginStore && (
<SidebarItem
name={t('插件中心')}
icon={<Icon icon="mdi:puzzle" />}
to="/main/personal/plugins"
/>
)}
{/* 插件自定义面板 */}
{pluginCustomPanel

@ -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), // 是否禁用用户用户插件中心功能
},
};

@ -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,
};
}

@ -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

@ -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

Loading…
Cancel
Save