From 2b56c6f1e513a16226d35426a268c663746712a4 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sat, 22 Nov 2025 15:49:29 +0800 Subject: [PATCH] :sparkles: Static site hosting support access directory as index.html --- .../Publication/PublicationSiteMiddleware.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/DysonNetwork.Zone/Publication/PublicationSiteMiddleware.cs b/DysonNetwork.Zone/Publication/PublicationSiteMiddleware.cs index 6d29065..a288190 100644 --- a/DysonNetwork.Zone/Publication/PublicationSiteMiddleware.cs +++ b/DysonNetwork.Zone/Publication/PublicationSiteMiddleware.cs @@ -63,6 +63,17 @@ public class PublicationSiteMiddleware(RequestDelegate next) return; } + if (Directory.Exists(hostedFilePath)) + { + var indexPath = Path.Combine(hostedFilePath, "index.html"); + if (File.Exists(indexPath)) + { + context.Response.ContentType = "text/html"; + await context.Response.SendFileAsync(indexPath); + return; + } + } + var hostedNotFoundPath = psm.GetValidatedFullPath(site.Id, "404.html"); if (File.Exists(hostedNotFoundPath)) {