diff --git a/ProjectLighthouse.GameAPI/Controllers/Resources/ResourcesController.cs b/ProjectLighthouse.GameAPI/Controllers/Resources/ResourcesController.cs index c50b5885..dd7edea7 100644 --- a/ProjectLighthouse.GameAPI/Controllers/Resources/ResourcesController.cs +++ b/ProjectLighthouse.GameAPI/Controllers/Resources/ResourcesController.cs @@ -59,25 +59,6 @@ public class ResourcesController : ControllerBase return this.NotFound(); } - [ResponseCache(Duration = 86400)] - [HttpGet("/gameAssets/{hash}")] - public IActionResult GetGameImage(string hash) - { - string path = Path.Combine("png", $"{hash}.png"); - - if (IOFile.Exists(path)) - { - return this.File(IOFile.OpenRead(path), "image/png"); - } - - LbpFile? file = LbpFile.FromHash(hash); - if (file != null && ImageHelper.LbpFileToPNG(file)) - { - return this.File(IOFile.OpenRead(path), "image/png"); - } - return this.NotFound(); - } - // TODO: check if this is a valid hash [HttpPost("upload/{hash}/unattributed")] [HttpPost("upload/{hash}")] diff --git a/ProjectLighthouse.Website/Controllers/ResourcesController.cs b/ProjectLighthouse.Website/Controllers/ResourcesController.cs new file mode 100644 index 00000000..17d222d4 --- /dev/null +++ b/ProjectLighthouse.Website/Controllers/ResourcesController.cs @@ -0,0 +1,29 @@ +using LBPUnion.ProjectLighthouse.Helpers; +using LBPUnion.ProjectLighthouse.Types.Files; +using Microsoft.AspNetCore.Mvc; +using IOFile = System.IO.File; + +namespace LBPUnion.ProjectLighthouse.Website.Controllers; + +[ApiController] +public class ResourcesController : ControllerBase +{ + [ResponseCache(Duration = 86400)] + [HttpGet("/gameAssets/{hash}")] + public IActionResult GetGameImage(string hash) + { + string path = Path.Combine("png", $"{hash}.png"); + + if (IOFile.Exists(path)) + { + return this.File(IOFile.OpenRead(path), "image/png"); + } + + LbpFile? file = LbpFile.FromHash(hash); + if (file != null && ImageHelper.LbpFileToPNG(file)) + { + return this.File(IOFile.OpenRead(path), "image/png"); + } + return this.NotFound(); + } +} \ No newline at end of file