blessing-skin-server/app/Http/routes.php

145 lines
6.3 KiB
PHP
Raw Normal View History

2016-07-21 22:01:57 +08:00
<?php
2016-08-28 10:05:21 +08:00
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
|
*/
Route::get('/', 'HomeController@index');
2016-08-20 23:06:57 +08:00
Route::get('/index.php', 'HomeController@index');
2016-07-21 22:01:57 +08:00
/**
* Auth
*/
Route::group(['prefix' => 'auth'], function()
{
2016-08-28 10:05:21 +08:00
Route::group(['middleware' => 'App\Http\Middleware\RedirectIfAuthenticated'], function()
2016-07-21 22:01:57 +08:00
{
Route::get ('/login', 'AuthController@login');
Route::get ('/register', 'AuthController@register');
Route::get ('/forgot', 'AuthController@forgot');
Route::get ('/reset', 'AuthController@reset');
});
2016-08-28 10:05:21 +08:00
Route::any('/logout', 'AuthController@logout');
Route::any('/captcha', 'AuthController@captcha');
2016-07-21 22:01:57 +08:00
2016-08-28 10:05:21 +08:00
Route::group(['middleware' => 'App\Http\Middleware\CheckPostMiddleware'], function()
2016-07-21 22:01:57 +08:00
{
Route::post('/login', 'AuthController@handleLogin');
Route::post('/register', 'AuthController@handleRegister');
Route::post('/forgot', 'AuthController@handleForgot');
});
Route::post('/reset', 'AuthController@handleReset');
});
/**
* User Center
*/
2016-08-28 10:05:21 +08:00
Route::group(['middleware' => 'App\Http\Middleware\CheckAuthenticated', 'prefix' => 'user'], function()
2016-07-21 22:01:57 +08:00
{
2016-08-28 10:05:21 +08:00
Route::any ('', 'UserController@index');
Route::any ('/sign', 'UserController@sign');
2016-07-21 22:01:57 +08:00
// Profile
Route::get ('/profile', 'UserController@profile');
Route::post('/profile', 'UserController@handleProfile');
Route::post('/profile/avatar', 'UserController@setAvatar');
Route::get ('/config', 'UserController@config');
// Player
2016-08-28 10:05:21 +08:00
Route::any ('/player', 'PlayerController@index');
2016-07-21 22:01:57 +08:00
Route::post('/player/add', 'PlayerController@add');
Route::post('/player/show', 'PlayerController@show');
Route::post('/player/preference', 'PlayerController@setPreference');
Route::post('/player/set', 'PlayerController@setTexture');
Route::post('/player/texture', 'PlayerController@changeTexture');
Route::post('/player/texture/clear', 'PlayerController@clearTexture');
Route::post('/player/rename', 'PlayerController@rename');
Route::post('/player/delete', 'PlayerController@delete');
// Closet
Route::get ('/closet', 'ClosetController@index');
Route::post('/closet/add', 'ClosetController@add');
Route::post('/closet/remove', 'ClosetController@remove');
});
/**
* Skin Library
*/
Route::group(['prefix' => 'skinlib'], function()
{
Route::get ('', 'SkinlibController@index');
2016-08-28 10:05:21 +08:00
Route::any ('/info/{tid}', 'SkinlibController@info');
Route::any ('/show', 'SkinlibController@show');
Route::any ('/search', 'SkinlibController@search');
2016-07-21 22:01:57 +08:00
2016-08-28 10:05:21 +08:00
Route::group(['middleware' => 'App\Http\Middleware\CheckAuthenticated'], function()
2016-07-21 22:01:57 +08:00
{
Route::get ('/upload', 'SkinlibController@upload');
Route::post('/upload', 'SkinlibController@handleUpload');
2016-07-24 15:56:23 +08:00
Route::post('/rename', 'SkinlibController@rename');
Route::post('/privacy/{tid}', 'SkinlibController@privacy');
2016-07-21 22:01:57 +08:00
Route::post('/delete', 'SkinlibController@delete');
});
});
2016-07-22 19:36:24 +08:00
/**
* Admin Panel
*/
2016-08-28 10:05:21 +08:00
Route::group(['middleware' => 'App\Http\Middleware\CheckAdminMiddleware', 'prefix' => 'admin'], function()
2016-07-22 19:36:24 +08:00
{
Route::get('/', 'AdminController@index');
2016-08-28 10:05:21 +08:00
Route::any('/customize', 'AdminController@customize');
Route::any('/score', 'AdminController@score');
Route::any('/options', 'AdminController@options');
Route::any('/update', 'AdminController@update');
2016-07-22 19:36:24 +08:00
2016-07-23 15:20:10 +08:00
Route::get('/users', 'AdminController@users');
Route::get('/players', 'AdminController@players');
// ajax handlers
Route::post('/users', 'AdminController@userAjaxHandler');
Route::post('/players', 'AdminController@playerAjaxHandler');
2016-07-22 19:36:24 +08:00
});
2016-07-21 22:01:57 +08:00
/**
* Resources
*/
2016-08-28 10:05:21 +08:00
Route::group(['middleware' => 'App\Http\Middleware\CheckPlayerExistMiddleware'], function()
2016-07-21 22:01:57 +08:00
{
2016-08-07 17:09:34 +08:00
// Fix for fucking chinese player names
if (Option::get('allow_chinese_playername')) {
// Json profile
Route::get('/{player_name}.json', 'TextureController@json')->where(['player_name' => '[^\\/]+?']);
Route::get('/{api}/{player_name}.json', 'TextureController@jsonWithApi')->where(['player_name' => '[^\\/]+?']);
// Legacy links
Route::get('/skin/{player_name}.png', 'TextureController@skin')->where(['player_name' => '[^\\/]+?']);
Route::get('/cape/{player_name}.png', 'TextureController@cape')->where(['player_name' => '[^\\/]+?']);
} else {
Route::get('/{player_name}.json', 'TextureController@json');
Route::get('/{api}/{player_name}.json', 'TextureController@jsonWithApi');
Route::get('/skin/{player_name}.png', 'TextureController@skin');
Route::get('/cape/{player_name}.png', 'TextureController@cape');
}
2016-07-21 22:01:57 +08:00
});
2016-08-28 20:33:35 +08:00
Route::get('/textures/{hash}', 'TextureController@texture');
Route::get('/{api}/textures/{hash}', 'TextureController@textureWithApi')->where('api', 'usm|csl');
2016-07-21 22:01:57 +08:00
Route::get('/avatar/{base64_email}.png', 'TextureController@avatar');
Route::get('/avatar/{size}/{base64_email}.png', 'TextureController@avatarWithSize')->where(['base64_email' => '[^\\/]+?']);
Route::get('/raw/{tid}.png', 'TextureController@raw');
2016-07-21 22:01:57 +08:00
Route::get('/preview/{tid}.png', 'TextureController@preview');
Route::get('/preview/{size}/{tid}.png', 'TextureController@previewWithSize');