From 275f3479eada1a6b4dac0b3b4406e1b1c1a322ad Mon Sep 17 00:00:00 2001 From: ErickSkrauch Date: Sat, 31 Jan 2015 17:58:45 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20=D0=B7=D0=B0=D0=BF=D1=80=D0=BE=D1=81=20/textures/{nick?= =?UTF-8?q?name}?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.php | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/app.php b/app.php index cf8c3eb..02caf24 100644 --- a/app.php +++ b/app.php @@ -34,6 +34,39 @@ $app->get('/cloaks/{nickname}', function ($nickname) use ($app) { return $app->response->redirect('http://skins.minecraft.net/MinecraftCloaks/'.$nickname.'.png'); }); +$app->get("/textrures/{nickname}", function($nickname) use ($app) { + $skin = Skins::findFirst(array(array( + "nickname" => $nickname + ))); + + if ($skin && $skin->skinId != 0) { + $url = $skin->url; + $hash = $skin->hash; + } else { + $url = "http://skins.minecraft.net/MinecraftSkins/".$nickname.".png"; + $hash = md5("non-ely-".mktime(date("H"), 0, 0)."-".$nickname); + } + + $textures = array( + 'SKIN' => array( + 'url' => $url, + 'hash' => $hash, + 'metadata' => array( + 'model' => ($skin && $skin->isSlim) ? "slim" : "default" + ) + ), + 'CAPE' => array( + 'url' => '', + 'hash' => '' + ) + ); + + return $app->response->setJsonContent($textures); +}); + +/** + * Должно проксироваться средствами nginx, но мало-ли + */ $app->get("/minecraft.php", function() use ($app) { $nickname = $app->request->get("name", "string"); $type = $app->request->get("type", "string");