webapi: List xpubs on admin page.
A new tab is added to the admin page to display current and historic xpub keys used by vspd.
This commit is contained in:
parent
4e4121335a
commit
844d2ce1ba
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2020-2023 The Decred developers
|
// Copyright (c) 2020-2024 The Decred developers
|
||||||
// Use of this source code is governed by an ISC
|
// Use of this source code is governed by an ISC
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
@ -155,12 +155,20 @@ func (w *WebAPI) adminPage(c *gin.Context) {
|
|||||||
|
|
||||||
missed.SortByPurchaseHeight()
|
missed.SortByPurchaseHeight()
|
||||||
|
|
||||||
|
xpubs, err := w.db.AllXPubs()
|
||||||
|
if err != nil {
|
||||||
|
w.log.Errorf("db.AllXPubs error: %v", err)
|
||||||
|
c.String(http.StatusInternalServerError, "Error getting xpubs from db")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
c.HTML(http.StatusOK, "admin.html", gin.H{
|
c.HTML(http.StatusOK, "admin.html", gin.H{
|
||||||
"WebApiCache": cacheData,
|
"WebApiCache": cacheData,
|
||||||
"WebApiCfg": w.cfg,
|
"WebApiCfg": w.cfg,
|
||||||
"WalletStatus": w.walletStatus(c),
|
"WalletStatus": w.walletStatus(c),
|
||||||
"DcrdStatus": w.dcrdStatus(c),
|
"DcrdStatus": w.dcrdStatus(c),
|
||||||
"MissedTickets": missed,
|
"MissedTickets": missed,
|
||||||
|
"XPubs": xpubs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,6 +239,13 @@ func (w *WebAPI) ticketSearch(c *gin.Context) {
|
|||||||
|
|
||||||
missed.SortByPurchaseHeight()
|
missed.SortByPurchaseHeight()
|
||||||
|
|
||||||
|
xpubs, err := w.db.AllXPubs()
|
||||||
|
if err != nil {
|
||||||
|
w.log.Errorf("db.AllXPubs error: %v", err)
|
||||||
|
c.String(http.StatusInternalServerError, "Error getting xpubs from db")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
c.HTML(http.StatusOK, "admin.html", gin.H{
|
c.HTML(http.StatusOK, "admin.html", gin.H{
|
||||||
"SearchResult": searchResult{
|
"SearchResult": searchResult{
|
||||||
Hash: hash,
|
Hash: hash,
|
||||||
@ -246,6 +261,7 @@ func (w *WebAPI) ticketSearch(c *gin.Context) {
|
|||||||
"WalletStatus": w.walletStatus(c),
|
"WalletStatus": w.walletStatus(c),
|
||||||
"DcrdStatus": w.dcrdStatus(c),
|
"DcrdStatus": w.dcrdStatus(c),
|
||||||
"MissedTickets": missed,
|
"MissedTickets": missed,
|
||||||
|
"XPubs": xpubs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -246,7 +246,9 @@ table.missed-tickets td {
|
|||||||
.tabset > input:nth-child(4):focus ~ ul li:nth-child(4) label,
|
.tabset > input:nth-child(4):focus ~ ul li:nth-child(4) label,
|
||||||
.tabset > input:nth-child(4):hover ~ ul li:nth-child(4) label,
|
.tabset > input:nth-child(4):hover ~ ul li:nth-child(4) label,
|
||||||
.tabset > input:nth-child(5):focus ~ ul li:nth-child(5) label,
|
.tabset > input:nth-child(5):focus ~ ul li:nth-child(5) label,
|
||||||
.tabset > input:nth-child(5):hover ~ ul li:nth-child(5) label {
|
.tabset > input:nth-child(5):hover ~ ul li:nth-child(5) label,
|
||||||
|
.tabset > input:nth-child(6):focus ~ ul li:nth-child(6) label,
|
||||||
|
.tabset > input:nth-child(6):hover ~ ul li:nth-child(6) label {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
color: #091440;
|
color: #091440;
|
||||||
}
|
}
|
||||||
@ -255,7 +257,8 @@ table.missed-tickets td {
|
|||||||
.tabset > input:nth-child(2):checked ~ ul li:nth-child(2) label,
|
.tabset > input:nth-child(2):checked ~ ul li:nth-child(2) label,
|
||||||
.tabset > input:nth-child(3):checked ~ ul li:nth-child(3) label,
|
.tabset > input:nth-child(3):checked ~ ul li:nth-child(3) label,
|
||||||
.tabset > input:nth-child(4):checked ~ ul li:nth-child(4) label,
|
.tabset > input:nth-child(4):checked ~ ul li:nth-child(4) label,
|
||||||
.tabset > input:nth-child(5):checked ~ ul li:nth-child(5) label {
|
.tabset > input:nth-child(5):checked ~ ul li:nth-child(5) label,
|
||||||
|
.tabset > input:nth-child(6):checked ~ ul li:nth-child(6) label {
|
||||||
border-bottom: 5px solid #2ed8a3;
|
border-bottom: 5px solid #2ed8a3;
|
||||||
color: #091440;
|
color: #091440;
|
||||||
cursor: default;
|
cursor: default;
|
||||||
@ -275,6 +278,7 @@ table.missed-tickets td {
|
|||||||
.tabset > input:nth-child(2):checked ~ div > section:nth-child(2),
|
.tabset > input:nth-child(2):checked ~ div > section:nth-child(2),
|
||||||
.tabset > input:nth-child(3):checked ~ div > section:nth-child(3),
|
.tabset > input:nth-child(3):checked ~ div > section:nth-child(3),
|
||||||
.tabset > input:nth-child(4):checked ~ div > section:nth-child(4),
|
.tabset > input:nth-child(4):checked ~ div > section:nth-child(4),
|
||||||
.tabset > input:nth-child(5):checked ~ div > section:nth-child(5) {
|
.tabset > input:nth-child(5):checked ~ div > section:nth-child(5),
|
||||||
|
.tabset > input:nth-child(6):checked ~ div > section:nth-child(6) {
|
||||||
position:static;
|
position:static;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,12 +51,19 @@
|
|||||||
id="tabset_1_5"
|
id="tabset_1_5"
|
||||||
hidden
|
hidden
|
||||||
>
|
>
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
name="tabset_1"
|
||||||
|
id="tabset_1_6"
|
||||||
|
hidden
|
||||||
|
>
|
||||||
<ul>
|
<ul>
|
||||||
<li><label for="tabset_1_1">VSP Status</label></li>
|
<li><label for="tabset_1_1">VSP Status</label></li>
|
||||||
<li><label for="tabset_1_2">Ticket Search</label></li>
|
<li><label for="tabset_1_2">Ticket Search</label></li>
|
||||||
<li><label for="tabset_1_3">Missed Tickets</label></li>
|
<li><label for="tabset_1_3">Missed Tickets</label></li>
|
||||||
<li><label for="tabset_1_4">Database</label></li>
|
<li><label for="tabset_1_4">Fee X Pubs</label></li>
|
||||||
<li><label for="tabset_1_5">Logout</label></li>
|
<li><label for="tabset_1_5">Database</label></li>
|
||||||
|
<li><label for="tabset_1_6">Logout</label></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
@ -222,6 +229,30 @@
|
|||||||
{{ end}}
|
{{ end}}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h1>All X Pubs</h1>
|
||||||
|
{{ with .XPubs }}
|
||||||
|
<table class="mx-auto">
|
||||||
|
<thead>
|
||||||
|
<th>ID</th>
|
||||||
|
<th>Key</th>
|
||||||
|
<th>Last Address Index</th>
|
||||||
|
<th>Retired</th>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{{ range . }}
|
||||||
|
<tr>
|
||||||
|
<td>{{ .ID }}</td>
|
||||||
|
<td>{{ .Key }}</td>
|
||||||
|
<td>{{ .LastUsedIdx }}</td>
|
||||||
|
<td>{{ dateTime .Retired }}</td>
|
||||||
|
</tr>
|
||||||
|
{{ end }}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{{ end}}
|
||||||
|
</section>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<p>Database size: {{ .WebApiCache.DatabaseSize }}</p>
|
<p>Database size: {{ .WebApiCache.DatabaseSize }}</p>
|
||||||
<a class="btn btn-primary" href="/admin/backup" download>Download Backup</a>
|
<a class="btn btn-primary" href="/admin/backup" download>Download Backup</a>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user