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); } } }