feat(config): 新增用户前端访问开关

新增 `frontend_enable` 配置并接入后台站点设置,
用于控制用户首页、订阅入口及用户侧 API 是否对外开放。

开关关闭时相关用户入口统一返回空 404,
同时保留节点 API、管理后台与外部回调接口可访问。

补充特性测试覆盖默认开启、关闭隐藏与节点接口白名单场景
This commit is contained in:
yinjianm
2026-04-29 16:31:33 +08:00
parent e847252e12
commit 7a1cba4553
22 changed files with 433 additions and 15 deletions
+1 -1
View File
@@ -119,6 +119,7 @@ export const systemConfigSections: SystemConfigSectionSchema[] = [
{ key: 'logo', label: 'LOGO', type: 'url', fullWidth: true, nullable: true, placeholder: 'https://cdn.example.com/logo.png' },
{ key: 'subscribe_url', label: '订阅 URL', type: 'textarea', fullWidth: true, rows: 3, nullable: true, placeholder: '可填写一个或多个订阅入口地址' },
{ key: 'tos_url', label: '用户条款 (TOS) URL', type: 'url', fullWidth: true, nullable: true, placeholder: 'https://example.com/tos' },
{ key: 'frontend_enable', label: '开放用户前端', type: 'switch', defaultValue: true, helper: '关闭后首页和用户接口返回 404,节点接口不受影响。' },
{ key: 'stop_register', label: '停止新用户注册', type: 'switch' },
{ key: 'ticket_must_wait_reply', label: '工单等待回复限制', type: 'switch' },
{ key: 'try_out_plan_id', label: '注册试用套餐', type: 'select', optionSource: 'plans', valueType: 'number', defaultValue: 0, helper: '选择 0 表示关闭试用。' },
@@ -398,4 +399,3 @@ export function getSystemConfigFieldOptions(
return field.options ?? []
}