forked from btcpayserver/btcpayserver-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
95 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
namespace BTCPayServer.Plugins.Monero.Model | ||
{ | ||
public enum MoneroNodeType | ||
{ | ||
Internal, | ||
Custom | ||
} | ||
|
||
public class MoneroNodeViewModel | ||
{ | ||
public MoneroNodeType MoneroNodeType { get; set; } | ||
public string StoreId { get; set; } | ||
Check warning on line 14 in BTCPayServer.Plugins.Monero/Model/MoneroNodeViewModel.cs
|
||
public string CryptoCode { get; set; } | ||
Check warning on line 15 in BTCPayServer.Plugins.Monero/Model/MoneroNodeViewModel.cs
|
||
public bool CanUseInternalNode { get; set; } | ||
public bool SkipPortTest { get; set; } | ||
|
||
[Display(Name = "Enabled")] | ||
public bool Enabled { get; set; } = true; | ||
|
||
[Display(Name = "Connection string")] | ||
public string ConnectionString { get; set; } | ||
Check warning on line 23 in BTCPayServer.Plugins.Monero/Model/MoneroNodeViewModel.cs
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
BTCPayServer.Plugins.Monero/Views/Shared/TemplatePluginHeaderNav.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,45 @@ | ||
@using BTCPayServer.Abstractions.Extensions | ||
@using BTCPayServer.Plugins.Template.Views | ||
@model BTCPayServer.Plugins.Template.PluginPageViewModel | ||
@using BTCPayServer.Plugins.Monero.Views | ||
@using BTCPayServer.Plugins.Monero.Model | ||
@model BTCPayServer.Plugins.Monero.Model.MoneroNodeViewModel | ||
@{ | ||
ViewData.SetActivePage(PluginNavPages.Index, "Plugin Template"); | ||
ViewData.SetActivePage(PluginNavPages.Index, "Connect to a Monero node"); | ||
} | ||
<h1>@ViewData["Title"]</h1> | ||
<p>Here is an image loaded from the plugin</p> | ||
<p> | ||
<a href="https://twitter.com/NicolasDorier/status/1307221679014256640"> | ||
<img src="/Resources/img/screengrab.png"/> | ||
</a> | ||
</p> | ||
|
||
<h2>Persisted Data</h2> | ||
<p> | ||
The following is data persisted to the configured database but in an isolated DbContext. | ||
Every time you start BTCPay Server with this plugin enabled, a timestamp is logged. | ||
</p> | ||
<ul class="list-group"> | ||
@foreach (var item in Model.Data) | ||
{ | ||
<li class="list-group-item">@item.Id at @item.Timestamp.ToString("F")</li> | ||
} | ||
</ul> | ||
@section PageHeadContent { | ||
<style> | ||
#save { min-width: 7rem; } | ||
#MoneroNodeTypeTabs ul { | ||
list-style: none; | ||
padding-left: 0; | ||
} | ||
#MoneroNodeTypeTabs ul li code, | ||
#MoneroNodeTypeTabs pre { | ||
display: block; | ||
color: var(--btcpay-code-text); | ||
background: var(--btcpay-bg-tile); | ||
margin: .25rem 0; | ||
padding: .75rem 1rem; | ||
border-radius: 4px; | ||
} | ||
</style> | ||
} | ||
|
||
<h1 class="text-center mb-5">@ViewData["Title"]</h1> | ||
|
||
<form method="post" class="mt-n2 text-center"> | ||
<div id="MoneroNodeTypeTablist" class="nav btcpay-pills align-items-center justify-content-center mb-3" role="tablist"> | ||
<input asp-for="MoneroNodeType" value="@MoneroNodeType.Internal" type="radio" id="[email protected]" data-bs-toggle="pill" data-bs-target="#InternalSetup" role="tab" aria-controls="InternalSetup" aria-selected="@(Model.MoneroNodeType == MoneroNodeType.Internal ? "true" : "false")" class="@(Model.MoneroNodeType == MoneroNodeType.Internal ? "active" : "")" disabled="@(!Model.CanUseInternalNode)"> | ||
<label asp-for="MoneroNodeType" for="@($"MoneroNodeType-{MoneroNodeType.Internal}")" text-translate="true">Use internal node</label> | ||
|
||
<input asp-for="MoneroNodeType" value="@MoneroNodeType.Custom" type="radio" id="[email protected]" data-bs-toggle="pill" data-bs-target="#CustomSetup" role="tab" aria-controls="CustomSetup" aria-selected="@(Model.MoneroNodeType == MoneroNodeType.Custom ? "true" : "false")" class="@(Model.MoneroNodeType == MoneroNodeType.Custom ? "active" : "")"> | ||
<label asp-for="MoneroNodeType" for="@($"MoneroNodeType-{MoneroNodeType.Custom}")" text-translate="true">Use custom node</label> | ||
</div> | ||
<div class="text-start mt-4"> | ||
<button id="page-primary" name="command" type="submit" value="save" class="btn btn-primary me-2">Save</button> | ||
</div> | ||
</form> | ||
|
||
@section PageFootContent { | ||
<partial name="_ValidationScriptsPartial"/> | ||
} |