mirror of
https://github.com/MikuLeaks/MikuSB.git
synced 2026-06-04 11:24:00 +00:00
fix warning
I had two identical LoggingMiddleware instances, and since one was unused, I deleted it.
This commit is contained in:
@@ -80,7 +80,7 @@ public class ProxyOptions
|
||||
{
|
||||
public bool Enabled { get; set; } = true;
|
||||
public int Port { get; set; } = 8888;
|
||||
public int ServerHttpPort { get; set; } = 8080;
|
||||
public int ServerHttpPort { get; set; } = 21500;
|
||||
public bool InstallRootCertificate { get; set; } = true;
|
||||
public bool ManageSystemProxy { get; set; } = true;
|
||||
public bool RestoreSystemProxyOnStop { get; set; } = true;
|
||||
|
||||
@@ -33,7 +33,7 @@ class IntDictionaryConverter : JsonConverter<Dictionary<int, int>>
|
||||
public override void WriteJson(JsonWriter writer, Dictionary<int, int>? value, JsonSerializer serializer)
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
foreach (var kv in value)
|
||||
foreach (var kv in value!)
|
||||
{
|
||||
writer.WritePropertyName(kv.Key.ToString());
|
||||
writer.WriteValue(kv.Value);
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
using MikuSB.Util;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace MikuSB.SdkServer.Utils;
|
||||
|
||||
public class RequestLoggingMiddleware(RequestDelegate next)
|
||||
{
|
||||
public async Task InvokeAsync(HttpContext context, Logger logger)
|
||||
{
|
||||
var request = context.Request;
|
||||
var method = request.Method;
|
||||
var path = request.Path + request.QueryString;
|
||||
|
||||
await next(context);
|
||||
|
||||
var statusCode = context.Response.StatusCode;
|
||||
|
||||
if (path.StartsWith("/report") || path.Contains("/log/") || path == "/alive")
|
||||
return;
|
||||
|
||||
if (statusCode == 200)
|
||||
{
|
||||
logger.Info($"{method} {path} => {statusCode}");
|
||||
}
|
||||
else if (statusCode == 404)
|
||||
{
|
||||
logger.Warn($"{method} {path} => {statusCode}");
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.Error($"{method} {path} => {statusCode}");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user