Add QR code information

This commit is contained in:
nicolas.dorier 2018-07-22 21:28:21 +09:00
parent 4f8e0b0393
commit 648829644a
5 changed files with 61 additions and 50 deletions

View File

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework> <TargetFramework>netcoreapp2.1</TargetFramework>
<Version>1.0.2.54</Version> <Version>1.0.2.55</Version>
<NoWarn>NU1701,CA1816,CA1308,CA1810,CA2208</NoWarn> <NoWarn>NU1701,CA1816,CA1308,CA1810,CA2208</NoWarn>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -298,8 +298,7 @@ namespace BTCPayServer.Controllers
var model = new LNDGRPCServicesViewModel(); var model = new LNDGRPCServicesViewModel();
var external = GetExternalLNDConnectionString(connectionString); var external = GetExternalLNDConnectionString(connectionString);
model.Host = external.BaseUri.DnsSafeHost; model.Host = $"{external.BaseUri.DnsSafeHost}:{external.BaseUri.Port}";
model.Port = external.BaseUri.Port;
model.SSL = external.BaseUri.Scheme == "https"; model.SSL = external.BaseUri.Scheme == "https";
if (external.CertificateThumbprint != null) if (external.CertificateThumbprint != null)
{ {
@ -314,7 +313,8 @@ namespace BTCPayServer.Controllers
var lnConfig = _LnConfigProvider.GetConfig(secret.Value); var lnConfig = _LnConfigProvider.GetConfig(secret.Value);
if (lnConfig != null) if (lnConfig != null)
{ {
model.QRCode = $"config={this.Request.GetAbsoluteRoot().WithTrailingSlash()}lnd-config/{secret.Value}/lnd.config"; model.QRCodeLink = $"{this.Request.GetAbsoluteRoot().WithTrailingSlash()}lnd-config/{secret.Value}/lnd.config";
model.QRCode = $"config={model.QRCodeLink}";
} }
} }
return View(model); return View(model);

View File

@ -8,10 +8,10 @@ namespace BTCPayServer.Models.ServerViewModels
public class LNDGRPCServicesViewModel public class LNDGRPCServicesViewModel
{ {
public string Host { get; set; } public string Host { get; set; }
public int Port { get; set; }
public bool SSL { get; set; } public bool SSL { get; set; }
public string Macaroon { get; set; } public string Macaroon { get; set; }
public string CertificateThumbprint { get; set; } public string CertificateThumbprint { get; set; }
public string QRCode { get; set; } public string QRCode { get; set; }
public string QRCodeLink { get; set; }
} }
} }

View File

@ -10,6 +10,7 @@
"ASPNETCORE_ENVIRONMENT": "Development", "ASPNETCORE_ENVIRONMENT": "Development",
"BTCPAY_CHAINS": "btc,ltc", "BTCPAY_CHAINS": "btc,ltc",
"BTCPAY_BTCLIGHTNING": "http://api-token:foiewnccewuify@127.0.0.1:54938/", "BTCPAY_BTCLIGHTNING": "http://api-token:foiewnccewuify@127.0.0.1:54938/",
//"BTCPAY_BTCLIGHTNING": "type=lnd-rest;server=https://lnd:lnd@127.0.0.1:53280/;allowinsecure=true",
"BTCPAY_POSTGRES": "User ID=postgres;Host=127.0.0.1;Port=39372;Database=btcpayserver", "BTCPAY_POSTGRES": "User ID=postgres;Host=127.0.0.1;Port=39372;Database=btcpayserver",
"BTCPAY_BUNDLEJSCSS": "false" "BTCPAY_BUNDLEJSCSS": "false"
}, },

View File

@ -31,17 +31,30 @@
<div class="form-group"> <div class="form-group">
@if(Model.QRCode == null) @if(Model.QRCode == null)
{ {
<div class="form-group">
<form method="post"> <form method="post">
<button type="submit" class="btn btn-primary">Show QR Code</button> <button type="submit" class="btn btn-primary">Show QR Code</button>
</form> </form>
</div>
} }
else else
{ {
<div class="form-group">
<div id="qrCode"></div> <div id="qrCode"></div>
<div id="qrCodeData" data-url="@Html.Raw(Model.QRCode)"></div> <div id="qrCodeData" data-url="@Html.Raw(Model.QRCode)"></div>
}
</div> </div>
<p>See QR Code information by clicking <a href="#detailsQR" data-toggle="collapse">here</a></p>
<div id="detailsQR" class="collapse">
<div class="form-group">
<label>QR Code data</label>
<input asp-for="QRCode" readonly class="form-control" />
</div>
<div class="form-group">
Click <a href="@Model.QRCodeLink" target="_blank">here</a> to open the configuration file.
</div>
</div>
}
<div class="form-group"> <div class="form-group">
<h5>More details...</h5> <h5>More details...</h5>
@ -52,10 +65,6 @@
<label asp-for="Host"></label> <label asp-for="Host"></label>
<input asp-for="Host" readonly class="form-control" /> <input asp-for="Host" readonly class="form-control" />
</div> </div>
<div class="form-group">
<label asp-for="Port"></label>
<input asp-for="Port" readonly class="form-control" />
</div>
<div class="form-group"> <div class="form-group">
<label asp-for="SSL"></label> <label asp-for="SSL"></label>
<input asp-for="SSL" disabled type="checkbox" class="form-check-inline" /> <input asp-for="SSL" disabled type="checkbox" class="form-check-inline" />
@ -76,6 +85,7 @@
} }
</div> </div>
</div> </div>
</div>
</div> </div>
@section Scripts { @section Scripts {