mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-08 14:49:40 +00:00
Added preprocessor directives to handle both development & release versions
This commit is contained in:
2 files changed
+27
-1
No files matched your search
@@ -38,15 +38,28 @@ builder.Services.AddRazorComponents()
|
||||
var port = args.Length > 0 ? args[0] : "5000";
|
||||
builder.WebHost.UseUrls($"http://localhost:{port}");
|
||||
|
||||
var fileProvider = new ManifestEmbeddedFileProvider(Assembly.GetAssembly(type: typeof(Program))!, "wwwroot");
|
||||
#if DEBUG
|
||||
builder.WebHost.UseWebRoot("wwwroot");
|
||||
builder.WebHost.UseStaticWebAssets();
|
||||
#endif
|
||||
|
||||
var app = builder.Build();
|
||||
app.Use(Redirect.HandlerContentAsync);
|
||||
|
||||
#if DEBUG
|
||||
app.UseStaticFiles();
|
||||
#else
|
||||
|
||||
var fileProvider = new ManifestEmbeddedFileProvider(Assembly.GetAssembly(type: typeof(Program))!, "wwwroot");
|
||||
app.UseDeveloperExceptionPage();
|
||||
app.UseStaticFiles(new StaticFileOptions
|
||||
{
|
||||
FileProvider = fileProvider,
|
||||
RequestPath = string.Empty,
|
||||
});
|
||||
|
||||
#endif
|
||||
|
||||
app.UseAntiforgery();
|
||||
app.MapRazorComponents<App>()
|
||||
.AddInteractiveServerRenderMode();
|
||||
|
||||
@@ -14,12 +14,25 @@ internal static class Redirect
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
#if DEBUG
|
||||
|
||||
if (path.StartsWith(SYSTEM, StringComparison.InvariantCulture))
|
||||
{
|
||||
context.Response.Redirect(path.Replace(SYSTEM, CONTENT), true, true);
|
||||
return;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
if (path.StartsWith(CONTENT, StringComparison.InvariantCulture))
|
||||
{
|
||||
context.Response.Redirect(path.Replace(CONTENT, SYSTEM), true, true);
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
await nextHandler();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user