mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 14:11:10 +00:00
Adds localization to Lumina.Presentation.Web project
This commit is contained in:
1 parent
771fa74991
commit
2c31fd8714
65 files changed
+1111
-319
No files matched your search
+5
-5
@@ -7,8 +7,8 @@ using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http.Json;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using Serilog;
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
@@ -49,13 +49,13 @@ public static class PresentationApiLayerServices
|
||||
rateLimiterOptions.RejectionStatusCode = StatusCodes.Status429TooManyRequests;
|
||||
rateLimiterOptions.OnRejected = async (onRejectedContext, cancellationToken) =>
|
||||
{
|
||||
ILogger logger = onRejectedContext.HttpContext.RequestServices.GetRequiredService<ILogger>();
|
||||
ILogger<Program> logger = onRejectedContext.HttpContext.RequestServices.GetRequiredService<ILogger<Program>>();
|
||||
|
||||
string clientIp = onRejectedContext.HttpContext.Request.Headers["X-Forwarded-For"]
|
||||
.FirstOrDefault()?.Split(',')[0].Trim()
|
||||
?? onRejectedContext.HttpContext.Connection.RemoteIpAddress?.ToString()
|
||||
?? "unknown";
|
||||
Log.Warning(
|
||||
logger.LogWarning(
|
||||
"Rate limit exceeded. IP: {IpAddress}, Route: {Route}, Lease Acquired: {IsAcquired}",
|
||||
clientIp,
|
||||
onRejectedContext.HttpContext.Request.Path,
|
||||
@@ -76,9 +76,9 @@ public static class PresentationApiLayerServices
|
||||
var problem = new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc7231#section-6.5.29",
|
||||
title = "TooManyRequests", // TODO: implement translation?
|
||||
title = "TooManyRequests",
|
||||
status = StatusCodes.Status429TooManyRequests,
|
||||
detail = "Too many attempts. Please try again later.",
|
||||
detail = "TooManyRequests",
|
||||
retryAfter = "900"
|
||||
};
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.FileProviders;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Scalar.AspNetCore;
|
||||
using Serilog;
|
||||
using System;
|
||||
@@ -84,8 +85,8 @@ public class Program
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ILogger logger = services.GetRequiredService<ILogger>();
|
||||
logger.Fatal(ex, "Failed to run database migrations");
|
||||
Microsoft.Extensions.Logging.ILogger logger = services.GetRequiredService<Microsoft.Extensions.Logging.ILogger>();
|
||||
logger.LogCritical(ex, "Failed to run database migrations");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user