diff --git a/BTCPayServer/HostedServices/CssThemeManager.cs b/BTCPayServer/HostedServices/CssThemeManager.cs index bbed57d04..ddba26c96 100644 --- a/BTCPayServer/HostedServices/CssThemeManager.cs +++ b/BTCPayServer/HostedServices/CssThemeManager.cs @@ -26,6 +26,11 @@ namespace BTCPayServer.HostedServices else _themeUri = data.ThemeCssUri; + if (String.IsNullOrWhiteSpace(data.CustomThemeCssUri)) + _customThemeUri = null; + else + _customThemeUri = data.CustomThemeCssUri; + if (String.IsNullOrWhiteSpace(data.BootstrapCssUri)) _bootstrapUri = "/main/bootstrap/bootstrap.css"; else @@ -35,6 +40,7 @@ namespace BTCPayServer.HostedServices _creativeStartUri = "/main/bootstrap4-creativestart/creative.css"; else _creativeStartUri = data.CreativeStartCssUri; + FirstRun = data.FirstRun; } @@ -44,6 +50,12 @@ namespace BTCPayServer.HostedServices get { return _themeUri; } } + private string _customThemeUri; + public string CustomThemeUri + { + get { return _customThemeUri; } + } + private string _bootstrapUri; public string BootstrapUri { @@ -108,6 +120,10 @@ namespace BTCPayServer.HostedServices { policies.Clear(); } + if (manager.CustomThemeUri != null && Uri.TryCreate(manager.CustomThemeUri, UriKind.Absolute, out uri)) + { + policies.Clear(); + } } } } diff --git a/BTCPayServer/Services/ThemesSettings.cs b/BTCPayServer/Services/ThemesSettings.cs index 8018c3976..640278097 100644 --- a/BTCPayServer/Services/ThemesSettings.cs +++ b/BTCPayServer/Services/ThemesSettings.cs @@ -14,12 +14,18 @@ namespace BTCPayServer.Services [Display(Name = "Select Theme")] public string ThemeCssUri { get; set; } + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)] + [MaxLength(500)] + [Display(Name = "Custom Theme CSS file")] + public string CustomThemeCssUri { get; set; } + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)] [MaxLength(500)] [Display(Name = "Custom bootstrap CSS file")] public string BootstrapCssUri { get; set; } [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)] + [Display(Name = "Custom Creative Start CSS file")] public string CreativeStartCssUri { get; set; } public bool FirstRun { get; set; } public override string ToString() diff --git a/BTCPayServer/Views/Server/Theme.cshtml b/BTCPayServer/Views/Server/Theme.cshtml index 1735a3f96..826064288 100644 --- a/BTCPayServer/Views/Server/Theme.cshtml +++ b/BTCPayServer/Views/Server/Theme.cshtml @@ -13,14 +13,23 @@
-
+

Custom theme

+

Select one of our predefined themes. Optionally you can also provide a CSS file that customizes the chosen theme.

+
-
+
+ + + + +
+

Bootstrap theme

diff --git a/BTCPayServer/Views/Shared/Header.cshtml b/BTCPayServer/Views/Shared/Header.cshtml index a978e6e7e..07706adf0 100644 --- a/BTCPayServer/Views/Shared/Header.cshtml +++ b/BTCPayServer/Views/Shared/Header.cshtml @@ -7,13 +7,17 @@ @if (themeManager.DiscourageSearchEngines) { - + } @ViewData["Title"] @* CSS *@ +@if (!String.IsNullOrWhiteSpace(themeManager.CustomThemeUri)) +{ + +} @* JS *@