mirror of
https://github.com/JogmansonReal/Radicade.git
synced 2026-10-25 23:18:56 -07:00
28 lines
663 B
C#
28 lines
663 B
C#
using Microsoft.AspNetCore.Mvc;
|
|
using SixLabors.ImageSharp;
|
|
|
|
namespace RadicadeServer.CDN
|
|
{
|
|
[Route("cdn/invention/")]
|
|
public class InventionCDN : Controller
|
|
{
|
|
|
|
|
|
[HttpGet]
|
|
public IActionResult Index() => Ok(new { status = "ok" });
|
|
|
|
[HttpGet("{datablob}")]
|
|
public IActionResult GetDataBlob(string datablob)
|
|
{
|
|
if (!CdnStorageNames.IsServable(datablob)) return BadRequest();
|
|
|
|
var name = CdnStorageNames.Resolve(datablob);
|
|
if (name == null) return NotFound();
|
|
|
|
CdnCaching.Apply(this, CdnCaching.ForBlob(name));
|
|
|
|
return PhysicalFile(Path.Join(DBConfig.CDNStorage, name), "application/octet-stream", enableRangeProcessing: true);
|
|
}
|
|
}
|
|
}
|