Files
BTCPayServerPlugins/Plugins/BTCPayServer.Plugins.Wabisabi/Views/WabisabiCoordinatorConfig/UpdateWabisabiSettings.cshtml
2024-06-21 13:19:09 +02:00

116 lines
5.3 KiB
Plaintext

@using BTCPayServer.Plugins.Wabisabi
@using NNostr.Client
@using NNostr.Client.Protocols
@using WalletWasabi.Backend.Controllers
@model WalletWasabi.Backend.Controllers.WabisabiCoordinatorSettings
@inject WabisabiCoordinatorService WabisabiCoordinatorService
@{
Layout = "../Shared/_NavLayout.cshtml";
ViewData["NavPartialName"] = "../UIServer/_Nav";
}
<form method="post">
<div class="d-flex align-items-center justify-content-between mb-3">
<h3 class="mb-0">
<span>Coinjoin coordinator</span>
<a href="https://docs.btcpayserver.org/Wabisabi" target="_blank" rel="noreferrer noopener" title="More information...">
<vc:icon symbol="info"/>
</a>
</h3>
<button name="command" type="submit" value="save" class="btn btn-primary mt-3 mt-sm-0">Save</button>
</div>
<div class="row">
<div class="col-xxl-constrain col-xl-8">
<div class="form-group form-check">
<label asp-for="Enabled" class="form-check-label">Enable Coordinator</label>
<input asp-for="Enabled" type="checkbox" class="form-check-input" />
</div>
<div class="form-group pt-3">
<label class="form-label" for="config">Config</label>
@if (ViewData.ModelState.TryGetValue("config", out var error) && error.Errors.Any())
{
<span class="text-danger">@string.Join("\n", error.Errors.Select(modelError => modelError.ErrorMessage))</span>
}
<textarea rows="10" cols="40" class="form-control" id="config" name="config" >
@Html.Raw(ViewBag.Config)
</textarea>
</div>
<div class="form-group pt-3">
<label class="form-label" for="config">Terms & Conditions </label>
<textarea rows="10" cols="40" class="form-control " asp-for="TermsConditions" >
</textarea>
</div>
<div class="form-group pt-3">
<label class="form-label" for="config">Coordinator endpoint redirect</label>
<input asp-for="ForwardEndpoint" type="url" class="form-control"/>
<p>When someone enters your coordinator endpoint, forward to this url (except for coinjoin endpoints).</p>
</div>
</div>
<div class="col-xxl-constrain col-xl-4">
<h3 class="mb-3">Publish to Nostr </h3>
<div class="form-group ">
<label asp-for="NostrRelay" class="form-label">Nostr Relay</label>
<input asp-for="NostrRelay" type="text" class="form-control" />
</div>
<div class="form-group">
<label asp-for="NostrIdentity" class="form-label">nostr privkey</label>
<div class="input-group input-group-sm">
<input asp-for="NostrIdentity" type="text" class="form-control" />
<button name="command" value="generate-nostr-key" type="submit" class="btn btn-secondary btn-sm">Generate</button>
</div>
</div>
@if(WabisabiCoordinatorService.Started && WabisabiCoordinatorService.WabisabiApiServer != null && Model.NostrRelay is not null && Model.NostrIdentity is not null)
{
var nprofile = new NIP19.NosteProfileNote()
{
PubKey = Model.GetPubKey().ToHex(),
Relays = new[] {Model.NostrRelay.ToString()}
}.ToNIP19();
<div class="form-group mt-4" >
<label class="form-label">EXPERIMENTAL: NOSTR COORDINATOR ENDPOINT ACTIVE</label>
<div class="input-group">
<input type="text" id="ss-result-txt" class="form-control" readonly="readonly" value="nostr:@nprofile"/>
<button type="button" class="btn btn-secondary" data-clipboard-target="#ss-result-txt">
<vc:icon symbol="copy"/>
</button> <button type="button" class="btn btn-secondary" id="advertise-nostr" onclick="document.getElementById('UriToAdvertise').value='nostr:@nprofile'">
Set as url to advertise
</button>
</div>
<p id="ss-result-additional-info"></p>
</div>
}
<div class="form-group">
<label asp-for="CoordinatorDescription" class="form-label">Description</label>
<textarea asp-for="CoordinatorDescription" class="form-control"></textarea>
</div>
<div class="form-group">
<label asp-for="UriToAdvertise" class="form-label">What url to advertise? </label>
<div class="input-group input-group-sm">
<input asp-for="UriToAdvertise" type="text" class="form-control" />
<button name="command" value="nostr-current-url" type="submit" class="btn btn-secondary btn-sm">Use current url</button>
</div>
</div>
</div>
</div>
<p class=" alert alert-warning" style="white-space: pre-line">
@WabisabiCoordinatorConfigController.OurDisclaimer
</p>
</form>
@section PageFootContent {
<partial name="_ValidationScriptsPartial" />
}