From 941bfe75f6339f2f0dac6c6980d5ab167d06e547 Mon Sep 17 00:00:00 2001 From: flashwave Date: Tue, 22 Aug 2023 23:54:15 +0000 Subject: [PATCH] Fixed texture URLs. --- public/index.php | 2 +- src/SkinsRoutes.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/public/index.php b/public/index.php index a03b5d3..83678e5 100644 --- a/public/index.php +++ b/public/index.php @@ -57,7 +57,7 @@ $router->setDefaultErrorHandler(function($response, $request, $code, $text) use (new RpcRoutes($users, $accountLinks, $authorisations, $verifications, $config['rpc_secret'], $config['clients_url']))->register($router); (new HomeRoutes(new Servers($db), $templating, $authInfo, $config['login_url']))->register($router); (new ClientsRoutes($templating, $accountLinks, $authorisations, $verifications, $csrfp, $authInfo))->register($router); -(new SkinsRoutes($templating, $accountLinks, new Skins($db), new Capes($db), $csrfp, $authInfo))->register($router); +(new SkinsRoutes($templating, $accountLinks, new Skins($db), new Capes($db), $csrfp, $authInfo, $config['skins_base_url']))->register($router); (new WhitelistRoutes(new Whitelist($db), $csrfp, $authInfo))->register($router); MojangInterop::registerRoutes($router); diff --git a/src/SkinsRoutes.php b/src/SkinsRoutes.php index 2efc0d1..da4e06f 100644 --- a/src/SkinsRoutes.php +++ b/src/SkinsRoutes.php @@ -23,7 +23,8 @@ class SkinsRoutes { private Skins $skins, private Capes $capes, private CSRFP $csrfp, - private object $authInfo + private object $authInfo, + private string $baseUrl ) { if(!is_dir(self::TEXTURES_PATH)) throw new RuntimeException('Textures directory does not exist.'); @@ -53,7 +54,7 @@ class SkinsRoutes { } public function getRemotePath(string $hash, bool $includeDomain): string { - return ($includeDomain ? 'https://mc.edgii.net' : '') . self::TEXTURES_DIR . '/' . $hash . '.png'; + return ($includeDomain ? $this->baseUrl : '') . self::TEXTURES_DIR . '/' . $hash . '.png'; } public function deleteLocalFileMaybe(string $hash): void {