v2board/routes/web.php

52 lines
2.0 KiB
PHP
Raw Normal View History

2019-10-29 15:33:36 +08:00
<?php
2020-01-11 13:36:52 +08:00
2022-05-19 02:34:25 +08:00
use App\Services\ThemeService;
2019-12-05 02:37:32 +08:00
use Illuminate\Http\Request;
2020-01-11 13:36:52 +08:00
2019-10-29 15:33:36 +08:00
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
2019-12-05 02:37:32 +08:00
Route::get('/', function (Request $request) {
2022-05-15 01:12:25 +08:00
if (config('v2board.app_url') && config('v2board.safe_mode_enable', 0)) {
if ($request->server('HTTP_HOST') !== parse_url(config('v2board.app_url'))['host']) {
abort(403);
2019-12-16 13:35:59 +08:00
}
2019-12-05 02:37:32 +08:00
}
2022-05-15 01:12:25 +08:00
$renderParams = [
'title' => config('v2board.app_name', 'V2Board'),
'theme' => config('v2board.frontend_theme', 'v2board'),
'theme_path' => '/theme/' . config('v2board.frontend_theme', 'v2board') . '/assets/',
'version' => config('app.version'),
2022-05-15 01:46:35 +08:00
'description' => config('v2board.app_description', 'V2Board is best'),
'logo' => config('v2board.logo')
2022-05-15 01:12:25 +08:00
];
2022-05-19 02:34:25 +08:00
if (!config("theme.{$renderParams['theme']}")) {
$themeService = new ThemeService($renderParams['theme']);
$themeService->init();
}
2022-05-15 01:12:25 +08:00
$renderParams['theme_config'] = config('theme.' . config('v2board.frontend_theme', 'v2board'));
return view('theme::' . config('v2board.frontend_theme', 'v2board') . '.dashboard', $renderParams);
2019-10-29 15:33:36 +08:00
});
2020-02-13 16:22:30 +08:00
2020-07-17 20:01:28 +08:00
Route::get('/' . config('v2board.frontend_admin_path', 'admin'), function () {
2020-02-13 16:22:30 +08:00
return view('admin', [
'title' => config('v2board.app_name', 'V2Board'),
2020-02-17 03:35:03 +08:00
'theme_sidebar' => config('v2board.frontend_theme_sidebar', 'light'),
'theme_header' => config('v2board.frontend_theme_header', 'dark'),
'theme_color' => config('v2board.frontend_theme_color', 'default'),
2022-05-15 01:46:35 +08:00
'background_url' => config('v2board.frontend_background_url'),
'version' => config('app.version'),
'logo' => config('v2board.logo')
2020-02-13 16:22:30 +08:00
]);
});