diff --git a/BTCPayServer/Components/MainNav/Default.cshtml b/BTCPayServer/Components/MainNav/Default.cshtml index 36b2114cd..fff2a6420 100644 --- a/BTCPayServer/Components/MainNav/Default.cshtml +++ b/BTCPayServer/Components/MainNav/Default.cshtml @@ -296,6 +296,15 @@ + @if (!string.IsNullOrWhiteSpace(Model.ContactUrl)) + { + + } } diff --git a/BTCPayServer/Components/MainNav/MainNav.cs b/BTCPayServer/Components/MainNav/MainNav.cs index ac5ac47c3..b648e77af 100644 --- a/BTCPayServer/Components/MainNav/MainNav.cs +++ b/BTCPayServer/Components/MainNav/MainNav.cs @@ -29,6 +29,8 @@ namespace BTCPayServer.Components.MainNav private readonly UserManager _userManager; private readonly PaymentMethodHandlerDictionary _paymentMethodHandlerDictionary; private readonly CustodianAccountRepository _custodianAccountRepository; + private readonly SettingsRepository _settingsRepository; + public PoliciesSettings PoliciesSettings { get; } public MainNav( AppService appService, @@ -38,6 +40,7 @@ namespace BTCPayServer.Components.MainNav UserManager userManager, PaymentMethodHandlerDictionary paymentMethodHandlerDictionary, CustodianAccountRepository custodianAccountRepository, + SettingsRepository settingsRepository, PoliciesSettings policiesSettings) { _storeRepo = storeRepo; @@ -47,13 +50,19 @@ namespace BTCPayServer.Components.MainNav _storesController = storesController; _paymentMethodHandlerDictionary = paymentMethodHandlerDictionary; _custodianAccountRepository = custodianAccountRepository; + _settingsRepository = settingsRepository; PoliciesSettings = policiesSettings; } public async Task InvokeAsync() { var store = ViewContext.HttpContext.GetStoreData(); - var vm = new MainNavViewModel { Store = store }; + var serverSettings = await _settingsRepository.GetSettingAsync() ?? new ServerSettings(); + var vm = new MainNavViewModel + { + Store = store, + ContactUrl = serverSettings.ContactUrl + }; #if ALTCOINS vm.AltcoinsBuild = true; #endif @@ -92,7 +101,5 @@ namespace BTCPayServer.Components.MainNav } private string UserId => _userManager.GetUserId(HttpContext.User); - - public PoliciesSettings PoliciesSettings { get; } } } diff --git a/BTCPayServer/Components/MainNav/MainNavViewModel.cs b/BTCPayServer/Components/MainNav/MainNavViewModel.cs index 15b90a7c3..169448a05 100644 --- a/BTCPayServer/Components/MainNav/MainNavViewModel.cs +++ b/BTCPayServer/Components/MainNav/MainNavViewModel.cs @@ -13,6 +13,7 @@ namespace BTCPayServer.Components.MainNav public CustodianAccountData[] CustodianAccounts { get; set; } public bool AltcoinsBuild { get; set; } public int ArchivedAppsCount { get; set; } + public string ContactUrl { get; set; } } public class StoreApp diff --git a/BTCPayServer/Views/Shared/_LayoutSignedOut.cshtml b/BTCPayServer/Views/Shared/_LayoutSignedOut.cshtml index 9cbfd069c..9a6d3e0ed 100644 --- a/BTCPayServer/Views/Shared/_LayoutSignedOut.cshtml +++ b/BTCPayServer/Views/Shared/_LayoutSignedOut.cshtml @@ -1,13 +1,19 @@ @using BTCPayServer.Services @using Microsoft.AspNetCore.Mvc.TagHelpers @using BTCPayServer.Components.MainLogo +@using System.Text @inject SettingsRepository SettingsRepository @{ Layout = "_LayoutSimple"; ViewBag.ShowTitle ??= true; ViewBag.ShowLeadText ??= false; - + // obfuscate email on public page, decode via JS (see below) var settings = await SettingsRepository.GetSettingAsync() ?? new ServerSettings(); + var contactUrl = settings.ContactUrl; + if (contactUrl?.StartsWith("mailto:") is true) + { + contactUrl = Convert.ToBase64String(Encoding.UTF8.GetBytes(contactUrl)); + } } @section PageHeadContent { @@ -64,11 +70,20 @@ @RenderBody() -@if (!string.IsNullOrWhiteSpace(settings.ContactUrl)) +@if (!string.IsNullOrWhiteSpace(contactUrl)) {

- Contact Us + Contact Us

+ @if (contactUrl != settings.ContactUrl) + { + + } }
diff --git a/BTCPayServer/wwwroot/img/icon-sprite.svg b/BTCPayServer/wwwroot/img/icon-sprite.svg index c623b3b27..4bca50288 100644 --- a/BTCPayServer/wwwroot/img/icon-sprite.svg +++ b/BTCPayServer/wwwroot/img/icon-sprite.svg @@ -26,6 +26,7 @@ +