Added skin route for Minecraft Beta 1.7.3.
This commit is contained in:
parent
37c3764c41
commit
ef5535cb39
1 changed files with 23 additions and 0 deletions
|
@ -403,4 +403,27 @@ class SkinsRoutes extends RouteHandler {
|
||||||
'name' => $linkInfo->getName(),
|
'name' => $linkInfo->getName(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// quirky path and two of them to achieve equal string length with http://s3.amazonaws.com/MinecraftSkins/ for flashii.net and edgii.net
|
||||||
|
#[Route('GET', '/s3MinecraftSkins/:filename')]
|
||||||
|
#[Route('GET', '/s3s3MinecraftSkins/:filename')]
|
||||||
|
public function getS3MinecraftSkin($response, $request, string $name) {
|
||||||
|
$path = pathinfo($name);
|
||||||
|
if(empty($path) || empty($path['filename']) || empty($path['extension']) || $path['extension'] !== 'png')
|
||||||
|
return 404;
|
||||||
|
|
||||||
|
try {
|
||||||
|
$linkInfo = $this->accountLinks->getLink(name: $path['filename']);
|
||||||
|
} catch(RuntimeException $ex) {
|
||||||
|
return 404;
|
||||||
|
}
|
||||||
|
|
||||||
|
$skinInfo = $this->skins->getSkin($linkInfo);
|
||||||
|
if($skinInfo === null)
|
||||||
|
return 404;
|
||||||
|
|
||||||
|
$response->accelRedirect($this->getRemotePath($skinInfo->getHash(), false));
|
||||||
|
$response->setContentType('image/png');
|
||||||
|
$response->setFileName("{$path['filename']}.{$path['extension']}", false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue