redirect /api/textures request to real location
This commit is contained in:
parent
b72252d109
commit
2934273086
@ -118,6 +118,11 @@ class TextureController extends BaseController
|
||||
|
||||
}
|
||||
|
||||
public static function redirectTextures($api, $hash)
|
||||
{
|
||||
Http::redirectPermanently('../../textures/'.$hash);
|
||||
}
|
||||
|
||||
private function checkCache($player_name)
|
||||
{
|
||||
// Cache friendly
|
||||
|
@ -7,8 +7,10 @@ class Http
|
||||
/**
|
||||
* HTTP redirect
|
||||
*
|
||||
* @param string $url
|
||||
* @return null
|
||||
* @param string $url
|
||||
* @param string $msg Write message to session
|
||||
* @param boolean $use_js Use javascript to redirect
|
||||
* @return void
|
||||
*/
|
||||
public static function redirect($url, $msg = "", $use_js = false)
|
||||
{
|
||||
@ -21,6 +23,19 @@ class Http
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 301 Moved Permanently
|
||||
*
|
||||
* @param string $url
|
||||
* @return void
|
||||
*/
|
||||
public static function redirectPermanently($url)
|
||||
{
|
||||
http_response_code(301);
|
||||
header('Location: '.$url);
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function getRealIP()
|
||||
{
|
||||
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
|
||||
|
@ -129,6 +129,8 @@ Route::group(['middleware' => 'App\Middlewares\CheckPlayerExis
|
||||
}
|
||||
});
|
||||
|
||||
Route::get('/{api}/textures/{hash}', 'TextureController@redirectTextures');
|
||||
|
||||
Route::get('/avatar/{base64_email}.png', 'TextureController@avatar');
|
||||
Route::get('/avatar/{size}/{base64_email}.png', 'TextureController@avatarWithSize')->where(['base64_email' => '[^\\/]+?']);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user