fix support for chinese player names

This commit is contained in:
printempw 2016-08-07 17:09:34 +08:00
parent c0363f5915
commit b72252d109
2 changed files with 18 additions and 6 deletions

View File

@ -41,6 +41,8 @@ class TextureController extends BaseController
public function skin($player_name, $model = "")
{
$player_name = \Option::get('allow_chinese_playername') ? $GLOBALS['player_name'] : $player_name;
$player = new Player(0, $player_name);
if ($player->is_banned)
@ -55,6 +57,8 @@ class TextureController extends BaseController
public function cape($player_name)
{
$player_name = \Option::get('allow_chinese_playername') ? $GLOBALS['player_name'] : $player_name;
$player = new Player(0, $player_name);
if ($player->is_banned)

View File

@ -113,12 +113,20 @@ Route::group(['middleware' => 'App\Middlewares\CheckAdminMiddl
*/
Route::group(['middleware' => 'App\Middlewares\CheckPlayerExistMiddleware'], function()
{
// 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');
Route::get('/cape/{player_name}.png', 'TextureController@cape');
// 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');
}
});
Route::get('/avatar/{base64_email}.png', 'TextureController@avatar');