Move servers to LBPU.PL.Servers

This commit is contained in:
jvyden 2022-05-14 23:37:55 -04:00
parent 545b5a0709
commit b2ec7eae57
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
116 changed files with 173 additions and 162 deletions

View file

@ -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.Servers.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();
}
}