mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-01-19 05:33:31 +01:00
65 lines
2.1 KiB
Plaintext
65 lines
2.1 KiB
Plaintext
@using BTCPayServer.Controllers
|
|
@model SetupBoltcardViewModel
|
|
@{
|
|
Layout = "_LayoutWizard";
|
|
}
|
|
|
|
@section Navbar {
|
|
<a href="@Url.EnsureLocal(Model.ReturnUrl, Context.Request)" id="CancelWizard" class="cancel">
|
|
<vc:icon symbol="close" />
|
|
</a>
|
|
}
|
|
|
|
<header class="text-center">
|
|
<h1>@ViewData["Title"]</h1>
|
|
<p class="lead text-secondary mt-3">Using BTCPay Server Vault (NFC)</p>
|
|
</header>
|
|
|
|
<partial name="LocalhostBrowserSupport" />
|
|
|
|
<div id="body" class="my-4">
|
|
<form id="broadcastForm" method="post" style="display:none;">
|
|
<input type="hidden" asp-for="WebsocketPath" />
|
|
<input type="hidden" asp-for="ReturnUrl" />
|
|
</form>
|
|
<div id="vaultPlaceholder"></div>
|
|
<button id="vault-retry" class="btn btn-primary" style="display:none;" type="button">Retry</button>
|
|
<button id="vault-confirm" class="btn btn-primary" style="display:none;"></button>
|
|
</div>
|
|
|
|
<partial name="VaultElements" />
|
|
|
|
@section PageFootContent
|
|
{
|
|
<script src="~/js/vaultbridge.js" type="text/javascript" defer="defer" asp-append-version="true"></script>
|
|
<script src="~/js/vaultbridge.ui.js" type="text/javascript" defer="defer" asp-append-version="true"></script>
|
|
<script>
|
|
function delay(ms) {
|
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
}
|
|
async function askSign() {
|
|
var websocketPath = $("#WebsocketPath").val();
|
|
var loc = window.location, ws_uri;
|
|
if (loc.protocol === "https:") {
|
|
ws_uri = "wss:";
|
|
} else {
|
|
ws_uri = "ws:";
|
|
}
|
|
ws_uri += "//" + loc.host;
|
|
ws_uri += websocketPath;
|
|
var html = $("#VaultConnection").html();
|
|
$("#vaultPlaceholder").html(html);
|
|
var vaultUI = new vaultui.VaultBridgeUI(ws_uri);
|
|
var command = @Safe.Json(Model.Command);
|
|
while (!await vaultUI.sendBackendCommand(command)) {
|
|
await vaultUI.waitRetryPushed();
|
|
}
|
|
await delay(2000);
|
|
$("#broadcastForm").submit();
|
|
}
|
|
document.addEventListener("DOMContentLoaded", function () {
|
|
askSign();
|
|
});
|
|
</script>
|
|
}
|