🐛 Bug fixes in the publication site hosting
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
<p>Something went wrong...</p>
|
||||
<p class="text-sm opacity-80 mt-1">Powered by the Solar Network Pages</p>
|
||||
<div class="text-xs opacity-70 mt-1">
|
||||
<p>Path: <b>@Model.CurrentPath</b></p>
|
||||
<p>Path: <b>@(Model.OriginalPath ?? Model.CurrentPath)</b></p>
|
||||
<p>Site ID: <b>@(Model.Site?.Id.ToString() ?? "none")</b></p>
|
||||
@if (Model.ShowRequestId)
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@ using DysonNetwork.Shared.Models;
|
||||
using DysonNetwork.Zone.Publication;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using Microsoft.AspNetCore.Diagnostics;
|
||||
|
||||
namespace DysonNetwork.Zone.Pages;
|
||||
|
||||
@@ -19,6 +20,7 @@ public class ErrorModel : PageModel
|
||||
public SnPublicationSite? Site { get; set; }
|
||||
public string? SiteName { get; set; }
|
||||
public string? CurrentPath { get; set; }
|
||||
public string? OriginalPath { get; set; }
|
||||
|
||||
public void OnGet()
|
||||
{
|
||||
@@ -29,5 +31,8 @@ public class ErrorModel : PageModel
|
||||
|
||||
SiteName = Request.Headers["X-SiteName"].ToString();
|
||||
CurrentPath = Request.Path;
|
||||
|
||||
var statusCodeReExecuteFeature = HttpContext.Features.Get<IStatusCodeReExecuteFeature>();
|
||||
OriginalPath = statusCodeReExecuteFeature?.OriginalPath;
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ public class PublicationSiteMiddleware(RequestDelegate next)
|
||||
}
|
||||
|
||||
var site = await db.PublicationSites
|
||||
.FirstOrDefaultAsync(s => EF.Functions.ILike(s.Name, siteNameValue));
|
||||
.FirstOrDefaultAsync(s => EF.Functions.ILike(s.Slug, siteNameValue));
|
||||
if (site == null)
|
||||
{
|
||||
await next(context);
|
||||
@@ -42,7 +42,7 @@ public class PublicationSiteMiddleware(RequestDelegate next)
|
||||
await context.Response.WriteAsync(content.ToString());
|
||||
return;
|
||||
case PublicationPageType.Redirect
|
||||
when page.Config.TryGetValue("url", out var url) && url is JsonElement redirectUrl:
|
||||
when page.Config.TryGetValue("target", out var tgt) && tgt is JsonElement redirectUrl:
|
||||
context.Response.Redirect(redirectUrl.ToString());
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user