Merge pull request #1585 from btcpayserver/feat/private-route-hints

Adding private route hints based on store settings
This commit is contained in:
Nicolas Dorier
2020-05-20 08:10:08 +09:00
committed by GitHub
6 changed files with 17 additions and 3 deletions

View File

@@ -31,7 +31,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="BTCPayServer.Hwi" Version="1.1.3" />
<PackageReference Include="BTCPayServer.Lightning.All" Version="1.1.13" />
<PackageReference Include="BTCPayServer.Lightning.All" Version="1.1.15" />
<PackageReference Include="BuildBundlerMinifier" Version="3.2.435" />
<PackageReference Include="BundlerMinifier.Core" Version="3.2.435" />
<PackageReference Include="BundlerMinifier.TagHelpers" Version="3.2.435" />

View File

@@ -381,6 +381,7 @@ namespace BTCPayServer.Controllers
vm.OnChainMinValue = storeBlob.OnChainMinValue?.ToString() ?? "";
vm.LightningMaxValue = storeBlob.LightningMaxValue?.ToString() ?? "";
vm.LightningAmountInSatoshi = storeBlob.LightningAmountInSatoshi;
vm.LightningPrivateRouteHints = storeBlob.LightningPrivateRouteHints;
vm.RedirectAutomatically = storeBlob.RedirectAutomatically;
return View(vm);
}
@@ -441,6 +442,7 @@ namespace BTCPayServer.Controllers
blob.OnChainMinValue = onchainMinValue;
blob.LightningMaxValue = lightningMaxValue;
blob.LightningAmountInSatoshi = model.LightningAmountInSatoshi;
blob.LightningPrivateRouteHints = model.LightningPrivateRouteHints;
blob.RedirectAutomatically = model.RedirectAutomatically;
if (CurrentStore.SetStoreBlob(blob))
{

View File

@@ -92,6 +92,7 @@ namespace BTCPayServer.Data
[JsonConverter(typeof(CurrencyValueJsonConverter))]
public CurrencyValue LightningMaxValue { get; set; }
public bool LightningAmountInSatoshi { get; set; }
public bool LightningPrivateRouteHints { get; set; }
public string CustomCSS { get; set; }
public string CustomLogo { get; set; }

View File

@@ -63,7 +63,10 @@ namespace BTCPayServer.Models.StoreViewModels
[Display(Name = "Display lightning payment amounts in Satoshis")]
public bool LightningAmountInSatoshi { get; set; }
[Display(Name = "Add hop hints for private channels to the lightning invoice")]
public bool LightningPrivateRouteHints { get; set; }
[Display(Name = "Redirect invoice to redirect url automatically after paid")]
public bool RedirectAutomatically { get; set; }
}

View File

@@ -65,7 +65,9 @@ namespace BTCPayServer.Payments.Lightning
{
try
{
lightningInvoice = await client.CreateInvoice(new LightMoney(due, LightMoneyUnit.BTC), description, expiry, cts.Token);
var request = new CreateInvoiceParams(new LightMoney(due, LightMoneyUnit.BTC), description, expiry);
request.PrivateRouteHints = storeBlob.LightningPrivateRouteHints;
lightningInvoice = await client.CreateInvoice(request, cts.Token);
}
catch (OperationCanceledException) when (cts.IsCancellationRequested)
{

View File

@@ -81,6 +81,12 @@
<label asp-for="LightningAmountInSatoshi" class="form-check-label"></label>
<span asp-validation-for="LightningAmountInSatoshi" class="text-danger"></span>
</div>
<div class="form-check">
<input asp-for="LightningPrivateRouteHints" type="checkbox" class="form-check-input" />
<label asp-for="LightningPrivateRouteHints" class="form-check-label"></label>
<span asp-validation-for="LightningPrivateRouteHints" class="text-danger"></span>
</div>
<div class="form-check">
<input asp-for="RedirectAutomatically" type="checkbox" class="form-check-input" />
<label asp-for="RedirectAutomatically" class="form-check-label"></label>