btcpayserver/BTCPayServer/Views/Stores/AddLightningNode.cshtml
d11n 76985838c4
Improve Lightning setup page (#2348)
* Redesign Lightning setup page

* Improve Lightning setup page

Closes #1811.

* Test fix

* Fix LightningNetworkPaymentMethodAPITests

* Bootstrap customization fix
2021-03-31 20:23:36 +09:00

126 lines
7 KiB
Text

@model LightningNodeViewModel
@{
Layout = "../Shared/_NavLayout.cshtml";
ViewData.SetActivePageAndTitle(StoreNavPages.Index, "Add lightning node");
}
<partial name="_StatusMessage" />
<div class="alert alert-warning alert-dismissible mb-5" role="alert">
<p class="mb-0">
Please understand that the Lightning Network is still under active development and considered experimental.
Before you proceed, take time to familiarize yourself with the risks.
<a href="https://docs.btcpayserver.org/LightningNetwork/" class="alert-link">More information</a>
</p>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<style>
#CustomSetup { display: none; }
#LightningNodeType-Custom:checked + * + #CustomSetup { display: block; }
</style>
<form method="post">
<div class="form-group">
<div class="custom-control custom-radio">
<input asp-for="LightningNodeType" value="@LightningNodeType.Internal" type="radio" id="LightningNodeType-@LightningNodeType.Internal" class="custom-control-input" disabled="@(!Model.CanUseInternalNode)">
<label asp-for="LightningNodeType" for="@($"LightningNodeType-{LightningNodeType.Internal}")" class="custom-control-label">Use the internal Lightning node</label>
</div>
</div>
<div class="form-group">
<div class="custom-control custom-radio">
<input asp-for="LightningNodeType" value="@LightningNodeType.Custom" type="radio" id="LightningNodeType-@LightningNodeType.Custom" class="custom-control-input">
<label asp-for="LightningNodeType" for="@($"LightningNodeType-{LightningNodeType.Custom}")" class="custom-control-label">Use a custom Lightning node <span class="text-muted">(requires connection string)</span></label>
<div id="CustomSetup">
<div class="form-group my-3">
<label asp-for="ConnectionString">The connection string configuration for your custom Lightning node:</label>
<input asp-for="ConnectionString" class="form-control" placeholder="type=…;server=…;" value="@(Model.LightningNodeType == LightningNodeType.Internal ? "" : Model.ConnectionString)" />
<span asp-validation-for="ConnectionString" class="text-danger"></span>
</div>
<p class="mt-4 mb-2">BTCPay Server currently supports:</p>
<ul>
<li class="mb-2">
<strong>c-lightning</strong> via TCP or unix domain socket connection:
<ul>
<li>
<code><b>type=</b>clightning;<b>server=</b>unix://root/.lightning/lightning-rpc</code>
</li>
<li>
<code><b>type=</b>clightning;<b>server=</b>tcp://1.1.1.1:27743/</code>
</li>
</ul>
</li>
<li class="mb-2">
<strong>Lightning Charge</strong> via HTTPS:
<ul>
<li>
<code><b>type=</b>charge;<b>server=</b>https://charge:8080/;<b>api-token=</b>myapitoken...</code>
</li>
</ul>
</li>
<li class="mb-2">
<strong>Eclair</strong> via HTTPS:
<ul>
<li>
<code><b>type=</b>eclair;<b>server=</b>https://eclair:8080/;<b>password=</b>eclairpassword...</code>
</li>
</ul>
</li>
<li class="mb-2">
<strong>LND</strong> via the REST proxy:
<ul>
<li>
<code><b>type=</b>lnd-rest;<b>server=</b>https://mylnd:8080/;<b>macaroon=</b>abef263adfe...</code>
</li>
<li>
<code><b>type=</b>lnd-rest;<b>server=</b>https://mylnd:8080/;<b>macaroon=</b>abef263adfe...;<b>certthumbprint=</b>abef263adfe...</code>
</li>
</ul>
<a class="d-inline-block my-2 text-secondary text-decoration-none" data-toggle="collapse" href="#lnd-notes" role="button" aria-expanded="false" aria-controls="lnd-notes">
<span class="fa fa-question-circle-o" title="More information..."></span> More information on the LND settings
</a>
<div class="collapse" id="lnd-notes">
<div class="card card-body">
<p>For the macaroon options you need to provide the <code>admin.macaroon</code>.</p>
<p>The path to the LND data directory may vary, the following example assume <code>/root/.lnd</code>.</p>
<p class="mb-2">The <code>macaroon</code> parameter expects the HEX value, it can be obtained using this command:</p>
<pre class="mb-4">xxd -plain /root/.lnd/data/chain/bitcoin/mainnet/admin.macaroon | tr -d '\n'</pre>
<p>You can omit <code>certthumbprint</code> if the certificate is trusted by your machine.</p>
<p class="mb-2">The <code>certthumbprint</code> can be obtained using this command:</p>
<pre class="mb-4">openssl x509 -noout -fingerprint -sha256 -in /root/.lnd/tls.cert | sed -e 's/.*=//;s/://g'</pre>
<p class="mb-0">If your LND REST server is using HTTP or HTTPS with an untrusted certificate, you can set <code>allowinsecure=true</code> as a fallback.</p>
</div>
</div>
</li>
</ul>
</div>
</div>
</div>
<div class="form-group mt-4 mb-5">
<label asp-for="Enabled" class="form-check-label"></label>
<input asp-for="Enabled" type="checkbox" class="btcpay-toggle ml-2" />
</div>
<div>
<button id="save" name="command" type="submit" value="save" class="btn btn-primary mr-2">Submit</button>
<button id="test" name="command" type="submit" value="test" class="btn btn-secondary mr-3">Test connection</button>
<a class="text-secondary"
asp-controller="PublicLightningNodeInfo"
asp-action="ShowLightningNodeInfo"
asp-route-cryptoCode="@Model.CryptoCode"
asp-route-storeId="@Model.StoreId"
target="_blank">
<span class="fa fa-info-circle" title="More information..."></span>
Open Public Node Info Page
</a>
</div>
</form>
@section Scripts {
@await Html.PartialAsync("_ValidationScriptsPartial")
}