diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index da74b91..0bfc8aa 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -19,7 +19,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x - name: Restore dependencies run: dotnet restore - name: Build diff --git a/App.razor b/App.razor index 12bf66b..f329282 100644 --- a/App.razor +++ b/App.razor @@ -1,18 +1,42 @@ - - - - - - - - Authorizing... - - - - - Not found - PartyGameTime - -

Sorry, there's nothing at this address.

-
-
-
+@inject IHostEnvironment Env + + + + + + + + + + + + + + + + + + + + +
+ @if (Env.IsDevelopment()) + { + + An unhandled exception has occurred. See browser dev tools for details. + + } + else + { + + An error has occurred. This app may no longer respond until reloaded. + + } + Reload + 🗙 +
+ + + + + \ No newline at end of file diff --git a/Core/Auth/BlazorCookieLoginMiddleware.cs b/Core/Auth/BlazorCookieLoginMiddleware.cs index 0f6bab9..ecccd9d 100644 --- a/Core/Auth/BlazorCookieLoginMiddleware.cs +++ b/Core/Auth/BlazorCookieLoginMiddleware.cs @@ -54,6 +54,10 @@ public async Task Invoke(HttpContext context, SignInManager signInMgr) await signInMgr.SignOutAsync(); context.Response.Redirect("/"); } + else if (context.Request.Path == "/Account/Login") // Fix for dotnet 8 + { + context.Response.Redirect("/auth/login"); + } else { await _next.Invoke(context); diff --git a/Pages/_Host.cshtml b/Pages/_Host.cshtml deleted file mode 100644 index cfd6ff0..0000000 --- a/Pages/_Host.cshtml +++ /dev/null @@ -1,39 +0,0 @@ -@page "/" -@using Microsoft.AspNetCore.Components.Web -@namespace PartyGameTime.Pages -@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers - - - - - - - - - - - - - - - - - - - - -
- - An error has occurred. This application may no longer respond until reloaded. - - - An unhandled exception has occurred. See browser dev tools for details. - - Reload - 🗙 -
- - - - - diff --git a/PartyGameTime.csproj b/PartyGameTime.csproj index 87003a0..083e010 100644 --- a/PartyGameTime.csproj +++ b/PartyGameTime.csproj @@ -1,24 +1,24 @@ - net7.0 + net8.0 enable enable - - - - - - - + + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + diff --git a/Program.cs b/Program.cs index 951bbe3..d1ecaea 100644 --- a/Program.cs +++ b/Program.cs @@ -11,13 +11,14 @@ using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using PartyGameTime.Core.Auth; using PartyGameTime.Core.Services.Notifications; +using PartyGameTime; var builder = WebApplication.CreateBuilder(args); // Add services to the container. builder.Services.AddRazorPages(); -builder.Services.AddServerSideBlazor(); +builder.Services.AddRazorComponents().AddInteractiveServerComponents(); builder.Services.AddMudServices(); builder.Services.AddSingleton(); @@ -110,7 +111,7 @@ app.UseMiddleware(); // Authentication end -app.MapBlazorHub(); -app.MapFallbackToPage("/_Host"); - +app.MapRazorComponents() + .AddInteractiveServerRenderMode(); +app.UseAntiforgery(); app.Run(); diff --git a/Routes.razor b/Routes.razor new file mode 100644 index 0000000..7dbdbb3 --- /dev/null +++ b/Routes.razor @@ -0,0 +1,18 @@ + + + + + + + + Authorizing... + + + + + Not found - PartyGameTime + +

Sorry, there's nothing at this address.

+
+
+
\ No newline at end of file diff --git a/_Imports.razor b/_Imports.razor index 65f5a4f..54ddc26 100644 --- a/_Imports.razor +++ b/_Imports.razor @@ -1,4 +1,6 @@ -@using System.Net.Http +@using static Microsoft.AspNetCore.Components.Web.RenderMode + +@using System.Net.Http @using Microsoft.AspNetCore.Authorization @using Microsoft.AspNetCore.Components.Authorization @using Microsoft.AspNetCore.Components.Forms