blessing-skin-server/routes/web.php

212 lines
9.5 KiB
PHP
Raw Normal View History

2016-07-21 22:01:57 +08:00
<?php
2016-08-28 10:05:21 +08:00
2019-04-25 13:01:39 +08:00
use App\Http\Middleware;
2016-07-21 22:01:57 +08:00
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
2016-08-28 10:05:21 +08:00
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
2016-07-21 22:01:57 +08:00
|
*/
2020-01-13 08:37:57 +08:00
Route::get('', 'HomeController@index');
2020-01-13 08:37:57 +08:00
Route::prefix('auth')->name('auth.')->group(function () {
Route::middleware('guest')->group(function () {
Route::get('login', 'AuthController@login')->name('login');
Route::post('login', 'AuthController@handleLogin')->name('login');
2020-01-13 08:37:57 +08:00
Route::get('register', 'AuthController@register')->name('register');
Route::post('register', 'AuthController@handleRegister')->name('register');
2016-07-21 22:01:57 +08:00
2020-01-13 08:37:57 +08:00
Route::get('forgot', 'AuthController@forgot')->name('forgot');
Route::post('forgot', 'AuthController@handleForgot')->name('forgot');
2016-07-21 22:01:57 +08:00
Route::get('reset/{uid}', 'AuthController@reset')->name('reset');
Route::post('reset/{uid}', 'AuthController@handleReset')->name('reset');
2016-07-21 22:01:57 +08:00
2020-01-13 08:37:57 +08:00
Route::get('login/{driver}', 'AuthController@oauthLogin');
Route::get('login/{driver}/callback', 'AuthController@oauthCallback');
2018-08-17 12:32:44 +08:00
});
2016-07-21 22:01:57 +08:00
2020-01-13 08:37:57 +08:00
Route::post('logout', 'AuthController@logout')->name('logout')->middleware('authorize');
Route::any('captcha', 'AuthController@captcha');
2019-04-25 23:24:24 +08:00
2020-01-13 08:37:57 +08:00
Route::middleware(['authorize', Middleware\EnsureEmailFilled::class])
->name('bind')
->group(function () {
Route::view('bind', 'auth.bind');
Route::post('bind', 'AuthController@fillEmail');
});
2016-07-21 22:01:57 +08:00
Route::get('verify/{uid}', 'AuthController@verify')->name('verify');
2016-07-21 22:01:57 +08:00
});
2020-01-13 08:37:57 +08:00
Route::prefix('user')
->name('user.')
->middleware(['authorize', Middleware\RequireBindPlayer::class])
->group(function () {
Route::get('', 'UserController@index')->name('home');
2020-05-08 23:16:13 +08:00
Route::get('notifications/{id}', 'NotificationsController@read')->name('notification');
2020-01-13 08:37:57 +08:00
Route::get('score-info', 'UserController@scoreInfo')->name('score');
Route::post('sign', 'UserController@sign')->name('sign');
2020-01-21 11:07:20 +08:00
Route::get('reports', 'ReportController@track');
2020-01-13 08:37:57 +08:00
Route::prefix('profile')->group(function () {
Route::get('', 'UserController@profile')->name('profile');
Route::post('', 'UserController@handleProfile')->name('profile');
Route::post('avatar', 'UserController@setAvatar')->name('profile.avatar');
});
Route::post('email-verification', 'UserController@sendVerificationEmail');
Route::prefix('player')
->name('player.')
->middleware('verified')
->group(function () {
Route::get('', 'PlayerController@index')->name('page');
2020-05-09 10:11:07 +08:00
Route::get('list', 'PlayerController@list')->name('list');
2020-01-13 08:37:57 +08:00
Route::post('add', 'PlayerController@add')->name('add');
Route::post('set/{pid}', 'PlayerController@setTexture')->name('set');
Route::post('texture/clear/{pid}', 'PlayerController@clearTexture')->name('clear');
Route::post('rename/{pid}', 'PlayerController@rename')->name('rename');
Route::post('delete/{pid}', 'PlayerController@delete')->name('delete');
Route::view('bind', 'user.bind')->name('bind');
Route::post('bind', 'PlayerController@bind')->name('bind');
});
Route::prefix('closet')->name('closet.')->group(function () {
Route::get('', 'ClosetController@index')->name('page');
Route::get('list', 'ClosetController@getClosetData')->name('list');
2020-03-24 18:05:46 +08:00
Route::get('ids', 'ClosetController@allIds')->name('ids');
2020-01-13 08:37:57 +08:00
Route::post('add', 'ClosetController@add')->name('add');
Route::post('remove/{tid}', 'ClosetController@remove')->name('remove');
Route::post('rename/{tid}', 'ClosetController@rename')->name('rename');
});
// OAuth2 Management
Route::view('oauth/manage', 'user.oauth')->middleware('verified');
2019-09-08 18:57:19 +08:00
});
2020-01-13 08:37:57 +08:00
Route::prefix('skinlib')->name('skinlib.')->group(function () {
Route::view('', 'skinlib.index')->name('home');
2020-03-24 18:05:46 +08:00
Route::get('info/{tid}', 'SkinlibController@info')->name('info');
Route::get('show/{tid}', 'SkinlibController@show')->name('show');
Route::get('list', 'SkinlibController@library')->name('list');
2020-01-13 08:37:57 +08:00
Route::middleware(['authorize', 'verified'])->group(function () {
Route::prefix('upload')->name('upload')->group(function () {
Route::get('', 'SkinlibController@upload');
Route::post('', 'SkinlibController@handleUpload');
});
Route::post('model', 'SkinlibController@model');
Route::post('rename', 'SkinlibController@rename');
Route::post('privacy', 'SkinlibController@privacy');
Route::post('delete', 'SkinlibController@delete');
Route::post('report', 'ReportController@submit');
2016-12-17 19:52:59 +08:00
});
2020-01-13 08:37:57 +08:00
});
2016-12-17 19:52:59 +08:00
2020-01-13 08:37:57 +08:00
Route::prefix('admin')
->name('admin.')
2020-01-13 09:25:07 +08:00
->middleware(['authorize', 'role:admin'])
2020-01-13 08:37:57 +08:00
->group(function () {
Route::get('', 'AdminController@index');
Route::get('chart', 'AdminController@chartData');
2020-05-08 23:16:13 +08:00
Route::post('notifications/send', 'NotificationsController@send');
2020-01-13 08:37:57 +08:00
Route::any('customize', 'AdminController@customize');
Route::any('score', 'AdminController@score');
Route::any('options', 'AdminController@options');
Route::any('resource', 'AdminController@resource');
Route::get('status', 'AdminController@status');
Route::prefix('users')->name('users.')->group(function () {
2020-01-13 08:37:57 +08:00
Route::view('', 'admin.users');
Route::get('list', 'UsersManagementController@list')->name('list');
Route::prefix('{user}')->group(function () {
Route::put('email', 'UsersManagementController@email')->name('email');
Route::put('verification', 'UsersManagementController@verification')->name('verification');
Route::put('nickname', 'UsersManagementController@nickname')->name('nickname');
Route::put('password', 'UsersManagementController@password')->name('password');
Route::put('score', 'UsersManagementController@score')->name('score');
Route::put('permission', 'UsersManagementController@permission')->name('permission');
Route::delete('', 'UsersManagementController@delete')->name('delete');
});
2020-01-13 08:37:57 +08:00
});
2020-05-10 23:34:04 +08:00
Route::prefix('players')->name('players.')->group(function () {
Route::view('', 'admin.players');
Route::get('list', 'PlayersManagementController@list')->name('list');
2020-05-10 23:34:04 +08:00
Route::prefix('{player}')->group(function () {
Route::put('name', 'PlayersManagementController@name')->name('name');
Route::put('owner', 'PlayersManagementController@owner')->name('owner');
Route::put('textures', 'PlayersManagementController@texture')->name('texture');
Route::delete('', 'PlayersManagementController@delete')->name('delete');
});
});
2020-01-13 08:37:57 +08:00
2020-03-21 17:30:44 +08:00
Route::prefix('closet')->group(function () {
Route::post('{uid}', 'ClosetManagementController@add');
Route::delete('{uid}', 'ClosetManagementController@remove');
});
2020-01-13 08:37:57 +08:00
Route::prefix('reports')->group(function () {
Route::view('', 'admin.reports');
Route::post('', 'ReportController@review');
Route::any('list', 'ReportController@manage');
});
Route::prefix('i18n')->group(function () {
Route::view('', 'admin.i18n');
Route::get('list', 'TranslationsController@list');
Route::post('', 'TranslationsController@create');
Route::put('', 'TranslationsController@update');
Route::delete('', 'TranslationsController@delete');
});
Route::prefix('plugins')->group(function () {
Route::get('data', 'PluginController@getPluginData');
Route::view('manage', 'admin.plugins');
Route::post('manage', 'PluginController@manage');
Route::any('config/{name}', 'PluginController@config');
Route::get('readme/{name}', 'PluginController@readme');
Route::middleware('role:super-admin')->group(function () {
Route::post('upload', 'PluginController@upload');
Route::post('wget', 'PluginController@wget');
});
2020-01-13 08:37:57 +08:00
Route::prefix('market')->group(function () {
Route::view('', 'admin.market');
Route::get('list', 'MarketController@marketData');
Route::post('download', 'MarketController@download');
});
});
2020-01-13 09:25:07 +08:00
Route::prefix('update')->middleware('role:super-admin')->group(function () {
2020-01-13 08:37:57 +08:00
Route::get('', 'UpdateController@showUpdatePage');
Route::post('download', 'UpdateController@download');
});
2016-12-17 19:52:59 +08:00
});
2019-09-06 23:53:47 +08:00
2020-01-13 08:37:57 +08:00
Route::prefix('setup')->group(function () {
Route::middleware('setup')->group(function () {
Route::view('', 'setup.wizard.welcome');
Route::any('database', 'SetupController@database');
Route::view('info', 'setup.wizard.info');
Route::post('finish', 'SetupController@finish');
2019-09-06 23:53:47 +08:00
});
2020-01-13 08:37:57 +08:00
Route::middleware('authorize')->group(function () {
Route::view('update', 'setup.updates.welcome')->middleware('setup');
Route::any('exec-update', 'UpdateController@update')->middleware('setup');
2019-09-06 23:53:47 +08:00
});
});