|
|
|
@ -26,38 +26,41 @@ router.post('/', async function(req, res, next) {
@@ -26,38 +26,41 @@ router.post('/', async function(req, res, next) {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// looking for address
|
|
|
|
|
const address = await models.Address.findOne({ |
|
|
|
|
where: { |
|
|
|
|
address: search, |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
if (address) { |
|
|
|
|
res.redirect(`/address/${address.address}/`); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (search.length === 34) { |
|
|
|
|
// looking for address
|
|
|
|
|
const address = await models.Address.findOne({ |
|
|
|
|
where: { |
|
|
|
|
address: search, |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
if (address) { |
|
|
|
|
res.redirect(`/address/${address.address}/`); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
} else if(search.length === 64) { |
|
|
|
|
// looking for transaction
|
|
|
|
|
const transaction = await models.Transaction.findOne({ |
|
|
|
|
where: { |
|
|
|
|
txid: search, |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
if (transaction) { |
|
|
|
|
res.redirect(`/transaction/${transaction.txid}/`); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// looking for transaction
|
|
|
|
|
const transaction = await models.Transaction.findOne({ |
|
|
|
|
where: { |
|
|
|
|
txid: search, |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
if (transaction) { |
|
|
|
|
res.redirect(`/transaction/${transaction.txid}/`); |
|
|
|
|
return; |
|
|
|
|
// looking for block
|
|
|
|
|
const block = await models.Block.findOne({ |
|
|
|
|
where: { |
|
|
|
|
hash: search, |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
if (block) { |
|
|
|
|
res.redirect(`/block/${block.hash}/`); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// looking for block
|
|
|
|
|
const block = await models.Block.findOne({ |
|
|
|
|
where: { |
|
|
|
|
hash: search, |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
if (block) { |
|
|
|
|
res.redirect(`/block/${block.hash}/`); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
res.status(404).render('404'); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|