From da4ee81c951455fb4714017629208ebb5ef94b29 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Fri, 11 Jul 2025 23:41:39 +0800 Subject: [PATCH] :bug: Bug fixes on swagger ui --- DysonNetwork.Sphere/Connection/ClientTypeMiddleware.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/DysonNetwork.Sphere/Connection/ClientTypeMiddleware.cs b/DysonNetwork.Sphere/Connection/ClientTypeMiddleware.cs index 8a305aa..447d9ac 100644 --- a/DysonNetwork.Sphere/Connection/ClientTypeMiddleware.cs +++ b/DysonNetwork.Sphere/Connection/ClientTypeMiddleware.cs @@ -31,7 +31,10 @@ public class ClientTypeMiddleware(RequestDelegate next) context.Items["IsWebPage"] = isWebPage; - if (!isWebPage && context.Request.Path != "/ws" && !context.Request.Path.StartsWithSegments("/api")) + var redirectWhiteList = new[] { "/ws", "/.well-known", "/swagger" }; + if(redirectWhiteList.Any(w => context.Request.Path.StartsWithSegments(w))) + await next(context); + else if (!isWebPage && !context.Request.Path.StartsWithSegments("/api")) context.Response.Redirect( $"/api{context.Request.Path.Value}{context.Request.QueryString.Value}", permanent: false