fix warning

I had two identical LoggingMiddleware instances, and since one was unused, I deleted it.
This commit is contained in:
Kei-Luna
2026-04-20 15:21:24 +09:00
parent 0212f7e397
commit 8a8b0b9f5d
6 changed files with 8 additions and 42 deletions

View File

@@ -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;

View File

@@ -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);

View File

@@ -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}");
}
}
}