From 856afcf3bf8d5eb43c58cf0487fae418c23c8ffd Mon Sep 17 00:00:00 2001 From: sbwalker Date: Sat, 10 Feb 2024 11:46:07 -0500 Subject: [PATCH] updates to make identical to POC - still not working --- Oqtane.Client/UI/ModuleInstance.razor | 2 +- Oqtane.Server/Components/_Imports.razor | 29 +++++++++++++++++++++++++ Oqtane.Server/Startup.cs | 15 ++++++++----- 3 files changed, 40 insertions(+), 6 deletions(-) create mode 100644 Oqtane.Server/Components/_Imports.razor diff --git a/Oqtane.Client/UI/ModuleInstance.razor b/Oqtane.Client/UI/ModuleInstance.razor index 28118899..dca42083 100644 --- a/Oqtane.Client/UI/ModuleInstance.razor +++ b/Oqtane.Client/UI/ModuleInstance.razor @@ -9,7 +9,7 @@ else {
Render Mode: @ModuleState.RenderMode

- + } @code { diff --git a/Oqtane.Server/Components/_Imports.razor b/Oqtane.Server/Components/_Imports.razor new file mode 100644 index 00000000..73af8f3a --- /dev/null +++ b/Oqtane.Server/Components/_Imports.razor @@ -0,0 +1,29 @@ +@using System +@using System.Linq +@using System.Collections.Generic +@using System.Net.Http +@using System.Net.Http.Json + +@using Microsoft.AspNetCore.Components.Authorization +@using Microsoft.AspNetCore.Components.Forms +@using Microsoft.AspNetCore.Components.Routing +@using Microsoft.AspNetCore.Components.Web +@using Microsoft.AspNetCore.Components.Web.Virtualization +@using Microsoft.Extensions.Localization +@using Microsoft.JSInterop +@using static Microsoft.AspNetCore.Components.Web.RenderMode + +@using Oqtane.Client +@using Oqtane.Models +@using Oqtane.Modules +@using Oqtane.Modules.Controls +@using Oqtane.Providers +@using Oqtane.Security +@using Oqtane.Services +@using Oqtane.Shared +@using Oqtane.Themes +@using Oqtane.Themes.Controls +@using Oqtane.UI +@using Oqtane.Enums +@using Oqtane.Installer +@using Oqtane.Interfaces diff --git a/Oqtane.Server/Startup.cs b/Oqtane.Server/Startup.cs index d162e62c..87f87a18 100644 --- a/Oqtane.Server/Startup.cs +++ b/Oqtane.Server/Startup.cs @@ -151,7 +151,7 @@ namespace Oqtane { if (_env.IsDevelopment()) { - options.DetailedErrors = false; + options.DetailedErrors = true; } }).AddHubOptions(options => { @@ -178,13 +178,13 @@ namespace Oqtane if (env.IsDevelopment()) { - app.UseDeveloperExceptionPage(); app.UseWebAssemblyDebugging(); app.UseForwardedHeaders(); } else { app.UseForwardedHeaders(); + app.UseExceptionHandler("/Error", createScopeForErrors: true); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } @@ -210,18 +210,23 @@ namespace Oqtane app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/" + Constants.Version + "/swagger.json", Constants.PackageId + " " + Constants.Version); }); } + app.UseEndpoints(endpoints => + { + endpoints.MapControllers(); + endpoints.MapRazorPages(); + }); + app.UseEndpoints(endpoints => { endpoints.MapRazorComponents() .AddInteractiveServerRenderMode() - .AddInteractiveWebAssemblyRenderMode(); + .AddInteractiveWebAssemblyRenderMode() + .AddAdditionalAssemblies(typeof(SiteRouter).Assembly); }); // simulate the fallback routing approach of traditional Blazor - allowing the custom SiteRouter to handle all routing concerns app.UseEndpoints(endpoints => { - endpoints.MapControllers(); - endpoints.MapRazorPages(); endpoints.MapFallback(); });