mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-21 22:11:48 +01:00
Don't show "Set up a Lightning node" when LN is not supported (#3935)
See discussion here: https://github.com/btcpayserver/btcpayserver/discussions/3868
This commit is contained in:
parent
09462e6877
commit
efe1686c05
4 changed files with 28 additions and 18 deletions
|
@ -24,13 +24,15 @@ namespace BTCPayServer.Controllers
|
||||||
|
|
||||||
var walletEnabled = derivationSchemes.Any(scheme => !string.IsNullOrEmpty(scheme.Value) && scheme.Enabled);
|
var walletEnabled = derivationSchemes.Any(scheme => !string.IsNullOrEmpty(scheme.Value) && scheme.Enabled);
|
||||||
var lightningEnabled = lightningNodes.Any(ln => !string.IsNullOrEmpty(ln.Address) && ln.Enabled);
|
var lightningEnabled = lightningNodes.Any(ln => !string.IsNullOrEmpty(ln.Address) && ln.Enabled);
|
||||||
|
var cryptoCode = _NetworkProvider.DefaultNetwork.CryptoCode;
|
||||||
var vm = new StoreDashboardViewModel
|
var vm = new StoreDashboardViewModel
|
||||||
{
|
{
|
||||||
WalletEnabled = walletEnabled,
|
WalletEnabled = walletEnabled,
|
||||||
LightningEnabled = lightningEnabled,
|
LightningEnabled = lightningEnabled,
|
||||||
|
LightningSupported = _NetworkProvider.GetNetwork<BTCPayNetwork>(cryptoCode).SupportLightning,
|
||||||
StoreId = CurrentStore.Id,
|
StoreId = CurrentStore.Id,
|
||||||
StoreName = CurrentStore.StoreName,
|
StoreName = CurrentStore.StoreName,
|
||||||
CryptoCode = _NetworkProvider.DefaultNetwork.CryptoCode,
|
CryptoCode = cryptoCode,
|
||||||
IsSetUp = walletEnabled || lightningEnabled
|
IsSetUp = walletEnabled || lightningEnabled
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ public class StoreDashboardViewModel
|
||||||
public string StoreName { get; set; }
|
public string StoreName { get; set; }
|
||||||
public bool WalletEnabled { get; set; }
|
public bool WalletEnabled { get; set; }
|
||||||
public bool LightningEnabled { get; set; }
|
public bool LightningEnabled { get; set; }
|
||||||
|
public bool LightningSupported { get; set; }
|
||||||
public bool IsSetUp { get; set; }
|
public bool IsSetUp { get; set; }
|
||||||
public List<AppData> Apps { get; set; } = new();
|
public List<AppData> Apps { get; set; } = new();
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,10 @@
|
||||||
isLightningEnabled &&
|
isLightningEnabled &&
|
||||||
isLNUrlEnabled &&
|
isLNUrlEnabled &&
|
||||||
store.GetSupportedPaymentMethods(BTCPayNetworkProvider).OfType<LNURLPaySupportedPaymentMethod>().Any(type => type.CryptoCode == cryptoCode);
|
store.GetSupportedPaymentMethods(BTCPayNetworkProvider).OfType<LNURLPaySupportedPaymentMethod>().Any(type => type.CryptoCode == cryptoCode);
|
||||||
|
var network = BTCPayNetworkProvider.GetNetwork<BTCPayNetwork>(cryptoCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@if (network.SupportLightning) {
|
||||||
<li class="list-group-item bg-tile" id="lightning-address-option">
|
<li class="list-group-item bg-tile" id="lightning-address-option">
|
||||||
<div class="d-flex align-items-center">
|
<div class="d-flex align-items-center">
|
||||||
<span class="d-flex flex-wrap flex-fill flex-column flex-sm-row">
|
<span class="d-flex flex-wrap flex-fill flex-column flex-sm-row">
|
||||||
|
@ -48,3 +51,5 @@
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -162,24 +162,26 @@ else
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@if (!Model.LightningEnabled)
|
@if (Model.LightningSupported) {
|
||||||
{
|
if (!Model.LightningEnabled)
|
||||||
<a asp-controller="UIStores" asp-action="SetupLightningNode" asp-route-storeId="@Model.StoreId" asp-route-cryptoCode="@Model.CryptoCode" id="SetupGuide-Lightning" class="list-group-item list-group-item-action d-flex align-items-center order-1">
|
{
|
||||||
<vc:icon symbol="new-wallet"/>
|
<a asp-controller="UIStores" asp-action="SetupLightningNode" asp-route-storeId="@Model.StoreId" asp-route-cryptoCode="@Model.CryptoCode" id="SetupGuide-Lightning" class="list-group-item list-group-item-action d-flex align-items-center order-1">
|
||||||
<div class="content">
|
<vc:icon symbol="new-wallet"/>
|
||||||
<h5 class="mb-0">Set up a Lightning node</h5>
|
<div class="content">
|
||||||
|
<h5 class="mb-0">Set up a Lightning node</h5>
|
||||||
|
</div>
|
||||||
|
<vc:icon symbol="caret-right"/>
|
||||||
|
</a>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<div class="list-group-item d-flex align-items-center" id="SetupGuide-LightningDone">
|
||||||
|
<vc:icon symbol="done"/>
|
||||||
|
<div class="content">
|
||||||
|
<h5 class="mb-0 text-success">Set up a Lightning node</h5>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<vc:icon symbol="caret-right"/>
|
}
|
||||||
</a>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<div class="list-group-item d-flex align-items-center" id="SetupGuide-LightningDone">
|
|
||||||
<vc:icon symbol="done"/>
|
|
||||||
<div class="content">
|
|
||||||
<h5 class="mb-0 text-success">Set up a Lightning node</h5>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue