mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-02-05 13:49:07 +00:00
Added preprocessor directives to handle both development & release versions
This commit is contained in:
parent
8dd6a2f898
commit
cb3bb42aa4
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user