btcpayserver/BTCPayServer/Views/Server/Policies.cshtml
d11n ed7031981b
Bootstrap v5 migration (#2490)
* Swap bootstrap asset files

* Update themes and color definitions

* Move general bootstrap customizations

* Theme updates

Theme updates

* Remove BuildBundlerMinifier

This lead to an error, because BuildBundlerMinifier and BundlerMinifier.Core seem to conflict here. Details: https://stackoverflow.com/a/61119586

* Rewplace btn-block class with w-100

* Update badge classes

* Remove old font family head variable

* Update margin classes

* Cleanups

* Update float classes

* Update text classes

* Update padding classes

* Update border classes

* UPdate dropdown classes

* Update select classes

* Update neutral custom props

* Update bootstrap and customizations

* Update ChromeDriver; disable smooth scroll

https://github.com/SeleniumHQ/selenium/issues/8295

* Improve alert messages

* Improve bootstrap customizations

* Disable reduced motion

See also 7358282f

* Update Bootstrap data attributes

* Update file inputs

* Update input groups

* Replace deprecated jumbotron class

* Update variables; re-add negative margin util classes

* Update cards

* Update form labels

* Debug alerts

* Fix aria-labelledby associations

* Dropdown-related test fixes

* Fix CanUseWebhooks test

* Test fixes

* Nav updates

* Fix nav usage in wallet send and payouts

* Update alert and modal close buttons

* Re-add backdrop properties

* Upgrade Bootstrap to v5 final

* Update screen reader classes

* Update font-weight classes

* Update monospace font classes

* Update accordians

* Update close icon usage

* Cleanup

* Update scripts and style integrations

* Update input group texts

* Update LN node setup page

* Update more form control classes

* Update inline forms

* Add js specific test

* Upgrade Vue.js

* Remove unused JS

* Upgrade Bootstrap to v5.0.1

* Try container related test updates

* Separate jQuery bundle

* Remove jQuery from LND seed backup page

* Remove unused code

* Refactor email autofill js

* Refactor camera scanner JS

* Re-add tests

* Re-add BuildBundlerMinifier

* Do not minify bundles containing Bootstrap

Details https://github.com/madskristensen/BundlerMinifier/issues/558

* Update bundles

* Cleanup JS test

* Cleanup tests involving dropdowns

* Cleanup tests involving collapses

* Cleanup locale additions in ConfigureCore

* Cleanup bundles

* Remove duplicate status message

* Cleanup formatting

* Fix missing validation scripts

* Remove unused unminified Bootstrap js files

* Fix classic theme

* Fix Casa theme

* Fix PoS validation
2021-05-19 11:39:27 +09:00

230 lines
12 KiB
Text

@using BTCPayServer.Services
@using BTCPayServer.Services.Mails;
@model BTCPayServer.Services.PoliciesSettings
@inject SettingsRepository _SettingsRepository
@{
ViewData.SetActivePageAndTitle(ServerNavPages.Policies);
}
<h2 class="mb-4">@ViewData["Title"]</h2>
@if (!ViewContext.ModelState.IsValid)
{
<div asp-validation-summary="All" class="text-danger"></div>
}
<form method="post">
<div class="form-group mb-5">
<h4 class="mb-3">Existing User Settings</h4>
<div class="form-check my-1">
<input asp-for="AllowLightningInternalNodeForAll" type="checkbox" class="form-check-input"/>
<label asp-for="AllowLightningInternalNodeForAll" class="form-check-label"></label>
<a href="https://docs.btcpayserver.org/FAQ/FAQ-LightningNetwork/#how-many-users-can-use-lightning-network-in-btcpay" target="_blank">
<span class="fa fa-question-circle-o text-secondary" title="More information..."></span>
</a>
<span asp-validation-for="AllowLightningInternalNodeForAll" class="text-danger"></span>
</div>
<div class="form-check my-1">
<input asp-for="AllowHotWalletForAll" type="checkbox" class="form-check-input"/>
<label asp-for="AllowHotWalletForAll" class="form-check-label"></label>
<a href="https://docs.btcpayserver.org/CreateWallet/#requirements-to-create-wallets" target="_blank">
<span class="fa fa-question-circle-o text-secondary" title="More information..."></span>
</a>
<span asp-validation-for="AllowHotWalletForAll" class="text-danger"></span>
</div>
<div class="form-check my-1">
<input asp-for="AllowHotWalletRPCImportForAll" type="checkbox" class="form-check-input"/>
<label asp-for="AllowHotWalletRPCImportForAll" class="form-check-label"></label>
<span asp-validation-for="AllowHotWalletRPCImportForAll" class="text-danger"></span>
</div>
</div>
<div class="form-group mb-5">
<h4 class="mb-3">New User Settings</h4>
<div class="form-check my-1">
@{
var emailSettings = (await _SettingsRepository.GetSettingAsync<EmailSettings>()) ?? new EmailSettings();
/* The "|| Model.RequiresConfirmedEmail" check is for the case when a user had checked
the checkbox without first configuring the e-mail settings so that they can uncheck it. */
var isEmailConfigured = emailSettings.IsComplete() || Model.RequiresConfirmedEmail;
}
<input asp-for="RequiresConfirmedEmail" type="checkbox" class="form-check-input" disabled="@(isEmailConfigured ? null : "disabled")"/>
<label asp-for="RequiresConfirmedEmail" class="form-check-label"></label>
<a href="https://docs.btcpayserver.org/FAQ/FAQ-ServerSettings/#how-to-allow-registration-on-my-btcpay-server" target="_blank">
<span class="fa fa-question-circle-o text-secondary" title="More information..."></span>
</a>
<span asp-validation-for="RequiresConfirmedEmail" class="text-danger"></span>
@if (!isEmailConfigured)
{
<div class="mb-2">
<span class="text-secondary">Your email server has not been configured. <a asp-controller="Server" asp-action="Emails">Please configure it first.</a></span>
</div>
}
</div>
<div class="form-check my-1">
<input asp-for="LockSubscription" type="checkbox" class="form-check-input"/>
<label asp-for="LockSubscription" class="form-check-label"></label>
<span asp-validation-for="LockSubscription" class="text-danger"></span>
</div>
<div class="form-check my-1">
<input asp-for="DisableNonAdminCreateUserApi" type="checkbox" class="form-check-input"/>
<label asp-for="DisableNonAdminCreateUserApi" class="form-check-label"></label>
<span asp-validation-for="DisableNonAdminCreateUserApi" class="text-danger"></span>
</div>
</div>
<div class="form-group mb-5">
<h4 class="mb-3">Notification Settings</h4>
<div class="form-check my-1">
<input asp-for="DisableInstantNotifications" type="checkbox" class="form-check-input"/>
<label asp-for="DisableInstantNotifications" class="form-check-label"></label>
<a href="https://docs.btcpayserver.org/Notifications/#notifications" target="_blank">
<span class="fa fa-question-circle-o text-secondary" title="More information..."></span>
</a>
<span asp-validation-for="DisableInstantNotifications" class="text-danger"></span>
</div>
<div class="form-check my-1">
<input asp-for="DisableStoresToUseServerEmailSettings" type="checkbox" class="form-check-input"/>
<label asp-for="DisableStoresToUseServerEmailSettings" class="form-check-label"></label>
<a href="https://docs.btcpayserver.org/Notifications/#server-emails" target="_blank">
<span class="fa fa-question-circle-o text-secondary" title="More information..."></span>
</a>
<span asp-validation-for="DisableStoresToUseServerEmailSettings" class="text-danger"></span>
</div>
</div>
<div class="form-group mb-5">
<h4 class="mb-3">Maintenance Settings</h4>
@if (ViewBag.UpdateUrlPresent)
{
<div class="form-check my-1">
<input asp-for="CheckForNewVersions" type="checkbox" class="form-check-input"/>
<label asp-for="CheckForNewVersions" class="form-check-label"></label>
<span asp-validation-for="CheckForNewVersions" class="text-danger"></span>
</div>
}
<div class="form-check my-1">
<input asp-for="DiscourageSearchEngines" type="checkbox" class="form-check-input"/>
<label asp-for="DiscourageSearchEngines" class="form-check-label"></label>
<a href="https://docs.btcpayserver.org/FAQ/FAQ-ServerSettings/#how-to-hide-my-btcpay-server-from-search-engines" target="_blank">
<span class="fa fa-question-circle-o text-secondary" title="More information..."></span>
</a>
<span asp-validation-for="DiscourageSearchEngines" class="text-danger"></span>
</div>
</div>
<h4 class="mb-3">Customization Settings</h4>
<div class="form-group">
<label asp-for="RootAppId" class="form-label"></label>
<select asp-for="RootAppId" asp-items="@(new SelectList(ViewBag.AppsList, nameof(SelectListItem.Value), nameof(SelectListItem.Text), Model.RootAppId))" class="form-select w-auto"></select>
@if (!Model.DomainToAppMapping.Any())
{
<button type="submit" name="command" value="add-domain" class="btn btn-link px-0">Map specific domains to specific apps</button>
}
</div>
@if (Model.DomainToAppMapping.Any())
{
<div class="list-group mb-2">
<div class="list-group-item">
<h5 class="mb-1">
Domain to app mapping
<button type="submit" name="command" value="add-domain" class="ms-1 btn btn-secondary btn-sm ">Add domain mapping </button>
</h5>
</div>
@for (var index = 0; index < Model.DomainToAppMapping.Count; index++)
{
<div class="list-group-item p-0 ps-lg-2">
<div class="row">
<div class="col-sm-12 col-md-12 col-lg-10 py-2 ">
<div class="form-group">
<label asp-for="DomainToAppMapping[index].Domain" class="form-label"></label>
<input asp-for="DomainToAppMapping[index].Domain" class="form-control"/>
<span asp-validation-for="DomainToAppMapping[index].Domain" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="DomainToAppMapping[index].AppId" class="form-label"></label>
<select asp-for="DomainToAppMapping[index].AppId"
asp-items="@(new SelectList(ViewBag.AppsList, nameof(SelectListItem.Value), nameof(SelectListItem.Text), Model.DomainToAppMapping[index].AppId))"
class="form-select">
</select>
<span asp-validation-for="DomainToAppMapping[index].AppId" class="text-danger"></span>
</div>
</div>
<div class="col-sm-12 col-md-12 col-lg-2 pull-right">
<button type="submit" title="Remove domain mapping" name="command" value="@($"remove-domain:{index}")"
class="d-block d-lg-none d-xl-none btn btn-danger mb-2 ms-2">
Remove Destination
</button>
<button type="submit" title="Remove domain mapping" name="command" value="@($"remove-domain:{index}")"
class="d-none d-lg-block remove-domain-btn text-decoration-none h-100 align-middle btn text-danger btn-link fa fa-times rounded-0 pull-right">
</button>
</div>
</div>
</div>
}
</div>
}
<button class="btn btn-link px-0" type="button" id="ExplorerLinksButton" data-bs-toggle="collapse" data-bs-target="#explorer-links" aria-expanded="false" aria-controls="explorer-links">
Override the block explorers used
</button>
<div class="mb-3">
<div class="card collapse show collapse-on-js" id="explorer-links">
<ul class="list-group list-group-flush">
@inject BTCPayNetworkProvider BTCPayNetworkProvider
@{
var networks = BTCPayNetworkProvider.GetAll().ToArray();
}
@for (int i = 0; i < networks.Count(); i++)
{
var network = networks.ElementAt(i);
var existingOverride = Model.BlockExplorerLinks?.SingleOrDefault(tuple => tuple.CryptoCode.Equals(network.CryptoCode, StringComparison.InvariantCultureIgnoreCase));
var linkValue = existingOverride?.Link ?? network.BlockExplorerLinkDefault;
if (Model.BlockExplorerLinks.Count < i + 1)
{
Model.BlockExplorerLinks.Add(new PoliciesSettings.BlockExplorerOverrideItem() {CryptoCode = network.CryptoCode, Link = network.BlockExplorerLinkDefault});
}
<li class="list-group-item">
<label class="form-label"> @network.DisplayName (@network.CryptoCode)</label>
<input type="hidden" asp-for="BlockExplorerLinks[i].CryptoCode" value="@network.CryptoCode"/>
<div class="input-group">
<input type="text" class="form-control" asp-for="BlockExplorerLinks[i].Link" value="@linkValue" data-default-link="@network.BlockExplorerLinkDefault"/>
<button type="button" class="text-decoration-none btn btn-link revert-default fa fa-refresh only-for-js" title="Revert to default"></button>
</div>
</li>
}
</ul>
</div>
</div>
<button type="submit" class="btn btn-primary" name="command" value="Save">Save</button>
</form>
@section PageHeadContent {
<style>
.remove-domain-btn { font-size: 1.5rem; border-radius: 0; }
.remove-domain-btn:hover { background-color: #CCCCCC; }
</style>
}
@section PageFootContent {
<script>
for (let element of document.getElementsByClassName("revert-default")) {
element.addEventListener("click", function (){
element.parentElement.previousElementSibling.value = element.parentElement.previousElementSibling.getAttribute("data-default-link")
});
}
for (let element of document.getElementsByClassName("collapse-on-js")){
if (element.classList.contains("show")){
element.classList.remove("show");
}
}
</script>
}