Set page render mode

This commit is contained in:
Archangel
2025-10-10 14:52:59 +02:00
parent 3945869414
commit 5670e5a123
3 changed files with 19 additions and 4 deletions
@@ -6,14 +6,26 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<ImportMap />
<HeadOutlet />
<HeadOutlet @rendermode="PageRenderMode" />
</head>
<body>
<Routes/>
<Routes @rendermode="PageRenderMode" />
<script src="/_framework/blazor.web.js"></script>
</body>
</html>
@code {
[CascadingParameter]
private HttpContext HttpContext { get; set; } = default!;
private IComponentRenderMode? PageRenderMode
{
get
{
return HttpContext.AcceptsInteractiveRouting() ? InteractiveServer : null;
}
}
}
@@ -1,7 +1,7 @@
@using System.Reflection
@using SPTarkov.Server.Web.Components.Layout
<Router AppAssembly="@typeof(SPTWeb).Assembly">
<Router AppAssembly="@typeof(SPTWeb).Assembly" AdditionalAssemblies="SPTWeb.SptWebModsAssemblies">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(BaseMainLayout)" />
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
+4 -1
View File
@@ -1,4 +1,5 @@
using Microsoft.Extensions.FileProviders;
using System.Reflection;
using Microsoft.Extensions.FileProviders;
using MudBlazor.Services;
using SPTarkov.Server.Core.Models.Spt.Mod;
using SPTarkov.Server.Web.Components;
@@ -8,6 +9,7 @@ namespace SPTarkov.Server.Web;
public static class SPTWeb
{
internal static IEnumerable<SptMod> SptWebMods = [];
internal static List<Assembly> SptWebModsAssemblies = [];
public static void InitializeSptBlazor(this WebApplicationBuilder builder, IReadOnlyList<SptMod> sptMods)
{
@@ -39,6 +41,7 @@ public static class SPTWeb
foreach (var assembly in mod.Assemblies)
{
razorBuilder.AddAdditionalAssemblies(assembly);
SptWebModsAssemblies.Add(assembly);
}
var modAssembly = mod.ModMetadata.GetType().Assembly;