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
@@ -11,7 +11,7 @@ class ClientRoute
{
$router->group([
'prefix' => 'client',
'middleware' => 'client'
'middleware' => ['user.frontend', 'client']
], function ($router) {
// Client
$router->get('/subscribe', [ClientController::class, 'subscribe'])->name('client.subscribe.legacy');
+8 -4
View File
@@ -14,14 +14,18 @@ class GuestRoute
$router->group([
'prefix' => 'guest'
], function ($router) {
// Plan
$router->get('/plan/fetch', [PlanController::class, 'fetch']);
$router->group([
'middleware' => 'user.frontend'
], function ($router) {
// Plan
$router->get('/plan/fetch', [PlanController::class, 'fetch']);
// Comm
$router->get('/comm/config', [CommController::class, 'config']);
});
// Telegram
$router->post('/telegram/webhook', [TelegramController::class, 'webhook']);
// Payment
$router->match(['get', 'post'], '/payment/notify/{method}/{uuid}', [PaymentController::class, 'notify']);
// Comm
$router->get('/comm/config', [CommController::class, 'config']);
});
}
}
+2 -1
View File
@@ -10,7 +10,8 @@ class PassportRoute
public function map(Registrar $router)
{
$router->group([
'prefix' => 'passport'
'prefix' => 'passport',
'middleware' => 'user.frontend'
], function ($router) {
// Auth
$router->post('/auth/register', [AuthController::class, 'register']);
+1 -1
View File
@@ -22,7 +22,7 @@ class UserRoute
{
$router->group([
'prefix' => 'user',
'middleware' => 'user'
'middleware' => ['user.frontend', 'user']
], function ($router) {
// User
$router->get('/resetSecurity', [UserController::class, 'resetSecurity']);
+1 -1
View File
@@ -10,7 +10,7 @@ class ClientRoute
{
$router->group([
'prefix' => 'client',
'middleware' => 'client'
'middleware' => ['user.frontend', 'client']
], function ($router) {
// App
$router->get('/app/getConfig', [AppController::class, 'getConfig']);
+1 -1
View File
@@ -10,7 +10,7 @@ class UserRoute
{
$router->group([
'prefix' => 'user',
'middleware' => 'user'
'middleware' => ['user.frontend', 'user']
], function ($router) {
// User
$router->get('/resetSecurity', [UserController::class, 'resetSecurity']);