mirror of
https://github.com/janoside/btc-rpc-explorer.git
synced 2026-08-13 12:33:13 +02:00
most work on 328, needs testing
This commit is contained in:
parent
5807db09b9
commit
7ecea7d420
2 changed files with 75 additions and 1 deletions
|
|
@ -499,6 +499,37 @@ router.get("/changeSetting", function(req, res, next) {
|
|||
res.redirect(req.headers.referer);
|
||||
});
|
||||
|
||||
router.get("/session-data", function(req, res, next) {
|
||||
if (req.query.action && req.query.data) {
|
||||
let action = req.query.action;
|
||||
let data = req.query.data;
|
||||
|
||||
if (action == "add-rpc-favorite") {
|
||||
if (!req.session.favoriteRpcCommands) {
|
||||
req.session.favoriteRpcCommands = [];
|
||||
}
|
||||
|
||||
if (!req.session.favoriteRpcCommands.includes(data)) {
|
||||
req.session.favoriteRpcCommands.push(data);
|
||||
}
|
||||
|
||||
req.session.favoriteRpcCommands.sort();
|
||||
}
|
||||
|
||||
if (action == "remove-rpc-favorite") {
|
||||
if (!req.session.favoriteRpcCommands) {
|
||||
req.session.favoriteRpcCommands = [];
|
||||
}
|
||||
|
||||
if (req.session.favoriteRpcCommands.includes(data)) {
|
||||
req.session.favoriteRpcCommands.splice(req.session.favoriteRpcCommands.indexOf(data), 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
res.redirect(req.headers.referer);
|
||||
});
|
||||
|
||||
router.get("/user-settings", function(req, res, next) {
|
||||
res.render("user-settings");
|
||||
|
||||
|
|
@ -1425,6 +1456,18 @@ router.get("/rpc-browser", function(req, res, next) {
|
|||
res.locals.gethelp = result;
|
||||
|
||||
if (req.query.method) {
|
||||
if (!req.session.recentRpcCommands) {
|
||||
req.session.recentRpcCommands = [];
|
||||
}
|
||||
|
||||
if (!req.session.recentRpcCommands.includes(req.query.method)) {
|
||||
req.session.recentRpcCommands.unshift(req.query.method);
|
||||
|
||||
while (req.session.recentRpcCommands.length > 5) {
|
||||
req.session.recentRpcCommands.pop();
|
||||
}
|
||||
}
|
||||
|
||||
res.locals.method = req.query.method;
|
||||
|
||||
coreApi.getRpcMethodHelp(req.query.method.trim()).then(function(result2) {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,14 @@ block content
|
|||
.float-start
|
||||
+sectionTitle(`Command: ${method}`)
|
||||
|
||||
.float-start.ms-3
|
||||
.float-start.ms-2
|
||||
if (session.favoriteRpcCommands && session.favoriteRpcCommands.includes(method))
|
||||
a.me-2(href=`./session-data?action=remove-rpc-favorite&data=${method}`, title="Remove from Favorites", data-bs-toggle="tooltip")
|
||||
i.fas.fa-star.text-warning
|
||||
else
|
||||
a.me-2(href=`./session-data?action=add-rpc-favorite&data=${method}`, title="Add as a Favorite", data-bs-toggle="tooltip")
|
||||
i.far.fa-star.text-warning
|
||||
|
||||
span.small.text-muted (
|
||||
a(href=`https://developer.bitcoin.org/reference/rpc/${method}.html`, target="_blank") Developer Docs
|
||||
i.fas.fa-external-link-alt.ms-2
|
||||
|
|
@ -115,6 +122,30 @@ block content
|
|||
.mb-2 This tool lists all RPC commands that your node makes publicly visible. Clicking on any command in the list will display additional information about that command and provide an interactive tool for submitting the command to your node.
|
||||
|
||||
.col-md-3
|
||||
if (session.favoriteRpcCommands && session.favoriteRpcCommands.length > 0)
|
||||
.clearfix
|
||||
.float-start
|
||||
i.fas.fa-star.me-2
|
||||
.float-start
|
||||
+sectionTitle(`Favorites (${session.favoriteRpcCommands.length.toLocaleString()})`)
|
||||
+contentSection
|
||||
ol.mb-0.ps-4
|
||||
each methodX, methodIndex in session.favoriteRpcCommands
|
||||
li
|
||||
a(href=`./rpc-browser?method=${methodX}`, style=(methodX == method ? "font-weight: bold; font-style: italic;" : false)) #{methodX}
|
||||
|
||||
if (session.recentRpcCommands && session.recentRpcCommands.length > 0)
|
||||
.clearfix
|
||||
.float-start
|
||||
i.fas.fa-history.me-2
|
||||
.float-start
|
||||
+sectionTitle(`Recent (${session.recentRpcCommands.length.toLocaleString()})`)
|
||||
+contentSection
|
||||
ol.mb-0.ps-4
|
||||
each methodX, methodIndex in session.recentRpcCommands
|
||||
li
|
||||
a(href=`./rpc-browser?method=${methodX}`, style=(methodX == method ? "font-weight: bold; font-style: italic;" : false)) #{methodX}
|
||||
|
||||
each section, sectionIndex in gethelp
|
||||
+contentSection(`${section.name} (${section.methods.length})`)
|
||||
ol.mb-0.ps-4
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue