From 3285f24fe94a1324ec5e050ed9878fb371dbc5a9 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Mon, 23 May 2022 10:46:51 +0900 Subject: [PATCH 1/2] Add experimental mode --- BTCPayServer.Tests/BTCPayServerTester.cs | 3 +++ BTCPayServer.Tests/GreenfieldAPITests.cs | 3 +++ .../Configuration/BTCPayServerOptions.cs | 2 ++ .../Configuration/DefaultConfiguration.cs | 3 ++- .../GreenfieldCustodianAccountController.cs | 2 ++ .../GreenfieldCustodianController.cs | 2 ++ .../Filters/ExperimentalRouteAttribute.cs | 20 +++++++++++++++ .../Services/BTCPayServerEnvironment.cs | 3 +++ .../Services/DefaultSwaggerProvider.cs | 13 +++++++--- .../v1/swagger.template.custodians.json | 25 ++++++++++--------- 10 files changed, 60 insertions(+), 16 deletions(-) create mode 100644 BTCPayServer/Filters/ExperimentalRouteAttribute.cs diff --git a/BTCPayServer.Tests/BTCPayServerTester.cs b/BTCPayServer.Tests/BTCPayServerTester.cs index eb201a9bd..9573bb21e 100644 --- a/BTCPayServer.Tests/BTCPayServerTester.cs +++ b/BTCPayServer.Tests/BTCPayServerTester.cs @@ -137,6 +137,8 @@ namespace BTCPayServer.Tests } if (CheatMode) config.AppendLine("cheatmode=1"); + if (Experimental) + config.AppendLine("experimental=1"); config.AppendLine($"torrcfile={TestUtils.GetTestDataFullPath("Tor/torrc")}"); config.AppendLine($"socksendpoint={SocksEndpoint}"); @@ -291,6 +293,7 @@ namespace BTCPayServer.Tests public string SSHKeyFile { get; internal set; } public string SSHConnection { get; set; } public bool NoCSP { get; set; } + public bool Experimental { get; internal set; } public T GetController(string userId = null, string storeId = null, bool isAdmin = false) where T : Controller { diff --git a/BTCPayServer.Tests/GreenfieldAPITests.cs b/BTCPayServer.Tests/GreenfieldAPITests.cs index 327606128..869d7e96c 100644 --- a/BTCPayServer.Tests/GreenfieldAPITests.cs +++ b/BTCPayServer.Tests/GreenfieldAPITests.cs @@ -2519,6 +2519,7 @@ namespace BTCPayServer.Tests public async Task CustodiansControllerTests() { using var tester = CreateServerTester(); + tester.PayTester.Experimental = true; await tester.StartAsync(); var unauthClient = new BTCPayServerClient(tester.PayTester.ServerUri); await AssertHttpError(401, async () => await unauthClient.GetCustodians()); @@ -2538,6 +2539,7 @@ namespace BTCPayServer.Tests { using var tester = CreateServerTester(); + tester.PayTester.Experimental = true; await tester.StartAsync(); var admin = tester.NewAccount(); @@ -2709,6 +2711,7 @@ namespace BTCPayServer.Tests public async Task CustodianTests() { using var tester = CreateServerTester(); + tester.PayTester.Experimental = true; await tester.StartAsync(); var admin = tester.NewAccount(); diff --git a/BTCPayServer/Configuration/BTCPayServerOptions.cs b/BTCPayServer/Configuration/BTCPayServerOptions.cs index e800e593d..82fede6f5 100644 --- a/BTCPayServer/Configuration/BTCPayServerOptions.cs +++ b/BTCPayServer/Configuration/BTCPayServerOptions.cs @@ -147,6 +147,7 @@ namespace BTCPayServer.Configuration PluginRemote = conf.GetOrDefault("plugin-remote", "btcpayserver/btcpayserver-plugins"); RecommendedPlugins = conf.GetOrDefault("recommended-plugins", "").ToLowerInvariant().Split('\r', '\n', '\t', ' ').Where(s => !string.IsNullOrEmpty(s)).Distinct().ToArray(); CheatMode = conf.GetOrDefault("cheatmode", false); + Experimental = conf.GetOrDefault("experimental", false); if (CheatMode && this.NetworkType == ChainName.Mainnet) throw new ConfigException($"cheatmode can't be used on mainnet"); } @@ -154,6 +155,7 @@ namespace BTCPayServer.Configuration public string PluginRemote { get; set; } public string[] RecommendedPlugins { get; set; } public bool CheatMode { get; set; } + public bool Experimental { get; set; } private SSHSettings ParseSSHConfiguration(IConfiguration conf) { diff --git a/BTCPayServer/Configuration/DefaultConfiguration.cs b/BTCPayServer/Configuration/DefaultConfiguration.cs index 4a7fa19db..d8f93fed0 100644 --- a/BTCPayServer/Configuration/DefaultConfiguration.cs +++ b/BTCPayServer/Configuration/DefaultConfiguration.cs @@ -49,7 +49,8 @@ namespace BTCPayServer.Configuration app.Option("--plugin-remote", "Which github repository to fetch the available plugins list (default:btcpayserver/btcpayserver-plugins)", CommandOptionType.SingleValue); app.Option("--recommended-plugins", "Plugins which would be marked as recommended to be installed. Separated by newline or space", CommandOptionType.MultipleValue); app.Option("--xforwardedproto", "If specified, set X-Forwarded-Proto to the specified value, this may be useful if your reverse proxy handle https but is not configured to add X-Forwarded-Proto (example: --xforwardedproto https)", CommandOptionType.SingleValue); - app.Option("--cheatmode", "Add elements in the UI to facilitate dev-time testing (Default false)", CommandOptionType.BoolValue); + app.Option("--cheatmode", "Add some helper UI to facilitate dev-time testing (Default false)", CommandOptionType.BoolValue); + app.Option("--experimental", "Enable experimental features (Default false)", CommandOptionType.BoolValue); app.Option("--explorerpostgres", $"Connection string to the postgres database of NBXplorer. (optional, used for dashboard and reporting features)", CommandOptionType.SingleValue); foreach (var network in provider.GetAll().OfType()) diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldCustodianAccountController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldCustodianAccountController.cs index f40de21de..e72e214cb 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldCustodianAccountController.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldCustodianAccountController.cs @@ -10,6 +10,7 @@ using BTCPayServer.Abstractions.Extensions; using BTCPayServer.Client; using BTCPayServer.Client.Models; using BTCPayServer.Data; +using BTCPayServer.Filters; using BTCPayServer.Security; using BTCPayServer.Services.Custodian; using BTCPayServer.Services.Custodian.Client; @@ -38,6 +39,7 @@ namespace BTCPayServer.Controllers.Greenfield [Authorize(AuthenticationSchemes = AuthenticationSchemes.GreenfieldAPIKeys)] [EnableCors(CorsPolicies.All)] [CustodianExceptionFilter] + [ExperimentalRouteAttribute] // if you remove this, also remove "x_experimental": true in swagger.template.custodians.json public class GreenfieldCustodianAccountController : ControllerBase { private readonly CustodianAccountRepository _custodianAccountRepository; diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldCustodianController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldCustodianController.cs index 8218591dd..d8ff195c6 100644 --- a/BTCPayServer/Controllers/GreenField/GreenfieldCustodianController.cs +++ b/BTCPayServer/Controllers/GreenField/GreenfieldCustodianController.cs @@ -3,6 +3,7 @@ using System.Linq; using BTCPayServer.Abstractions.Constants; using BTCPayServer.Abstractions.Custodians; using BTCPayServer.Client.Models; +using BTCPayServer.Filters; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Mvc; @@ -12,6 +13,7 @@ namespace BTCPayServer.Controllers.Greenfield [ApiController] [Authorize(AuthenticationSchemes = AuthenticationSchemes.GreenfieldAPIKeys)] [EnableCors(CorsPolicies.All)] + [ExperimentalRouteAttribute] // if you remove this, also remove "x_experimental": true in swagger.template.custodians.json public class GreenfieldCustodianController : ControllerBase { private readonly IEnumerable _custodianRegistry; diff --git a/BTCPayServer/Filters/ExperimentalRouteAttribute.cs b/BTCPayServer/Filters/ExperimentalRouteAttribute.cs new file mode 100644 index 000000000..18dac213e --- /dev/null +++ b/BTCPayServer/Filters/ExperimentalRouteAttribute.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using BTCPayServer.Services; +using Microsoft.AspNetCore.Mvc.ActionConstraints; +using Microsoft.Extensions.DependencyInjection; + +namespace BTCPayServer.Filters +{ + public class ExperimentalRouteAttribute : Attribute, IActionConstraint + { + public int Order => 100; + + public bool Accept(ActionConstraintContext context) + { + return context.RouteContext.HttpContext.RequestServices.GetRequiredService().Experimental; + } + } +} diff --git a/BTCPayServer/Services/BTCPayServerEnvironment.cs b/BTCPayServer/Services/BTCPayServerEnvironment.cs index 82e156045..3a6162d7e 100644 --- a/BTCPayServer/Services/BTCPayServerEnvironment.cs +++ b/BTCPayServer/Services/BTCPayServerEnvironment.cs @@ -35,6 +35,7 @@ namespace BTCPayServer.Services NetworkType = provider.NetworkType; this.torServices = torServices; CheatMode = opts.CheatMode; + Experimental = opts.Experimental; } public IWebHostEnvironment Environment { @@ -80,6 +81,8 @@ namespace BTCPayServer.Services public HttpContext Context => httpContext.HttpContext; + public bool Experimental { get; set; } + public override string ToString() { StringBuilder txt = new StringBuilder(); diff --git a/BTCPayServer/Services/DefaultSwaggerProvider.cs b/BTCPayServer/Services/DefaultSwaggerProvider.cs index 01b05d6d6..2a7ccca01 100644 --- a/BTCPayServer/Services/DefaultSwaggerProvider.cs +++ b/BTCPayServer/Services/DefaultSwaggerProvider.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using System.Threading.Tasks; using BTCPayServer.Abstractions.Contracts; using Microsoft.AspNetCore.Hosting; @@ -11,11 +11,15 @@ public class DefaultSwaggerProvider: ISwaggerProvider { private readonly IFileProvider _fileProvider; - public DefaultSwaggerProvider(IWebHostEnvironment webHostEnvironment) + public DefaultSwaggerProvider(IWebHostEnvironment webHostEnvironment, BTCPayServerEnvironment env) { _fileProvider = webHostEnvironment.WebRootFileProvider; + Env = env; } + + public BTCPayServerEnvironment Env { get; } + public async Task Fetch() { @@ -25,7 +29,10 @@ public class DefaultSwaggerProvider: ISwaggerProvider { await using var stream = fi.CreateReadStream(); using var reader = new StreamReader(fi.CreateReadStream()); - json.Merge(JObject.Parse(await reader.ReadToEndAsync())); + var jObject = JObject.Parse(await reader.ReadToEndAsync()); + if (jObject.Remove("x_experimental") && !Env.Experimental) + continue; + json.Merge(jObject); } return json; diff --git a/BTCPayServer/wwwroot/swagger/v1/swagger.template.custodians.json b/BTCPayServer/wwwroot/swagger/v1/swagger.template.custodians.json index db6900c2f..79196e903 100644 --- a/BTCPayServer/wwwroot/swagger/v1/swagger.template.custodians.json +++ b/BTCPayServer/wwwroot/swagger/v1/swagger.template.custodians.json @@ -1,9 +1,10 @@ { + "x_experimental": true, "paths": { "/api/v1/custodians": { "get": { "tags": [ - "Custodians (Experimental)" + "Custodians" ], "summary": "List supported custodians", "description": "List all supported custodians for the BTCPay instance. You can install plugins to add more custodians.", @@ -34,7 +35,7 @@ "/api/v1/stores/{storeId}/custodian-accounts": { "get": { "tags": [ - "Custodians (Experimental)" + "Custodians" ], "summary": "List store custodian accounts", "parameters": [ @@ -79,7 +80,7 @@ }, "post": { "tags": [ - "Custodians (Experimental)" + "Custodians" ], "summary": "Add a custodial account to a store.", "description": "Add a custodial account to a store.", @@ -123,7 +124,7 @@ "/api/v1/stores/{storeId}/custodian-accounts/{accountId}": { "get": { "tags": [ - "Custodians (Experimental)" + "Custodians" ], "summary": "Get store custodian account", "parameters": [ @@ -174,7 +175,7 @@ }, "put": { "tags": [ - "Custodians (Experimental)" + "Custodians" ], "summary": "Update custodial account", "description": "Update custodial account", @@ -216,7 +217,7 @@ }, "delete": { "tags": [ - "Custodians (Experimental)" + "Custodians" ], "summary": "Delete store custodian account", "description": "Deletes a custodial account", @@ -233,7 +234,7 @@ "/api/v1/stores/{storeId}/custodian-accounts/{accountId}/trades/quote": { "get": { "tags": [ - "Custodians (Experimental)" + "Custodians" ], "summary": "Get quote for trading one asset for another", "description": "Get the current bid and ask price for converting one asset into another.", @@ -306,7 +307,7 @@ "/api/v1/stores/{storeId}/custodian-accounts/{accountId}/trades/market": { "post": { "tags": [ - "Custodians (Experimental)" + "Custodians" ], "summary": "Trade one asset for another", "description": "Trade one asset for another using a market order (=instant purchase with instant result or failure). A suitable asset pair will automatically be selected. If no asset pair is available, the call will fail.", @@ -371,7 +372,7 @@ "/api/v1/stores/{storeId}/custodian-accounts/{accountId}/addresses/{paymentMethod}": { "get": { "tags": [ - "Custodians (Experimental)" + "Custodians" ], "summary": "Get a deposit address for custodian", "description": "Get a new deposit address for the custodian using the specified payment method (network + crypto code).", @@ -445,7 +446,7 @@ "/api/v1/stores/{storeId}/custodian-accounts/{accountId}/withdrawals": { "post": { "tags": [ - "Custodians (Experimental)" + "Custodians" ], "summary": "Withdraw to store wallet", "description": "Withdraw an asset to your store wallet.", @@ -531,7 +532,7 @@ "/api/v1/stores/{storeId}/custodian-accounts/{accountId}/withdrawals/{withdrawalId}": { "post": { "tags": [ - "Custodians (Experimental)" + "Custodians" ], "summary": "Get withdrawal info", "description": "Get the details about a past withdrawal.", @@ -1034,7 +1035,7 @@ }, "tags": [ { - "name": "Custodians (Experimental)" + "name": "Custodians" } ] } From 67eeb4b69a6f2cc18a1c72071d0bc941781c15a3 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Tue, 24 May 2022 13:18:16 +0900 Subject: [PATCH 2/2] Allow resolution of any settings via DI --- .../AltcoinTests/AltcoinTests.cs | 4 +- BTCPayServer.Tests/BTCPayServerTester.cs | 11 +++- BTCPayServer.Tests/GreenfieldAPITests.cs | 8 +-- BTCPayServer.Tests/UnitTest1.cs | 8 +-- .../Components/MainNav/Default.cshtml | 11 ++-- .../Configuration/BTCPayServerOptions.cs | 2 - .../Configuration/DefaultConfiguration.cs | 1 - ...ieldLightningNodeApiController.Internal.cs | 4 +- ...enfieldLightningNodeApiController.Store.cs | 4 +- .../GreenfieldLightningNodeApiController.cs | 10 ++-- ...ightningNetworkPaymentMethodsController.cs | 10 +++- ...ymentMethodsController.WalletGeneration.cs | 2 +- ...eldStoreOnChainPaymentMethodsController.cs | 10 +++- ...GreenfieldStoreOnChainWalletsController.cs | 10 ++-- .../GreenField/GreenfieldUsersController.cs | 5 +- .../Controllers/UIAccountController.cs | 35 ++++++------ BTCPayServer/Controllers/UIHomeController.cs | 8 +-- .../Controllers/UIServerController.Users.cs | 7 +-- .../Controllers/UIServerController.cs | 17 +++--- .../UIStoresController.LightningLike.cs | 24 ++++---- .../Controllers/UIStoresController.Onchain.cs | 3 +- .../Controllers/UIStoresController.cs | 6 +- .../SettingsRepositoryExtensions.cs | 18 ------ .../DomainMappingConstraintAttribute.cs | 3 +- .../Filters/ExperimentalRouteAttribute.cs | 2 +- BTCPayServer/Hosting/BTCPayServerServices.cs | 14 ++++- .../Services/BTCPayServerEnvironment.cs | 3 - .../Services/DefaultSwaggerProvider.cs | 7 ++- BTCPayServer/Services/ISettingsAccessor.cs | 55 +++++++++++++++++++ .../Services/Mails/EmailSenderFactory.cs | 13 +++-- BTCPayServer/Services/PoliciesSettings.cs | 2 + BTCPayServer/Views/Shared/LayoutHead.cshtml | 4 +- .../Views/Shared/LayoutHeadTheme.cshtml | 9 +-- BTCPayServer/Views/Shared/_Layout.cshtml | 4 +- BTCPayServer/Views/Shared/_LayoutPos.cshtml | 8 +-- BTCPayServer/Views/UIAccount/Login.cshtml | 4 +- .../Views/UIAppsPublic/ViewCrowdfund.cshtml | 4 +- .../ViewPaymentRequest.cshtml | 4 +- .../ShowLightningNodeInfo.cshtml | 4 +- .../UIPullPayment/ViewPullPayment.cshtml | 8 +-- BTCPayServer/Views/UIServer/Policies.cshtml | 4 ++ 41 files changed, 221 insertions(+), 149 deletions(-) delete mode 100644 BTCPayServer/Extensions/SettingsRepositoryExtensions.cs create mode 100644 BTCPayServer/Services/ISettingsAccessor.cs diff --git a/BTCPayServer.Tests/AltcoinTests/AltcoinTests.cs b/BTCPayServer.Tests/AltcoinTests/AltcoinTests.cs index 4a4e00bd8..5b301209f 100644 --- a/BTCPayServer.Tests/AltcoinTests/AltcoinTests.cs +++ b/BTCPayServer.Tests/AltcoinTests/AltcoinTests.cs @@ -72,14 +72,14 @@ namespace BTCPayServer.Tests // Setup Lightning var controller = user.GetController(); - var lightningVm = (LightningNodeViewModel)Assert.IsType(await controller.SetupLightningNode(user.StoreId, cryptoCode)).Model; + var lightningVm = (LightningNodeViewModel)Assert.IsType(controller.SetupLightningNode(user.StoreId, cryptoCode)).Model; Assert.True(lightningVm.Enabled); var response = await controller.SetLightningNodeEnabled(user.StoreId, cryptoCode, false); Assert.IsType(response); // Get enabled state from settings LightningSettingsViewModel lnSettingsModel; - response = controller.LightningSettings(user.StoreId, cryptoCode).GetAwaiter().GetResult(); + response = controller.LightningSettings(user.StoreId, cryptoCode); lnSettingsModel = (LightningSettingsViewModel)Assert.IsType(response).Model; Assert.NotNull(lnSettingsModel?.ConnectionString); Assert.False(lnSettingsModel.Enabled); diff --git a/BTCPayServer.Tests/BTCPayServerTester.cs b/BTCPayServer.Tests/BTCPayServerTester.cs index 9573bb21e..9b7cd0611 100644 --- a/BTCPayServer.Tests/BTCPayServerTester.cs +++ b/BTCPayServer.Tests/BTCPayServerTester.cs @@ -137,8 +137,6 @@ namespace BTCPayServer.Tests } if (CheatMode) config.AppendLine("cheatmode=1"); - if (Experimental) - config.AppendLine("experimental=1"); config.AppendLine($"torrcfile={TestUtils.GetTestDataFullPath("Tor/torrc")}"); config.AppendLine($"socksendpoint={SocksEndpoint}"); @@ -293,7 +291,6 @@ namespace BTCPayServer.Tests public string SSHKeyFile { get; internal set; } public string SSHConnection { get; set; } public bool NoCSP { get; set; } - public bool Experimental { get; internal set; } public T GetController(string userId = null, string storeId = null, bool isAdmin = false) where T : Controller { @@ -342,5 +339,13 @@ namespace BTCPayServer.Tests var index = coinAverageMock.ExchangeRates.FindIndex(o => o.CurrencyPair == p); coinAverageMock.ExchangeRates[index] = new PairRate(p, bidAsk); } + + public async Task EnableExperimental() + { + var r = GetService(); + var p = await r.GetSettingAsync() ?? new PoliciesSettings(); + p.Experimental = true; + await r.UpdateSetting(p); + } } } diff --git a/BTCPayServer.Tests/GreenfieldAPITests.cs b/BTCPayServer.Tests/GreenfieldAPITests.cs index 869d7e96c..a69e3caf5 100644 --- a/BTCPayServer.Tests/GreenfieldAPITests.cs +++ b/BTCPayServer.Tests/GreenfieldAPITests.cs @@ -2519,8 +2519,8 @@ namespace BTCPayServer.Tests public async Task CustodiansControllerTests() { using var tester = CreateServerTester(); - tester.PayTester.Experimental = true; await tester.StartAsync(); + await tester.PayTester.EnableExperimental(); var unauthClient = new BTCPayServerClient(tester.PayTester.ServerUri); await AssertHttpError(401, async () => await unauthClient.GetCustodians()); @@ -2539,8 +2539,8 @@ namespace BTCPayServer.Tests { using var tester = CreateServerTester(); - tester.PayTester.Experimental = true; await tester.StartAsync(); + await tester.PayTester.EnableExperimental(); var admin = tester.NewAccount(); await admin.GrantAccessAsync(true); @@ -2711,9 +2711,9 @@ namespace BTCPayServer.Tests public async Task CustodianTests() { using var tester = CreateServerTester(); - tester.PayTester.Experimental = true; await tester.StartAsync(); - + await tester.PayTester.EnableExperimental(); + var admin = tester.NewAccount(); await admin.GrantAccessAsync(true); diff --git a/BTCPayServer.Tests/UnitTest1.cs b/BTCPayServer.Tests/UnitTest1.cs index 9d808365b..f7c33ff30 100644 --- a/BTCPayServer.Tests/UnitTest1.cs +++ b/BTCPayServer.Tests/UnitTest1.cs @@ -408,7 +408,7 @@ namespace BTCPayServer.Tests var storeController = user.GetController(); var storeResponse = storeController.GeneralSettings(); Assert.IsType(storeResponse); - Assert.IsType(await storeController.SetupLightningNode(user.StoreId, "BTC")); + Assert.IsType(storeController.SetupLightningNode(user.StoreId, "BTC")); storeController.SetupLightningNode(user.StoreId, new LightningNodeViewModel { @@ -430,7 +430,7 @@ namespace BTCPayServer.Tests new LightningNodeViewModel { ConnectionString = tester.MerchantCharge.Client.Uri.AbsoluteUri }, "save", "BTC").GetAwaiter().GetResult()); - storeResponse = storeController.LightningSettings(user.StoreId, "BTC").GetAwaiter().GetResult(); + storeResponse = storeController.LightningSettings(user.StoreId, "BTC"); var storeVm = Assert.IsType(Assert .IsType(storeResponse).Model); @@ -1571,7 +1571,7 @@ namespace BTCPayServer.Tests // enable unified QR code in settings var vm = Assert.IsType(Assert - .IsType(await user.GetController().LightningSettings(user.StoreId, cryptoCode)).Model + .IsType(user.GetController().LightningSettings(user.StoreId, cryptoCode)).Model ); vm.OnChainWithLnInvoiceFallback = true; Assert.IsType( @@ -1629,7 +1629,7 @@ namespace BTCPayServer.Tests // Activating LNUrl, we should still have only 1 payment criteria that can be set. user.RegisterLightningNode(cryptoCode, LightningConnectionType.Charge); - var lnSettingsVm = await user.GetController().LightningSettings(user.StoreId, cryptoCode).AssertViewModelAsync(); + var lnSettingsVm = user.GetController().LightningSettings(user.StoreId, cryptoCode).AssertViewModel(); lnSettingsVm.LNURLEnabled = true; lnSettingsVm.LNURLStandardInvoiceEnabled = true; Assert.IsType(user.GetController().LightningSettings(lnSettingsVm).Result); diff --git a/BTCPayServer/Components/MainNav/Default.cshtml b/BTCPayServer/Components/MainNav/Default.cshtml index 449fa9538..4f5dd5bd9 100644 --- a/BTCPayServer/Components/MainNav/Default.cshtml +++ b/BTCPayServer/Components/MainNav/Default.cshtml @@ -8,16 +8,15 @@ @using BTCPayServer.Abstractions.Extensions @using BTCPayServer.Abstractions.Contracts @using BTCPayServer.Client +@using BTCPayServer.Services @inject BTCPayServer.Services.BTCPayServerEnvironment Env @inject SignInManager SignInManager -@inject ISettingsRepository SettingsRepository +@inject PoliciesSettings PoliciesSettings +@inject ThemeSettings Theme @model BTCPayServer.Components.MainNav.MainNavViewModel @addTagHelper *, BundlerMinifier.TagHelpers -@{ - var theme = await SettingsRepository.GetTheme(); -}