Service page for LND Seed Backup

This commit is contained in:
rockstardev 2019-11-04 22:04:35 -06:00
parent b75eaee6dd
commit 2b1aac9aa9
6 changed files with 66 additions and 2 deletions

View file

@ -154,6 +154,9 @@
<Content Update="Views\Server\LightningWalletServices.cshtml">
<Pack>$(IncludeRazorContentInPack)</Pack>
</Content>
<Content Update="Views\Server\LndSeedBackup.cshtml">
<Pack>$(IncludeRazorContentInPack)</Pack>
</Content>
<Content Update="Views\Server\RPCService.cshtml">
<Pack>$(IncludeRazorContentInPack)</Pack>
</Content>
@ -220,4 +223,4 @@
<Pack>$(IncludeRazorContentInPack)</Pack>
</Content>
</ItemGroup>
</Project>
</Project>

View file

@ -24,6 +24,10 @@ namespace BTCPayServer.Configuration
"lnd server: 'server=https://lnd.example.com;macaroondirectorypath=/root/.lnd;certthumbprint=2abdf302...'" + Environment.NewLine +
"Error: {1}",
"LND (REST server)");
Load(configuration, cryptoCode, "lndseedbackup", ExternalServiceTypes.LNDSeedBackup, "Invalid setting {0}, " + Environment.NewLine +
"lnd seed backup: /etc/merchant_lnd/data/chain/bitcoin/regtest/walletunlock.json'" + Environment.NewLine +
"Error: {1}",
"LND Seed Backup");
Load(configuration, cryptoCode, "spark", ExternalServiceTypes.Spark, "Invalid setting {0}, " + Environment.NewLine +
$"Valid example: 'server=https://btcpay.example.com/spark/btc/;cookiefile=/etc/clightning_bitcoin_spark/.cookie'" + Environment.NewLine +
"Error: {1}",
@ -73,6 +77,7 @@ namespace BTCPayServer.Configuration
{
LNDRest,
LNDGRPC,
LNDSeedBackup,
Spark,
RTL,
Charge,

View file

@ -621,6 +621,11 @@ namespace BTCPayServer.Controllers
ServiceLink = service.ConnectionString.Server.AbsoluteUri.WithoutEndingSlash()
});
}
if (service.Type == ExternalServiceTypes.LNDSeedBackup)
{
var model = new LndSeedBackupViewModel();
return View("LndSeedBackup", model);
}
if (service.Type == ExternalServiceTypes.RPC)
{
return View("RPCService", new LightningWalletServices()

View file

@ -0,0 +1,13 @@
using System.ComponentModel.DataAnnotations;
namespace BTCPayServer.Models.ServerViewModels
{
public class LndSeedBackupViewModel
{
public bool IsWalletUnlockPresent { get; set; }
public string WalletPassword { get; set; }
public string[] Seed { get; set; }
}
}

View file

@ -11,7 +11,7 @@
"BTCPAY_BTCLIGHTNING": "type=charge;server=http://127.0.0.1:54938/;api-token=foiewnccewuify",
"BTCPAY_BTCEXTERNALLNDGRPC": "type=lnd-grpc;server=https://lnd:lnd@127.0.0.1:53280/;allowinsecure=true",
"BTCPAY_BTCEXTERNALLNDREST": "type=lnd-rest;server=https://lnd:lnd@127.0.0.1:53280/lnd-rest/btc/;allowinsecure=true;macaroonfilepath=D:\\admin.macaroon",
"BTCPAY_BTCLNDSEEDPATH": "/etc/merchant_lnd/data/chain/bitcoin/regtest/walletunlock.json",
"BTCPAY_BTCEXTERNALLNDSEEDBACKUP": "/etc/merchant_lnd/data/chain/bitcoin/regtest/walletunlock.json",
"BTCPAY_BTCEXPLORERURL": "http://127.0.0.1:32838/",
"BTCPAY_ALLOW-ADMIN-REGISTRATION": "true",
"BTCPAY_DISABLE-REGISTRATION": "false",

View file

@ -0,0 +1,38 @@
@model LndSeedBackupViewModel
@{
ViewData.SetActivePageAndTitle(ServerNavPages.Services);
}
<h4>LND Seed Backup</h4>
<partial name="_StatusMessage" />
<div class="row">
<div class="col-md-6">
<div asp-validation-summary="All" class="text-danger"></div>
</div>
</div>
<div class="row">
<div class="col-md-8">
<div class="form-group">
@if (Model.IsWalletUnlockPresent)
{
<p>Unlock file is present... here are details</p>
<p>Wallet Password: @Model.WalletPassword</p>
<p>Seed: @String.Join(',', Model.Seed)</p>
}
else
{
<p>
You don't have LND unlock file, which means you need to migrate to new version of LND docker container.
<a href="https://github.com/btcpayserver/lnd/pull/4" target="_blank">More information</a>
</p>
}
</div>
</div>
</div>
@section Scripts {
}