Skip to content

Commit

Permalink
file rename for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
janoside committed Jul 2, 2020
1 parent 111298a commit fb63bb0
Showing 1 changed file with 41 additions and 7 deletions.
48 changes: 41 additions & 7 deletions routes/baseActionsRouter.js → routes/baseRouter.js
Expand Up @@ -1188,7 +1188,7 @@ router.get("/rpc-terminal", function(req, res, next) {
return;
}

res.render("terminal");
res.render("rpc-terminal");

next();
});
Expand Down Expand Up @@ -1326,7 +1326,7 @@ router.get("/rpc-browser", function(req, res, next) {
if (config.rpcBlacklist.includes(req.query.method.toLowerCase())) {
res.locals.methodResult = "Sorry, that RPC command is blacklisted. If this is your server, you may allow this command by removing it from the 'rpcBlacklist' setting in config.js.";

res.render("browser");
res.render("rpc-browser");

next();

Expand Down Expand Up @@ -1359,39 +1359,73 @@ router.get("/rpc-browser", function(req, res, next) {
res.locals.methodResult = {"Error":"No response from node."};
}

res.render("browser");
res.render("rpc-browser");

next();
});
});
} else {
res.render("browser");
res.render("rpc-browser");

next();
}
}).catch(function(err) {
res.locals.userMessage = "Error loading help content for method " + req.query.method + ": " + err;

res.render("browser");
res.render("rpc-browser");

next();
});

} else {
res.render("browser");
res.render("rpc-browser");

next();
}

}).catch(function(err) {
res.locals.userMessage = "Error loading help content: " + err;

res.render("browser");
res.render("rpc-browser");

next();
});
});

router.get("/terminal", function(req, res, next) {
res.render("terminal");

next();
});

router.post("/terminal", function(req, res, next) {
console.log("here");

var params = req.body.cmd.trim().split(/\s+/);
var cmd = params.shift();
var paramsStr = req.body.cmd.trim().substring(cmd.length).trim();

console.log("abc: " + params + ", " + cmd + ", " + paramsStr);

if (cmd == "parsescript") {
const nbs = require('node-bitcoin-script');
var parsedScript = nbs.parseRawScript(paramsStr, "hex");

res.write(JSON.stringify({"parsed":parsedScript}, null, 4), function() {
res.end();
});

next();

} else {
res.write(JSON.stringify({"Error":"Unknown command"}, null, 4), function() {
res.end();
});

next();
}
});

router.get("/unconfirmed-tx", function(req, res, next) {
var limit = config.site.browseBlocksPageSize;
var offset = 0;
Expand Down

0 comments on commit fb63bb0

Please sign in to comment.