mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-06 02:32:28 +00:00
Move servers to LBPU.PL.Servers
This commit is contained in:
parent
545b5a0709
commit
b2ec7eae57
116 changed files with 173 additions and 162 deletions
|
@ -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();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue