2023-11-17 01:44:01 -05:00
|
|
|
<?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!
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2025-01-06 12:20:11 -05:00
|
|
|
|
2023-11-17 01:44:01 -05:00
|
|
|
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')
|
|
|
|
];
|
|
|
|
|
2025-01-06 12:20:11 -05:00
|
|
|
$theme = admin_setting('frontend_theme', 'Xboard');
|
|
|
|
|
|
|
|
if (!admin_setting("theme_{$theme}")) {
|
|
|
|
ThemeService::switchTheme($theme);
|
2023-11-17 01:44:01 -05:00
|
|
|
}
|
|
|
|
|
2025-01-06 12:20:11 -05:00
|
|
|
$renderParams['theme_config'] = (new ThemeService())->getConfig($theme);
|
|
|
|
return view('theme::' . $theme . '.dashboard', $renderParams);
|
2023-11-17 01:44:01 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
//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'))))
|
|
|
|
]);
|
|
|
|
});
|
2025-01-08 21:08:05 -05:00
|
|
|
|
|
|
|
Route::get('/' . (admin_setting('subscribe_path', 's')) . '/{token}', [\App\Http\Controllers\V1\Client\ClientController::class, 'subscribe'])
|
|
|
|
->middleware('client')
|
|
|
|
->name('client.subscribe');
|