Browse Source

Pretty html

master
xcps 6 years ago committed by R4SAS
parent
commit
ad830004d4
  1. 2
      app.js
  2. 3
      routes/address.js
  3. 4
      routes/transaction.js

2
app.js

@ -18,6 +18,8 @@ var app = express();
app.set('views', path.join(__dirname, 'views')); app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'pug'); app.set('view engine', 'pug');
app.locals.pretty = true;
// uncomment after placing your favicon in /public // uncomment after placing your favicon in /public
app.use(favicon(path.join(__dirname, 'public', 'favicon.ico'))); app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
if (env === 'development') { if (env === 'development') {

3
routes/address.js

@ -15,7 +15,7 @@ router.get('/:address/:offset*?', async function(req, res, next) {
model: models.Vout, model: models.Vout,
include: { include: {
model: models.Transaction, model: models.Transaction,
}, },
}, },
}); });
@ -32,7 +32,6 @@ router.get('/:address/:offset*?', async function(req, res, next) {
const nextpage = address.Vouts.length === 30 ? page + 1 : null; const nextpage = address.Vouts.length === 30 ? page + 1 : null;
const prevpage = page > 1 ? page - 1 : null; const prevpage = page > 1 ? page - 1 : null;
console.log(address.toJSON());
res.render('address', { res.render('address', {
address: address.toJSON(), address: address.toJSON(),

4
routes/transaction.js

@ -37,15 +37,13 @@ router.get('/:txid', async function(req, res, next) {
raw: true, raw: true,
}); });
const confirmations = lastBlock.maxheight - transaction.Block.height + 1; const confirmations = lastBlock.maxheight - transaction.Block.height + 1;
const txJson = transaction.toJSON(); const txJson = transaction.toJSON();
const txTemplate = Object.assign(txJson, { const txTemplate = Object.assign(txJson, {
vins: txJson.Vouts.filter((vout) => vout.TransactionVouts.direction === 0), vins: txJson.Vouts.filter((vout) => vout.TransactionVouts.direction === 0),
vouts: txJson.Vouts.filter((vout) => vout.TransactionVouts.direction === 1), vouts: txJson.Vouts.filter((vout) => vout.TransactionVouts.direction === 1),
}); });
console.log(transaction.Vouts.length);
txTemplate.blockTime = transaction.Block.time.toUTCString(); txTemplate.blockTime = transaction.Block.time.toUTCString();
res.render('transaction', { res.render('transaction', {

Loading…
Cancel
Save