fix altcoin only dashboard crash

closes #4038
This commit is contained in:
Kukks 2022-08-15 20:21:20 +02:00
parent e6c1b0cf54
commit 6459c7bfad
No known key found for this signature in database
GPG key ID: 8E5530D9D1C93097
5 changed files with 25 additions and 4 deletions

View file

@ -93,7 +93,7 @@
</li>
}
<vc:ui-extension-point location="store-wallets-nav" model="@Model"/>
@if (PoliciesSettings.Experimental)
{
@foreach (var custodianAccount in Model.CustodianAccounts)

View file

@ -29,7 +29,7 @@ namespace BTCPayServer.Controllers
{
WalletEnabled = walletEnabled,
LightningEnabled = lightningEnabled,
LightningSupported = _NetworkProvider.GetNetwork<BTCPayNetwork>(cryptoCode).SupportLightning,
LightningSupported = _NetworkProvider.GetNetwork<BTCPayNetwork>(cryptoCode)?.SupportLightning is true,
StoreId = CurrentStore.Id,
StoreName = CurrentStore.StoreName,
CryptoCode = cryptoCode,

View file

@ -25,6 +25,7 @@ namespace BTCPayServer.Services.Altcoins.Monero
serviceCollection.AddSingleton<MoneroLikePaymentMethodHandler>();
serviceCollection.AddSingleton<IPaymentMethodHandler>(provider => provider.GetService<MoneroLikePaymentMethodHandler>());
serviceCollection.AddSingleton<IUIExtension>(new UIExtension("Monero/StoreNavMoneroExtension", "store-nav"));
serviceCollection.AddSingleton<IUIExtension>(new UIExtension("Monero/StoreWalletsNavMoneroExtension", "store-wallets-nav"));
serviceCollection.AddSingleton<ISyncSummaryProvider, MoneroSyncSummaryProvider>();
return serviceCollection;

View file

@ -17,7 +17,7 @@ namespace BTCPayServer.Services
public Cheater(BTCPayServerOptions opts, ExplorerClientProvider prov, ApplicationDbContextFactory applicationDbContextFactory)
{
CashCow = prov.GetExplorerClient("BTC").RPCClient;
CashCow = prov.GetExplorerClient("BTC")?.RPCClient;
_applicationDbContextFactory = applicationDbContextFactory;
}
public RPCClient CashCow
@ -38,7 +38,7 @@ namespace BTCPayServer.Services
Task IHostedService.StartAsync(CancellationToken cancellationToken)
{
_ = CashCow.ScanRPCCapabilitiesAsync();
_ = CashCow?.ScanRPCCapabilitiesAsync();
return Task.CompletedTask;
}

View file

@ -0,0 +1,20 @@
@using BTCPayServer.Services.Altcoins.Monero.Configuration
@using BTCPayServer.Services.Altcoins.Monero.UI
@using Microsoft.AspNetCore.Mvc.TagHelpers
@using BTCPayServer.Client
@using BTCPayServer.Abstractions.TagHelpers
@inject MoneroLikeConfiguration MoneroLikeConfiguration;
@{
var controller = ViewContext.RouteData.Values["Controller"].ToString();
var isMonero = nameof(UIMoneroLikeStoreController).StartsWith(controller, StringComparison.InvariantCultureIgnoreCase);
}
@if (MoneroLikeConfiguration.MoneroLikeConfigurationItems.Any())
{
<li class="nav-item" permission="@Policies.CanModifyStoreSettings">
<a asp-action="GetStoreMoneroLikePaymentMethods" asp-controller="UIMoneroLikeStore" asp-route-storeId="@Model.Store.Id" class="nav-link @(isMonero ? "active" : string.Empty)" id="@($"StoreNav-Monero")">
<span class="me-2 btcpay-status"></span>
<span>Monero</span>
</a>
</li>
}