浏览代码

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

master
coldstar 3 年前
父节点
当前提交
e6da43d887
共有 2 个文件被更改,包括 25 次插入1 次删除
  1. +24
    -0
      routes/baseActionsRouter.js
  2. +1
    -1
      views/layout.pug

+ 24
- 0
routes/baseActionsRouter.js 查看文件

@@ -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 查看文件

@@ -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")


正在加载...
取消
保存