docs .
This commit is contained in:
@@ -15,6 +15,15 @@ namespace Dlhis.InfoCheck.Controllers;
|
||||
[Route("api/[controller]")]
|
||||
public class FaceController : ControllerBase
|
||||
{
|
||||
private readonly ILogger<FaceController> _logger;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
public FaceController(ILogger<FaceController> logger, IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_logger = logger;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 人脸质量检测
|
||||
/// </summary>
|
||||
@@ -24,6 +33,8 @@ public class FaceController : ControllerBase
|
||||
[HttpPost("detection")]
|
||||
public IEnumerable<string> FacialDetection(FaceDetectRequest request)
|
||||
{
|
||||
_logger.LogInformation("currentIP:{IP}", _httpContextAccessor.HttpContext.Connection.RemoteIpAddress);
|
||||
|
||||
var base64Bytes = Convert.FromBase64String(request.Base64);
|
||||
using var stream = new MemoryStream(base64Bytes);
|
||||
using var bitmap = SKBitmap.Decode(stream);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Kurisu.AspNetCore.Startup;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
using Microsoft.IdentityModel.Logging;
|
||||
|
||||
class Program
|
||||
@@ -16,4 +16,23 @@ public class Startup : DefaultStartup
|
||||
{
|
||||
IdentityModelEventSource.ShowPII = true;
|
||||
}
|
||||
|
||||
public override void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
base.ConfigureServices(services);
|
||||
services.AddHttpContextAccessor();
|
||||
services.Configure<ForwardedHeadersOptions>(options =>
|
||||
{
|
||||
options.ForwardedHeaders = ForwardedHeaders.All;
|
||||
|
||||
options.KnownNetworks.Clear();
|
||||
options.KnownProxies.Clear();
|
||||
});
|
||||
}
|
||||
|
||||
public override void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
app.UseForwardedHeaders();
|
||||
base.Configure(app, env);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user