diff --git a/BTCPayServer/Controllers/PublicLightningNodeInfoController.cs b/BTCPayServer/Controllers/PublicLightningNodeInfoController.cs index 4d869a39f..9ece7b317 100644 --- a/BTCPayServer/Controllers/PublicLightningNodeInfoController.cs +++ b/BTCPayServer/Controllers/PublicLightningNodeInfoController.cs @@ -41,20 +41,21 @@ namespace BTCPayServer.Controllers var paymentMethodDetails = GetExistingLightningSupportedPaymentMethod(cryptoCode, store); var network = _BtcPayNetworkProvider.GetNetwork(cryptoCode); var nodeInfo = - await _LightningLikePaymentHandler.GetNodeInfo(this.Request.IsOnion(), paymentMethodDetails, + await _LightningLikePaymentHandler.GetNodeInfo(Request.IsOnion(), paymentMethodDetails, network); - return View(new ShowLightningNodeInfoViewModel() + return View(new ShowLightningNodeInfoViewModel { Available = true, NodeInfo = nodeInfo.ToString(), CryptoCode = cryptoCode, - CryptoImage = GetImage(paymentMethodDetails.PaymentId, network) + CryptoImage = GetImage(paymentMethodDetails.PaymentId, network), + StoreName = store.StoreName }); } catch (Exception) { - return View(new ShowLightningNodeInfoViewModel() { Available = false, CryptoCode = cryptoCode }); + return View(new ShowLightningNodeInfoViewModel { Available = false, CryptoCode = cryptoCode }); } } @@ -83,5 +84,6 @@ namespace BTCPayServer.Controllers public bool Available { get; set; } public string CryptoCode { get; set; } public string CryptoImage { get; set; } + public string StoreName { get; set; } } } diff --git a/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs b/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs index b1a7cacec..6e60e8b3b 100644 --- a/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs +++ b/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs @@ -79,7 +79,7 @@ namespace BTCPayServer.Payments.Lightning } catch (OperationCanceledException) when (cts.IsCancellationRequested) { - throw new PaymentMethodUnavailableException($"The lightning node did not reply in a timely manner"); + throw new PaymentMethodUnavailableException("The lightning node did not reply in a timely manner"); } catch (Exception ex) { @@ -87,7 +87,7 @@ namespace BTCPayServer.Payments.Lightning } } var nodeInfo = await test; - return new LightningLikePaymentMethodDetails() + return new LightningLikePaymentMethodDetails { BOLT11 = lightningInvoice.BOLT11, InvoiceId = lightningInvoice.Id, @@ -98,19 +98,19 @@ namespace BTCPayServer.Payments.Lightning public async Task GetNodeInfo(bool preferOnion, LightningSupportedPaymentMethod supportedPaymentMethod, BTCPayNetwork network) { if (!_Dashboard.IsFullySynched(network.CryptoCode, out var summary)) - throw new PaymentMethodUnavailableException($"Full node not available"); + throw new PaymentMethodUnavailableException("Full node not available"); using (var cts = new CancellationTokenSource(LIGHTNING_TIMEOUT)) { var client = _lightningClientFactory.Create(supportedPaymentMethod.GetLightningUrl(), network); - LightningNodeInformation info = null; + LightningNodeInformation info; try { info = await client.GetInfo(cts.Token); } catch (OperationCanceledException) when (cts.IsCancellationRequested) { - throw new PaymentMethodUnavailableException($"The lightning node did not reply in a timely manner"); + throw new PaymentMethodUnavailableException("The lightning node did not reply in a timely manner"); } catch (Exception ex) { @@ -119,7 +119,7 @@ namespace BTCPayServer.Payments.Lightning var nodeInfo = info.NodeInfoList.FirstOrDefault(i => i.IsTor == preferOnion) ?? info.NodeInfoList.FirstOrDefault(); if (nodeInfo == null) { - throw new PaymentMethodUnavailableException($"No lightning node public address has been configured"); + throw new PaymentMethodUnavailableException("No lightning node public address has been configured"); } var blocksGap = summary.Status.ChainHeight - info.BlockHeight; diff --git a/BTCPayServer/Views/PublicLightningNodeInfo/ShowLightningNodeInfo.cshtml b/BTCPayServer/Views/PublicLightningNodeInfo/ShowLightningNodeInfo.cshtml index 7a1288820..aaad32fe3 100644 --- a/BTCPayServer/Views/PublicLightningNodeInfo/ShowLightningNodeInfo.cshtml +++ b/BTCPayServer/Views/PublicLightningNodeInfo/ShowLightningNodeInfo.cshtml @@ -6,30 +6,25 @@ Layout = null; } - - @Model.CryptoCode LN Node Info + @Model.StoreName – @Model.CryptoCode Lightning Node - - - - + + - -
-
-
+
+
-
-

- {{srvModel.cryptoCode}} Lightning Node - - {{srvModel.available? "Online" : "Unavailable"}} - - - -

-
-
- - - +
+

@Model.StoreName

+

+ @Model.CryptoCode + Lightning Node +

+

+ + @(Model.Available ? "Online" : "Unavailable") + + + + +

+
+ @Model.CryptoCode +
-
- +
+
- +