Build ErsatzTV Image / Docs update reminder (pull_request) Successful in 8s
Build ErsatzTV Image / Build & test (.NET) (pull_request) Successful in 6m39s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request) Successful in 6m3s
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Has been skipped
The ChicoryTV React SPA (web/, served at /app) now has full parity for every route the Blazor UI served, so the legacy Blazor Server / MudBlazor UI is deleted. This is the milestone-capping removal of #91 phase (b). Deleted: ErsatzTV/Pages/**, Shared/**, ViewModels/** (39 edit VMs), Validators/** (10 edit-VM validators), App.razor, _Imports.razor, Locals/{Shared,Pages}/** (Blazor loc resx; Locals/Resources.* kept), wwwroot/css + wwwroot/lib, libman.json, and the orphaned MultiSelectBaseTests. Startup.cs (surgical, not wholesale): removed AddRazorPages/AuthorizeFolder, AddServerSideBlazor, AddMudServices, AddSortable, AddCourier, the HtmlSanitizer registration, the Blazor-attached OIDC UseAuthentication/UseAuthorization middleware (per the #206 auth-posture sign-off), MapBlazorHub, and MapFallbackToPage("/_Host"). Renamed the branch blazor->legacy; it still co-hosts MapControllers, /docs (Scalar), dev MapOpenApi and the redirect middleware. Replaced the _Host fallback with a catch-all (MapFallback -> 302 /app) that excludes /api|/artwork|/docs|/openapi (genuine 404) per #204. Kept all OIDC/JWT/API-key service wiring (inert unless configured; real auth is #197), ConditionalIptvAuthorizeFilter, ApiKeyAuthorizationFilter. Pruned 9 now-unused packages (all verified zero remaining consumers) from Directory.Packages.props + ErsatzTV.csproj: MudBlazor, Heron.MudCalendar, Blazored.FluentValidation, BlazorSortable, MediatR.Courier.DependencyInjection, Markdig, HtmlSanitizer, Chronic.Core, NaturalSort.Extension. Also removed the now-dead #25 razor-Sonar NoWarn. LegacyUiRedirects: added the 14 /media/sources/* -> /app/libraries/* redirects (SPA screens landed in #202) and lifted the #204-era /media/sources prefix ban. Tests: Release build clean; full solution suite green. Updated Startup source-text tests + added regression coverage that Blazor wiring is gone, the catch-all is wired, and all 14 media-sources routes redirect. Docs: blazor-route-parity.md (phase b COMPLETE), decisions.md (removal entry), CLAUDE.md, contributing.md, README.md all updated in this PR. Rollback: tag blazor-final is cut on pre-merge main as the first merge action. Part of #91. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
73 lines
2.7 KiB
C#
73 lines
2.7 KiB
C#
using NUnit.Framework;
|
|
using Shouldly;
|
|
|
|
namespace ErsatzTV.Tests;
|
|
|
|
[TestFixture]
|
|
public class StartupSpaHostingTests
|
|
{
|
|
private static readonly string StartupSource = File.ReadAllText(FindStartupPath());
|
|
|
|
[Test]
|
|
public void Startup_Should_Mount_ChicoryTv_Spa_At_App_Path()
|
|
{
|
|
StartupSource.ShouldContain("ctx.Request.Path.StartsWithSegments(\"/app\")");
|
|
StartupSource.ShouldContain("MapWhen(");
|
|
StartupSource.ShouldContain("SpaStaticFileRoot");
|
|
StartupSource.ShouldContain("RequestPath = \"/app\"");
|
|
StartupSource.ShouldContain("appIndexFile");
|
|
}
|
|
|
|
[Test]
|
|
public void Startup_Should_Keep_App_Routes_Out_Of_The_Legacy_Catch_All()
|
|
{
|
|
// /app is excluded from the legacy branch's MapWhen predicate, so SPA routes never
|
|
// reach the catch-all fallback (which 302s unmatched non-API paths to /app — an
|
|
// included /app route would loop).
|
|
StartupSource.ShouldContain("!IsSpaPath(ctx.Request.Path)");
|
|
StartupSource.ShouldContain("bool IsSpaPath(PathString path)");
|
|
}
|
|
|
|
[Test]
|
|
public void Startup_Should_Have_Removed_The_Blazor_Server_Ui()
|
|
{
|
|
// ersatztv#91 phase (b): the legacy Blazor Server UI is deleted. Guard against
|
|
// reintroduction — none of its wiring may return.
|
|
StartupSource.ShouldNotContain("MapBlazorHub");
|
|
StartupSource.ShouldNotContain("_Host");
|
|
StartupSource.ShouldNotContain("AddServerSideBlazor");
|
|
StartupSource.ShouldNotContain("AddMudServices");
|
|
StartupSource.ShouldNotContain("AddRazorPages");
|
|
}
|
|
|
|
[Test]
|
|
public void Startup_Should_Catch_All_Unmatched_Legacy_Routes_To_The_Spa()
|
|
{
|
|
// With _Host gone, a retired Blazor route that matches no controller/redirect 302s to
|
|
// the SPA rather than hard-404ing; /api, /artwork, /docs, /openapi are excluded so an
|
|
// unmatched one of those is a genuine 404 (docs/decisions.md #204).
|
|
StartupSource.ShouldContain("endpoints.MapFallback(");
|
|
StartupSource.ShouldContain("context.Response.Redirect(context.Request.PathBase + \"/app\")");
|
|
StartupSource.ShouldContain("path.StartsWithSegments(\"/api\")");
|
|
StartupSource.ShouldContain("path.StartsWithSegments(\"/artwork\")");
|
|
}
|
|
|
|
private static string FindStartupPath()
|
|
{
|
|
DirectoryInfo? directory = new(TestContext.CurrentContext.TestDirectory);
|
|
|
|
while (directory is not null)
|
|
{
|
|
string candidate = Path.Combine(directory.FullName, "ErsatzTV", "Startup.cs");
|
|
if (File.Exists(candidate))
|
|
{
|
|
return candidate;
|
|
}
|
|
|
|
directory = directory.Parent;
|
|
}
|
|
|
|
throw new FileNotFoundException("Could not find ErsatzTV/Startup.cs");
|
|
}
|
|
}
|