diff --git a/ProjectLighthouse/Controllers/ResourcesController.cs b/ProjectLighthouse/Controllers/ResourcesController.cs index 0abf1069..980d985f 100644 --- a/ProjectLighthouse/Controllers/ResourcesController.cs +++ b/ProjectLighthouse/Controllers/ResourcesController.cs @@ -39,8 +39,6 @@ public class ResourcesController : ControllerBase return this.Ok(LbpSerializer.StringElement("resources", resources)); } - [ResponseCache(Duration = 86400)] - [HttpGet("/gameAssets/{hash}")] [HttpGet("r/{hash}")] public IActionResult GetResource(string hash) { @@ -51,6 +49,17 @@ public class ResourcesController : ControllerBase return this.NotFound(); } + [ResponseCache(Duration = 86400)] + [HttpGet("/gameAssets/{hash}")] + public IActionResult GetWebResource(string hash) + { + string path = FileHelper.GetResourcePath(hash); + + if (FileHelper.ResourceExists(hash) && LbpFile.FromHash(hash)?.FileType == LbpFileType.Jpeg) return this.File(IOFile.OpenRead(path), "image/jpeg"); + + return this.NotFound(); + } + // TODO: check if this is a valid hash [HttpPost("upload/{hash}")] public async Task UploadResource(string hash)