mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-22 14:22:40 +01:00
Fix theme manager incorrectly applying default theme if rootPath is specified
This commit is contained in:
parent
f0145142a4
commit
7c0b26174f
2 changed files with 14 additions and 2 deletions
|
@ -135,6 +135,16 @@ namespace BTCPayServer
|
|||
request.PathBase.ToUriComponent());
|
||||
}
|
||||
|
||||
public static string GetAbsoluteUri(this HttpRequest request, string redirectUrl)
|
||||
{
|
||||
bool isRelative = redirectUrl.Length > 0 && redirectUrl[0] == '/';
|
||||
if (!isRelative)
|
||||
isRelative = new Uri(redirectUrl, UriKind.RelativeOrAbsolute).IsAbsoluteUri;
|
||||
if (!isRelative)
|
||||
return redirectUrl;
|
||||
return request.GetAbsoluteRoot() + redirectUrl;
|
||||
}
|
||||
|
||||
public static IServiceCollection ConfigureBTCPayServer(this IServiceCollection services, IConfiguration conf)
|
||||
{
|
||||
services.Configure<BTCPayServerOptions>(o =>
|
||||
|
@ -165,6 +175,7 @@ namespace BTCPayServer
|
|||
obj is bool b && b;
|
||||
}
|
||||
|
||||
|
||||
public static StoreData GetStoreData(this HttpContext ctx)
|
||||
{
|
||||
return ctx.Items.TryGet("BTCPAY.STOREDATA") as StoreData;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
@inject BTCPayServer.Services.BTCPayServerEnvironment env
|
||||
@inject BTCPayServer.HostedServices.NBXplorerDashboard dashboard
|
||||
@inject BTCPayServer.HostedServices.CssThemeManager themeManager
|
||||
|
||||
@addTagHelper *, Meziantou.AspNetCore.BundleTagHelpers
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
@ -18,8 +19,8 @@
|
|||
<title>BTCPay Server</title>
|
||||
|
||||
@* CSS *@
|
||||
<link href="@themeManager.BootstrapUri" rel="stylesheet" />
|
||||
<link href="@themeManager.CreativeStartUri" rel="stylesheet" />
|
||||
<link href="@this.Context.Request.GetAbsoluteUri(themeManager.BootstrapUri)" rel="stylesheet" />
|
||||
<link href="@this.Context.Request.GetAbsoluteUri(themeManager.CreativeStartUri)" rel="stylesheet" />
|
||||
|
||||
<bundle name="wwwroot/bundles/main-bundle.min.css" />
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue