Skip to content

Commit

Permalink
Add website back into routing (#837)
Browse files Browse the repository at this point in the history
Accidentally replaced with /api routing as part of #835. Whoopsie!
  • Loading branch information
SapiensAnatis authored May 26, 2024
1 parent 8dab367 commit 1b7ff62
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions DragaliaAPI/DragaliaAPI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
}.ToFrozenSet();
#pragma warning restore CA1861

// Game endpoints
app.MapWhen(
ctx => apiRoutePrefixes.Any(prefix => ctx.Request.Path.StartsWithSegments(prefix)),
applicationBuilder =>
Expand All @@ -171,6 +172,7 @@
}
);

// Svelte website API
app.MapWhen(
static ctx => ctx.Request.Path.StartsWithSegments("/api"),
applicationBuilder =>
Expand All @@ -196,6 +198,27 @@
}
);

// Blazor website
app.MapWhen(
static ctx => !ctx.Request.Path.StartsWithSegments("/api"),
applicationBuilder =>
{
{
applicationBuilder.UseRouting();
#pragma warning disable ASP0001
applicationBuilder.UseAuthorization();
#pragma warning restore ASP0001
applicationBuilder.UseAntiforgery();
applicationBuilder.UseMiddleware<PlayerIdentityLoggingMiddleware>();
applicationBuilder.UseEndpoints(endpoints =>
{
endpoints.MapRazorPages();
endpoints.MapRazorComponents<App>().AddInteractiveServerRenderMode();
});
}
}
);

if (hangfireOptions.Enabled)
{
app.AddHangfireJobs();
Expand Down

0 comments on commit 1b7ff62

Please sign in to comment.