mirror of
https://github.com/cedar2025/Xboard.git
synced 2025-01-22 10:38:14 -05:00
53 lines
2.2 KiB
PHP
Executable File
53 lines
2.2 KiB
PHP
Executable File
<?php
|
|
|
|
use App\Services\ThemeService;
|
|
use Illuminate\Http\Request;
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| 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!
|
|
|
|
|
*/
|
|
|
|
Route::get('/', function (Request $request) {
|
|
if (admin_setting('app_url') && admin_setting('safe_mode_enable', 0)) {
|
|
if ($request->server('HTTP_HOST') !== parse_url(admin_setting('app_url'))['host']) {
|
|
abort(403);
|
|
}
|
|
}
|
|
$renderParams = [
|
|
'title' => admin_setting('app_name', 'Xboard'),
|
|
'theme' => admin_setting('frontend_theme', 'Xboard'),
|
|
'version' => config('app.version'),
|
|
'description' => admin_setting('app_description', 'Xboard is best'),
|
|
'logo' => admin_setting('logo')
|
|
];
|
|
|
|
if (!admin_setting("theme_{$renderParams['theme']}")) {
|
|
$themeService = new ThemeService($renderParams['theme']);
|
|
$themeService->init();
|
|
}
|
|
|
|
$renderParams['theme_config'] = admin_setting("theme_". admin_setting('frontend_theme', 'Xboard')) ?? config('theme.' . admin_setting('frontend_theme', 'Xboard'));
|
|
return view('theme::' . admin_setting('frontend_theme', 'Xboard') . '.dashboard', $renderParams);
|
|
});
|
|
|
|
//TODO:: 兼容
|
|
Route::get('/' . admin_setting('secure_path', admin_setting('frontend_admin_path', hash('crc32b', config('app.key')))), function () {
|
|
return view('admin', [
|
|
'title' => admin_setting('app_name', 'XBoard'),
|
|
'theme_sidebar' => admin_setting('frontend_theme_sidebar', 'light'),
|
|
'theme_header' => admin_setting('frontend_theme_header', 'dark'),
|
|
'theme_color' => admin_setting('frontend_theme_color', 'default'),
|
|
'background_url' => admin_setting('frontend_background_url'),
|
|
'version' => config('app.version'),
|
|
'logo' => admin_setting('logo'),
|
|
'secure_path' => admin_setting('secure_path', admin_setting('frontend_admin_path', hash('crc32b', config('app.key'))))
|
|
]);
|
|
});
|