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; disableCreateGroup?: boolean;
/**
*
*/
disablePluginStore?: boolean;
} }
export function getGlobalConfig(): GlobalConfig { export function getGlobalConfig(): GlobalConfig {

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

@ -6,6 +6,7 @@ import {
useDMConverseList, useDMConverseList,
useUserInfo, useUserInfo,
DevContainer, DevContainer,
useGlobalConfigStore,
} from 'tailchat-shared'; } from 'tailchat-shared';
import { SidebarDMItem } from './SidebarDMItem'; import { SidebarDMItem } from './SidebarDMItem';
import { openModal } from '@/components/Modal'; import { openModal } from '@/components/Modal';
@ -38,6 +39,9 @@ SidebarSection.displayName = 'SidebarSection';
export const PersonalSidebar: React.FC = React.memo(() => { export const PersonalSidebar: React.FC = React.memo(() => {
const converseList = useDMConverseList(); const converseList = useDMConverseList();
const userInfo = useUserInfo(); const userInfo = useUserInfo();
const { disablePluginStore } = useGlobalConfigStore((state) => ({
disablePluginStore: state.disablePluginStore,
}));
return ( return (
<CommonSidebarWrapper data-tc-role="sidebar-personal"> <CommonSidebarWrapper data-tc-role="sidebar-personal">
@ -49,11 +53,14 @@ export const PersonalSidebar: React.FC = React.memo(() => {
icon={<Icon icon="mdi:account-multiple" />} icon={<Icon icon="mdi:account-multiple" />}
to="/main/personal/friends" to="/main/personal/friends"
/> />
{!disablePluginStore && (
<SidebarItem <SidebarItem
name={t('插件中心')} name={t('插件中心')}
icon={<Icon icon="mdi:puzzle" />} icon={<Icon icon="mdi:puzzle" />}
to="/main/personal/plugins" to="/main/personal/plugins"
/> />
)}
{/* 插件自定义面板 */} {/* 插件自定义面板 */}
{pluginCustomPanel {pluginCustomPanel

@ -51,6 +51,7 @@ export const config = {
disableUserRegister: checkEnvTrusty(process.env.DISABLE_USER_REGISTER), // 是否关闭用户注册功能 disableUserRegister: checkEnvTrusty(process.env.DISABLE_USER_REGISTER), // 是否关闭用户注册功能
disableGuestLogin: checkEnvTrusty(process.env.DISABLE_GUEST_LOGIN), // 是否关闭用户游客登录功能 disableGuestLogin: checkEnvTrusty(process.env.DISABLE_GUEST_LOGIN), // 是否关闭用户游客登录功能
disableCreateGroup: checkEnvTrusty(process.env.DISABLE_CREATE_GROUP), // 是否禁用用户创建群组功能 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, disableUserRegister: config.feature.disableUserRegister,
disableGuestLogin: config.feature.disableGuestLogin, disableGuestLogin: config.feature.disableGuestLogin,
disableCreateGroup: config.feature.disableCreateGroup, disableCreateGroup: config.feature.disableCreateGroup,
disablePluginStore: config.feature.disablePluginStore,
...persistConfig, ...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_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_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_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 > 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_USER_REGISTER | - | 是否关闭用户注册功能, 如果为 "1" 或者 "true" 则关闭该功能 |
| DISABLE_GUEST_LOGIN | - | 是否关闭用户游客登录功能, 如果为 "1" 或者 "true" 则关闭该功能 | | DISABLE_GUEST_LOGIN | - | 是否关闭用户游客登录功能, 如果为 "1" 或者 "true" 则关闭该功能 |
| DISABLE_CREATE_GROUP | - | 是否关闭用户创建群组功能, 如果为 "1" 或者 "true" 则关闭该功能 | | DISABLE_CREATE_GROUP | - | 是否关闭用户创建群组功能, 如果为 "1" 或者 "true" 则关闭该功能 |
| DISABLE_PLUGIN_STORE | - | 是否隐藏用户插件中心功能, 如果为 "1" 或者 "true" 则关闭该功能 |
> 部分环境变量示例可见: https://github.com/msgbyte/tailchat/blob/master/server/.env.example > 部分环境变量示例可见: https://github.com/msgbyte/tailchat/blob/master/server/.env.example

Loading…
Cancel
Save