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

@ -3,16 +3,17 @@
"Docker-Regtest": { "Docker-Regtest": {
"commandName": "Project", "commandName": "Project",
"launchBrowser": true, "launchBrowser": true,
"environmentVariables": { "environmentVariables": {
"BTCPAY_NETWORK": "regtest", "BTCPAY_NETWORK": "regtest",
"BTCPAY_LTCEXPLORERURL": "http://127.0.0.1:32838/", "BTCPAY_LTCEXPLORERURL": "http://127.0.0.1:32838/",
"BTCPAY_BTCEXPLORERURL": "http://127.0.0.1:32838/", "BTCPAY_BTCEXPLORERURL": "http://127.0.0.1:32838/",
"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_POSTGRES": "User ID=postgres;Host=127.0.0.1;Port=39372;Database=btcpayserver", //"BTCPAY_BTCLIGHTNING": "type=lnd-rest;server=https://lnd:lnd@127.0.0.1:53280/;allowinsecure=true",
"BTCPAY_BUNDLEJSCSS": "false" "BTCPAY_POSTGRES": "User ID=postgres;Host=127.0.0.1;Port=39372;Database=btcpayserver",
}, "BTCPAY_BUNDLEJSCSS": "false"
},
"applicationUrl": "http://127.0.0.1:14142/" "applicationUrl": "http://127.0.0.1:14142/"
} }
} }

View File

@ -31,49 +31,59 @@
<div class="form-group"> <div class="form-group">
@if(Model.QRCode == null) @if(Model.QRCode == null)
{ {
<form method="post"> <div class="form-group">
<button type="submit" class="btn btn-primary">Show QR Code</button> <form method="post">
</form> <button type="submit" class="btn btn-primary">Show QR Code</button>
</form>
</div>
} }
else else
{
<div id="qrCode"></div>
<div id="qrCodeData" data-url="@Html.Raw(Model.QRCode)"></div>
}
</div>
<div class="form-group">
<h5>More details...</h5>
<p>Alternatively, you can see the settings by clicking <a href="#details" data-toggle="collapse">here</a></p>
</div>
<div id="details" class="collapse">
<div class="form-group">
<label asp-for="Host"></label>
<input asp-for="Host" readonly class="form-control" />
</div>
<div class="form-group">
<label asp-for="Port"></label>
<input asp-for="Port" readonly class="form-control" />
</div>
<div class="form-group">
<label asp-for="SSL"></label>
<input asp-for="SSL" disabled type="checkbox" class="form-check-inline" />
</div>
@if(Model.Macaroon != null)
{ {
<div class="form-group"> <div class="form-group">
<label asp-for="Macaroon"></label> <div id="qrCode"></div>
<input asp-for="Macaroon" readonly class="form-control" /> <div id="qrCodeData" data-url="@Html.Raw(Model.QRCode)"></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>
} }
@if(Model.CertificateThumbprint != null)
{
<div class="form-group">
<h5>More details...</h5>
<p>Alternatively, you can see the settings by clicking <a href="#details" data-toggle="collapse">here</a></p>
</div>
<div id="details" class="collapse">
<div class="form-group"> <div class="form-group">
<label asp-for="CertificateThumbprint"></label> <label asp-for="Host"></label>
<input asp-for="CertificateThumbprint" readonly class="form-control" /> <input asp-for="Host" readonly class="form-control" />
</div> </div>
} <div class="form-group">
<label asp-for="SSL"></label>
<input asp-for="SSL" disabled type="checkbox" class="form-check-inline" />
</div>
@if(Model.Macaroon != null)
{
<div class="form-group">
<label asp-for="Macaroon"></label>
<input asp-for="Macaroon" readonly class="form-control" />
</div>
}
@if(Model.CertificateThumbprint != null)
{
<div class="form-group">
<label asp-for="CertificateThumbprint"></label>
<input asp-for="CertificateThumbprint" readonly class="form-control" />
</div>
}
</div>
</div> </div>
</div> </div>
</div> </div>