mirror of
https://github.com/JogmansonReal/Radicade.git
synced 2026-10-25 23:18:56 -07:00
Radicade Public Code
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace RadicadeServer.CDN;
|
||||
|
||||
[Route("studiocdn")]
|
||||
public class StudioAssetsCDN : Controller
|
||||
{
|
||||
[HttpGet("unityasset/{filename}"), HttpHead("unityasset/{filename}")]
|
||||
[HttpGet("roomunityasset/{filename}"), HttpHead("roomunityasset/{filename}")]
|
||||
public IActionResult Download(string filename)
|
||||
{
|
||||
if (string.IsNullOrEmpty(filename) || filename.Length > 80 ||
|
||||
filename.Any(c => !char.IsAsciiLetterOrDigit(c) && c != '-')) return BadRequest();
|
||||
var path = Path.GetFullPath(Path.Combine(DBConfig.CDNStorage, filename));
|
||||
if (!System.IO.File.Exists(path)) return NotFound();
|
||||
return PhysicalFile(path, "application/octet-stream", enableRangeProcessing: true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user