Cleanup & Bug Fixes

- WebAssembly fix (missing app.Run)
 - API comms cleanup
This commit is contained in:
daniel-c-harvey
2025-09-08 09:53:13 -04:00
parent 4f7b37813a
commit c6f4ffc1fe
13 changed files with 75 additions and 32 deletions
+30 -2
View File
@@ -12,8 +12,8 @@ builder.Services.AddMudServices();
// Add AudioInteropService for both server and client rendering
builder.Services.AddScoped<AudioInteropService>();
var baseUrl = Startup.GetKestrelUrl(builder);
var contentApiUrl = builder.Configuration["ApiUrls:ContentApi"] ?? "https://localhost:7001";
var baseUrl = builder.GetKestrelUrl();
var contentApiUrl = builder.Configuration["ApiUrls:ContentApi"] ?? throw new Exception("Content API URL is not configured");
Startup.ConfigureDomainServices(builder);
@@ -28,6 +28,17 @@ builder.Services.AddRazorComponents()
.AddInteractiveServerComponents()
.AddInteractiveWebAssemblyComponents();
// Configure SignalR for better circuit cleanup
builder.Services.AddSignalR(options =>
{
if (builder.Environment.IsDevelopment())
{
options.EnableDetailedErrors = true;
options.KeepAliveInterval = TimeSpan.FromSeconds(10);
options.ClientTimeoutInterval = TimeSpan.FromSeconds(30);
}
});
// Configure forwarded headers for reverse proxy support
builder.Services.Configure<ForwardedHeadersOptions>(options =>
{
@@ -63,6 +74,22 @@ else
app.UseAntiforgery();
// Configure cache headers for Blazor WebAssembly assets
if (app.Environment.IsDevelopment())
{
app.Use(async (context, next) =>
{
if (context.Request.Path.StartsWithSegments("/_framework") ||
context.Request.Path.StartsWithSegments("/_content"))
{
context.Response.Headers.CacheControl = "no-cache, no-store, must-revalidate";
context.Response.Headers.Pragma = "no-cache";
context.Response.Headers.Expires = "0";
}
await next();
});
}
app.MapStaticAssets();
app.MapControllers();
app.MapRazorComponents<App>()
@@ -70,4 +97,5 @@ app.MapRazorComponents<App>()
.AddInteractiveWebAssemblyRenderMode()
.AddAdditionalAssemblies(typeof(DeepDrftWeb.Client._Imports).Assembly);
app.Run();
+1 -1
View File
@@ -7,6 +7,6 @@
},
"DetailedErrors": true,
"ApiUrls": {
"ContentApi": "https://localhost:54493/api"
"ContentApi": "http://localhost:54493/api/"
}
}
+1 -1
View File
@@ -10,7 +10,7 @@
"DefaultConnection": "Data Source=../Database/deepdrft.db"
},
"ApiUrls": {
"ContentApi": "https://localhost:12777/api"
"ContentApi": "http://localhost:12777/api/"
},
"ForwardedHeaders": {
"DisableHttpsRedirection": "true"