mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 22:14:26 +01:00
UI: Move section navigation to sidebar (#5744)
* UI: Move section navigation to sidebar * Scroll active nav link into view * Move CTAs to top right * Server Settings: Make Policies first page * Responsive table fixes * Spacing fixes * Add breadcrumb samples * store settings fixes * payment request fixes * updates pull payment title * adds invoice detail fix * updates server settings breadcrumbs + copy fix * Don't open Server Settings on Plugins page * Add breadcrumbs to pull payment views * adds breadcrumbs to account * server and store breadcrumb fixes * fixes access tokens * Fix payment processor breadcrumbs * fixes webhook 404 * Final touches * Fix test * Add breadcrumb for email rules page * Design system updates --------- Co-authored-by: dstrukt <gfxdsign@gmail.com>
This commit is contained in:
@@ -246,16 +246,27 @@ public partial class UIStoresController
|
||||
}
|
||||
|
||||
var network = _explorerProvider.GetNetwork(vm.CryptoCode);
|
||||
var lnId = PaymentTypes.LN.GetPaymentMethodId(network.CryptoCode);
|
||||
var lnurlId = PaymentTypes.LNURL.GetPaymentMethodId(network.CryptoCode);
|
||||
|
||||
var lightning = GetConfig<LightningPaymentMethodConfig>(lnId, store);
|
||||
if (lightning == null)
|
||||
return NotFound();
|
||||
|
||||
var needUpdate = false;
|
||||
var blob = store.GetStoreBlob();
|
||||
blob.LightningDescriptionTemplate = vm.LightningDescriptionTemplate ?? string.Empty;
|
||||
blob.LightningAmountInSatoshi = vm.LightningAmountInSatoshi;
|
||||
blob.LightningPrivateRouteHints = vm.LightningPrivateRouteHints;
|
||||
blob.OnChainWithLnInvoiceFallback = vm.OnChainWithLnInvoiceFallback;
|
||||
var lnurlId = PaymentTypes.LNURL.GetPaymentMethodId(vm.CryptoCode);
|
||||
blob.SetExcluded(lnurlId, !vm.LNURLEnabled);
|
||||
|
||||
// Lightning
|
||||
blob.SetExcluded(lnId, !vm.Enabled);
|
||||
|
||||
// LNURL
|
||||
blob.SetExcluded(lnurlId, !vm.LNURLEnabled || !vm.Enabled);
|
||||
|
||||
var lnurl = GetConfig<LNURLPaymentMethodConfig>(PaymentTypes.LNURL.GetPaymentMethodId(vm.CryptoCode), store);
|
||||
var lnurl = GetConfig<LNURLPaymentMethodConfig>(lnurlId, store);
|
||||
if (lnurl is null || (
|
||||
lnurl.UseBech32Scheme != vm.LNURLBech32Mode ||
|
||||
lnurl.LUD12Enabled != vm.LUD12Enabled))
|
||||
@@ -284,36 +295,6 @@ public partial class UIStoresController
|
||||
return RedirectToAction(nameof(LightningSettings), new { vm.StoreId, vm.CryptoCode });
|
||||
}
|
||||
|
||||
[HttpPost("{storeId}/lightning/{cryptoCode}/status")]
|
||||
[Authorize(Policy = Policies.CanModifyStoreSettings, AuthenticationSchemes = AuthenticationSchemes.Cookie)]
|
||||
public async Task<IActionResult> SetLightningNodeEnabled(string storeId, string cryptoCode, bool enabled)
|
||||
{
|
||||
var store = HttpContext.GetStoreData();
|
||||
if (store == null)
|
||||
return NotFound();
|
||||
|
||||
var network = _explorerProvider.GetNetwork(cryptoCode);
|
||||
if (network == null)
|
||||
return NotFound();
|
||||
|
||||
var lightning = GetConfig<LightningPaymentMethodConfig>(PaymentTypes.LN.GetPaymentMethodId(cryptoCode), store);
|
||||
if (lightning == null)
|
||||
return NotFound();
|
||||
|
||||
var paymentMethodId = PaymentTypes.LN.GetPaymentMethodId(network.CryptoCode);
|
||||
var storeBlob = store.GetStoreBlob();
|
||||
storeBlob.SetExcluded(paymentMethodId, !enabled);
|
||||
if (!enabled)
|
||||
{
|
||||
storeBlob.SetExcluded(PaymentTypes.LNURL.GetPaymentMethodId(network.CryptoCode), true);
|
||||
}
|
||||
store.SetStoreBlob(storeBlob);
|
||||
await _storeRepo.UpdateStore(store);
|
||||
TempData[WellKnownTempData.SuccessMessage] = $"{network.CryptoCode} Lightning payments are now {(enabled ? "enabled" : "disabled")} for this store.";
|
||||
|
||||
return RedirectToAction(nameof(LightningSettings), new { storeId, cryptoCode });
|
||||
}
|
||||
|
||||
private bool CanUseInternalLightning(string cryptoCode)
|
||||
{
|
||||
return _lightningNetworkOptions.InternalLightningByCryptoCode.ContainsKey(cryptoCode.ToUpperInvariant()) && (User.IsInRole(Roles.ServerAdmin) || _policiesSettings.AllowLightningInternalNodeForAll);
|
||||
|
||||
Reference in New Issue
Block a user