diff --git a/DysonNetwork.Zone/.gitignore b/DysonNetwork.Zone/.gitignore index 705ea43..ba7f8df 100644 --- a/DysonNetwork.Zone/.gitignore +++ b/DysonNetwork.Zone/.gitignore @@ -1,7 +1,7 @@ # dependencies (bun install) node_modules wwwroot/css/site.dist.css -wwwroot/SiteData +SiteData # output out diff --git a/DysonNetwork.Zone/DysonNetwork.Zone.csproj b/DysonNetwork.Zone/DysonNetwork.Zone.csproj index 0588264..4bb62e4 100644 --- a/DysonNetwork.Zone/DysonNetwork.Zone.csproj +++ b/DysonNetwork.Zone/DysonNetwork.Zone.csproj @@ -82,6 +82,7 @@ <_ContentIncludedByDefault Remove="wwwroot\lib\jquery-validation\dist\jquery.validate.js" /> <_ContentIncludedByDefault Remove="wwwroot\lib\jquery-validation\dist\jquery.validate.min.js" /> <_ContentIncludedByDefault Remove="wwwroot\lib\jquery-validation\LICENSE.md" /> + <_ContentIncludedByDefault Remove="wwwroot\SiteData\5755cb46-ae17-4b4e-9716-45b264e9851f\capture-the-flag.mp4" /> diff --git a/DysonNetwork.Zone/Pages/Index.cshtml.cs b/DysonNetwork.Zone/Pages/Index.cshtml.cs index 861f8c4..4720b28 100644 --- a/DysonNetwork.Zone/Pages/Index.cshtml.cs +++ b/DysonNetwork.Zone/Pages/Index.cshtml.cs @@ -47,19 +47,22 @@ public class IndexModel(AppDatabase db, PublicationSiteManager psm) : PageModel // If the site is enabled the self-managed mode, try lookup the files then if (Site.Mode == PublicationSiteMode.SelfManaged) { - // TODO: Fix the path contains a wwwroot var provider = new FileExtensionContentTypeProvider(); var hostedFilePath = psm.GetValidatedFullPath(Site.Id, CurrentPath); if (System.IO.File.Exists(hostedFilePath)) { if (!provider.TryGetContentType(hostedFilePath, out var mimeType)) mimeType = "text/html"; - return File(hostedFilePath, mimeType); + var fileStream = new FileStream(hostedFilePath, FileMode.Open, FileAccess.Read); + return new FileStreamResult(fileStream, mimeType); } var hostedNotFoundPath = psm.GetValidatedFullPath(Site.Id, "404.html"); if (System.IO.File.Exists(hostedNotFoundPath)) - return File(hostedNotFoundPath, "text/html"); + { + var fileStream = new FileStream(hostedNotFoundPath, FileMode.Open, FileAccess.Read); + return new FileStreamResult(fileStream, "text/html"); + } } return Page(); diff --git a/DysonNetwork.Zone/Publication/PublicationSiteManager.cs b/DysonNetwork.Zone/Publication/PublicationSiteManager.cs index 9fb34dc..fcf4b77 100644 --- a/DysonNetwork.Zone/Publication/PublicationSiteManager.cs +++ b/DysonNetwork.Zone/Publication/PublicationSiteManager.cs @@ -17,7 +17,7 @@ public class PublicationSiteManager( ) { private readonly string _basePath = Path.Combine( - hostEnvironment.WebRootPath, + hostEnvironment.ContentRootPath, configuration["Sites:BasePath"]!.TrimStart('/') );