mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-03-13 11:35:51 +01:00
Fix Back to Website path for Hangfire
This commit is contained in:
parent
b1da136f77
commit
8fdfb2c4f6
2 changed files with 17 additions and 4 deletions
|
@ -119,5 +119,14 @@ namespace BTCPayServer.Configuration
|
|||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
internal string GetRootUri()
|
||||
{
|
||||
if (ExternalUrl == null)
|
||||
return null;
|
||||
UriBuilder builder = new UriBuilder(ExternalUrl);
|
||||
builder.Path = RootPath;
|
||||
return builder.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,18 +130,18 @@ namespace BTCPayServer.Hosting
|
|||
Logs.Configuration.LogInformation($"Root Path: {options.RootPath}");
|
||||
if (options.RootPath.Equals("/", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
ConfigureCore(app, env, prov, loggerFactory);
|
||||
ConfigureCore(app, env, prov, loggerFactory, options);
|
||||
}
|
||||
else
|
||||
{
|
||||
app.Map(options.RootPath, appChild =>
|
||||
{
|
||||
ConfigureCore(appChild, env, prov, loggerFactory);
|
||||
ConfigureCore(appChild, env, prov, loggerFactory, options);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static void ConfigureCore(IApplicationBuilder app, IHostingEnvironment env, IServiceProvider prov, ILoggerFactory loggerFactory)
|
||||
private static void ConfigureCore(IApplicationBuilder app, IHostingEnvironment env, IServiceProvider prov, ILoggerFactory loggerFactory, BTCPayServerOptions options)
|
||||
{
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
|
@ -156,7 +156,11 @@ namespace BTCPayServer.Hosting
|
|||
app.UseStaticFiles();
|
||||
app.UseAuthentication();
|
||||
app.UseHangfireServer();
|
||||
app.UseHangfireDashboard("/hangfire", new DashboardOptions() { Authorization = new[] { new NeedRole(Roles.ServerAdmin) } });
|
||||
app.UseHangfireDashboard("/hangfire", new DashboardOptions()
|
||||
{
|
||||
AppPath = options.GetRootUri(),
|
||||
Authorization = new[] { new NeedRole(Roles.ServerAdmin) }
|
||||
});
|
||||
app.UseWebSockets();
|
||||
app.UseMvc(routes =>
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue