[update] Use https

This commit is contained in:
acite
2025-08-25 22:10:11 +08:00
parent 052a2da270
commit 69509e4b87
5 changed files with 41 additions and 23 deletions

View File

@@ -90,5 +90,16 @@ public class VideoController(ILogger<VideoController> logger, ResourceService rs
return PhysicalFile(d, "video/mp4", enableRangeProcessing: true);
}
[HttpGet("{klass}/{id}/nv")]
public async Task<IActionResult> Nv(string klass, string id, string token)
{
var d = Helpers.SafePathCombine(VideoFolder, [klass, id, "video.a.mp4"]);
if (d == null) return StatusCode(403, new { message = "403 Denied" });
var r = await rs.Get(d, token, Ip);
if (!r) return StatusCode(403, new { message = "403 Denied" });
return PhysicalFile(d, "video/mp4", enableRangeProcessing: true);
}
private string Ip => HttpContext.Connection.RemoteIpAddress?.ToString() ?? "127.0.0.1";
}

View File

@@ -45,7 +45,7 @@ public class Program
app.MapOpenApi();
}
// app.UseHttpsRedirection();
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapStaticAssets();

View File

@@ -1,9 +0,0 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}