Browse Source

05/26/2021 07:04:02 AM MST

master
coldstar 3 years ago
parent
commit
e6da43d887
2 changed files with 25 additions and 1 deletions
  1. +24
    -0
      routes/baseActionsRouter.js
  2. +1
    -1
      views/layout.pug

+ 24
- 0
routes/baseActionsRouter.js View File

@@ -190,6 +190,30 @@ router.post("/search", function(req, res) {

var query = req.body.query.toLowerCase();

if (query === null || query === "null" || query.length < 1) {
res.redirect("/");
return;
}

query = query.replace(/,/g, "");

if (query.stringLength < 9) {
if (typeof query == "number") {
res.redirect("/block-height/" + query);
console.log('This is a block');
return;
}
}

if (query.stringLength < 36) {
if (typeof query != "number") {
res.redirect("/address/" + query);
console.log('This is not number');
return;
}
}


rpcApi.getRawTransaction(query).then(function(tx) {
if (tx) {
res.redirect("/tx/" + query);


+ 1
- 1
views/layout.pug View File

@@ -40,7 +40,7 @@ html
a(href="/mempool", class="nav-link") Mempool Info
form(method="post", action="/search", class="form-inline")
div(class="input-group")
input(type="text", class="form-control form-control-sm", name="query", placeholder="block height, block hash, txid", style="width: 250px;")
input(type="text", class="form-control form-control-sm", name="query", placeholder="block height, block hash, txid, address", style="width: 250px;")
span(class="input-group-btn")
input(type="submit", class="btn btn-primary", value="Search")


Loading…
Cancel
Save