btcpayserver/BTCPayServer/Views/Wallets/WalletSettings.cshtml
Andrew Camilleri 8ca2824b00
Open wallet with BIP21 links (#1565)
* Open wallet with BIP21 links

https://i.imgur.com/IWefMKB.gifv

* remove debugger;

* Move to settings
2020-05-12 22:32:33 +09:00

117 lines
5.2 KiB
Plaintext

@model WalletSettingsViewModel
@{
Layout = "../Shared/_NavLayout.cshtml";
ViewData["Title"] = "Wallet settings";
ViewData.SetActivePageAndTitle(WalletsNavPages.Settings);
}
@if (TempData.HasStatusMessage())
{
<div class="row">
<div class="col-md-10 text-center">
<partial name="_StatusMessage" />
</div>
</div>
}
<div class="row">
<div class="col-md-10">
<p>
Additional information about your wallet
</p>
</div>
</div>
<div class="row">
<div class="col-md-6">
<form method="post" asp-action="WalletSettings">
<input type="hidden" asp-for="StoreName"/>
<input type="hidden" asp-for="UriScheme"/>
<div class="form-group">
<label asp-for="Label"></label>
<input asp-for="Label" class="form-control"/>
<span asp-validation-for="Label" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="DerivationScheme"></label>
<input asp-for="DerivationScheme" class="form-control" readonly/>
<span asp-validation-for="DerivationScheme" class="text-danger"></span>
</div>
@if (!string.IsNullOrEmpty(Model.DerivationSchemeInput) && Model.DerivationSchemeInput != Model.DerivationScheme)
{
<div class="form-group">
<label asp-for="DerivationSchemeInput"></label>
<input asp-for="DerivationSchemeInput" class="form-control" readonly/>
<span asp-validation-for="DerivationSchemeInput" class="text-danger"></span>
</div>
}
@for (int i = 0; i < Model.AccountKeys.Count; i++)
{
<hr/>
<h5>Account key @i</h5>
<div class="form-group">
<label asp-for="@Model.AccountKeys[i].AccountKey"></label>
<input asp-for="@Model.AccountKeys[i].AccountKey" class="form-control" readonly/>
<span asp-validation-for="@Model.AccountKeys[i].AccountKey" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="@Model.AccountKeys[i].MasterFingerprint"></label>
<input asp-for="@Model.AccountKeys[i].MasterFingerprint" class="form-control"/>
<span asp-validation-for="@Model.AccountKeys[i].MasterFingerprint" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="@Model.AccountKeys[i].AccountKeyPath"></label>
<input asp-for="@Model.AccountKeys[i].AccountKeyPath" class="form-control"/>
<span asp-validation-for="@Model.AccountKeys[i].AccountKeyPath" class="text-danger"></span>
</div>
@if (Model.IsMultiSig)
{
<div class="form-group">
<label asp-for="SelectedSigningKey"></label>
<input asp-for="SelectedSigningKey" type="radio" value="@Model.AccountKeys[i].AccountKey"/>
</div>
}
}
<div class="form-group d-flex mt-2">
<button name="command" type="submit" class="btn btn-primary" value="save">Save</button>
<div class="dropdown">
<button class="ml-1 btn btn-secondary dropdown-toggle" type="button" id="SettingsMenu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Other actions...
</button>
<div class="dropdown-menu" aria-labelledby="SendMenu">
<button name="command" type="submit" class="dropdown-item" value="prune">Prune old transactions from history</button>
@if (Model.NBXSeedAvailable)
{
<button name="command" type="submit" class="dropdown-item" value="view-seed">View seed</button>
}
@if (Model.UriScheme == "bitcoin")
{
<button type="button" class="dropdown-item register-wallet" data-storename="@Model.StoreName" data-scheme="@Model.UriScheme" data-url="@Url.Action("WalletSend", "Wallets", new {walletId = Context.GetRouteValue("walletId"), bip21 = "%s"})">Open this bitcoin wallet on payment links</button>
}
</div>
</div>
</div>
</form>
</div>
</div>
<script>
$(document).ready(function(){
if(navigator.registerProtocolHandler){
$(".register-wallet")
.show()
.on("click", function(){
var store = $(this).data("storename");
var scheme = $(this).data("scheme");
var url = decodeURIComponent($(this).data("url"));
navigator.registerProtocolHandler(scheme, url, "BTCPay Wallet -" + store);
});
}
});
</script>
<style>
.register-wallet{
display: none;
}
</style>