update: more secure path

This commit is contained in:
tokumeikoi 2022-12-15 00:59:32 +08:00
parent a77523c3b5
commit 4d8bb0d8e9
7 changed files with 14 additions and 9 deletions

View File

@ -107,7 +107,8 @@ class ConfigController extends Controller
'currency_symbol' => config('v2board.currency_symbol', '¥'),
'register_limit_by_ip_enable' => (int)config('v2board.register_limit_by_ip_enable', 0),
'register_limit_count' => config('v2board.register_limit_count', 3),
'register_limit_expire' => config('v2board.register_limit_expire', 60)
'register_limit_expire' => config('v2board.register_limit_expire', 60),
'secure_path' => config('v2board.secure_path', config('v2board.frontend_admin_path', 'admin'))
],
'subscribe' => [
'plan_change_enable' => (int)config('v2board.plan_change_enable', 1),
@ -124,7 +125,6 @@ class ConfigController extends Controller
'frontend_theme_header' => config('v2board.frontend_theme_header', 'dark'),
'frontend_theme_color' => config('v2board.frontend_theme_color', 'default'),
'frontend_background_url' => config('v2board.frontend_background_url'),
'frontend_admin_path' => config('v2board.frontend_admin_path', 'admin')
],
'server' => [
'server_token' => config('v2board.server_token'),

View File

@ -46,6 +46,7 @@ class ConfigSave extends FormRequest
'register_limit_by_ip_enable' => 'in:0,1',
'register_limit_count' => 'integer',
'register_limit_expire' => 'integer',
'secure_path' => '',
// subscribe
'plan_change_enable' => 'in:0,1',
'reset_traffic_method' => 'in:0,1,2,3,4',
@ -64,7 +65,6 @@ class ConfigSave extends FormRequest
'frontend_theme_header' => 'in:dark,light',
'frontend_theme_color' => 'in:default,darkblue,black,green',
'frontend_background_url' => 'nullable|url',
'frontend_admin_path' => '',
// email
'email_template' => '',
'email_host' => '',

View File

@ -8,7 +8,7 @@ class AdminRoute
public function map(Registrar $router)
{
$router->group([
'prefix' => 'admin',
'prefix' => config('v2board.secure_path', config('v2board.frontend_admin_path', 'admin')),
'middleware' => 'admin'
], function ($router) {
// Config

View File

@ -11,5 +11,7 @@ window.settings = {
},
// 背景
background_url: '',
logo: ''
logo: '',
// 需与V2Board设置中的后台路径一致
secure_path: 'admin'
}

File diff suppressed because one or more lines are too long

View File

@ -20,7 +20,8 @@
},
version: '{{$version}}',
background_url: '{{$background_url}}',
logo: '{{$logo}}'
logo: '{{$logo}}',
secure_path: '{{$secure_path}}'
}
</script>
</head>

View File

@ -38,7 +38,8 @@ Route::get('/', function (Request $request) {
return view('theme::' . config('v2board.frontend_theme', 'v2board') . '.dashboard', $renderParams);
});
Route::get('/' . config('v2board.frontend_admin_path', 'admin'), function () {
//TODO:: 兼容
Route::get('/' . config('v2board.secure_path', config('v2board.frontend_admin_path', 'admin')), function () {
return view('admin', [
'title' => config('v2board.app_name', 'V2Board'),
'theme_sidebar' => config('v2board.frontend_theme_sidebar', 'light'),
@ -46,6 +47,7 @@ Route::get('/' . config('v2board.frontend_admin_path', 'admin'), function () {
'theme_color' => config('v2board.frontend_theme_color', 'default'),
'background_url' => config('v2board.frontend_background_url'),
'version' => config('app.version'),
'logo' => config('v2board.logo')
'logo' => config('v2board.logo'),
'secure_path' => config('v2board.secure_path', config('v2board.frontend_admin_path', 'admin'))
]);
});