Initial commit

This commit is contained in:
xboard
2023-11-17 14:44:01 +08:00
commit 65fe7682ff
460 changed files with 63554 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
<?php
/*
|--------------------------------------------------------------------------
| Broadcast Channels
|--------------------------------------------------------------------------
|
| Here you may register all of the event broadcasting channels that your
| application supports. The given channel authorization callbacks are
| used to check if an authenticated user can listen to the channel.
|
*/
Broadcast::channel('App.User.{id}', function ($user, $id) {
return (int)$user->id === (int)$id;
});
+18
View File
@@ -0,0 +1,18 @@
<?php
use Illuminate\Foundation\Inspiring;
/*
|--------------------------------------------------------------------------
| Console Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of your Closure based console
| commands. Each Closure is bound to a command instance allowing a
| simple approach to interacting with each command's IO methods.
|
*/
Artisan::command('inspire', function () {
$this->comment(Inspiring::quote());
})->describe('Display an inspiring quote');
Executable
+52
View File
@@ -0,0 +1,52 @@
<?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'))))
]);
});
+26
View File
@@ -0,0 +1,26 @@
<?php
use Illuminate\Http\Request;
use SwooleTW\Http\Websocket\Facades\Websocket;
/*
|--------------------------------------------------------------------------
| Websocket Routes
|--------------------------------------------------------------------------
|
| Here is where you can register websocket events for your application.
|
*/
Websocket::on('connect', function ($websocket, Request $request) {
// called while socket on connect
});
Websocket::on('disconnect', function ($websocket) {
// called while socket on disconnect
});
Websocket::on('example', function ($websocket, $data) {
$websocket->emit('message', $data);
});