btcpayserver/BTCPayServer/Views/Wallets/WalletSendVault.cshtml
d11n 143d5f69c1
Fix CSP for inline handlers in Safari (#2946)
* Fix CSP for inline handlers on LND seed backup page

* Fix CSP for inline handlers on checkout page

* Fix CSP for inline handlers on wallet sign pages

* Fix CSP for inline handlers on invoices list page

* Fix CSP for inline handlers on payouts page

* Fix CSP for inline handlers on confirm API key page

* Fix CSP for inline handlers on store rates page

* Fix CSP for inline handlers on notifications page

* Fix CSP for inline handlers on dynamic DNS page

* Fix CSP for inline handlers on checkout experience page
2021-10-05 15:52:14 +09:00

75 lines
2.8 KiB
Plaintext

@model WalletSendVaultModel
@{
Layout = "_LayoutWizard";
ViewData.SetActivePageAndTitle(WalletsNavPages.Send, "Sign the transaction", Context.GetStoreData().StoreName);
}
@section Navbar {
<a asp-action="WalletPSBT" asp-route-walletId="@Context.GetRouteValue("walletId")" id="GoBack">
<vc:icon symbol="back" />
</a>
<a asp-action="WalletSend" asp-route-walletId="@Context.GetRouteValue("walletId")" class="cancel">
<vc:icon symbol="close" />
</a>
}
<header class="text-center">
<h1>@ViewData["PageTitle"]</h1>
<p class="lead text-secondary mt-3">Using BTCPay Server Vault</p>
</header>
<div id="walletAlert" class="alert alert-danger alert-dismissible my-4" style="display:none;" role="alert">
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
<vc:icon symbol="close" />
</button>
<span id="alertMessage"></span>
</div>
<div id="body" class="my-4">
<form id="broadcastForm" asp-action="WalletSendVault" asp-route-walletId="@Context.GetRouteValue("walletId")" method="post" style="display:none;">
<input type="hidden" id="WalletId" asp-for="WalletId" />
<input type="hidden" asp-for="WebsocketPath" />
<partial name="SigningContext" for="SigningContext" />
</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>
delegate('click', '#GoBack', () => { history.back(); return false; })
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);
while (!await vaultUI.askForDevice() || !await vaultUI.askSignPSBT({
walletId: $("#WalletId").val(),
psbt: $("#SigningContext_PSBT").val()
})) {
}
$("#SigningContext_PSBT").val(vaultUI.psbt);
$("#broadcastForm").submit();
}
document.addEventListener("DOMContentLoaded", function () {
askSign();
});
</script>
}