mirror of
https://github.com/jwinterm/node-tip-bot.git
synced 2026-10-17 05:41:42 +02:00
less spammy rain
This commit is contained in:
+9
-1
@@ -64,13 +64,21 @@ module.exports.app = function(port, coin, settings, winston) {
|
||||
|
||||
app.get('/user/:user', function(req, res) {
|
||||
var user = req.params.user;
|
||||
coin.getAddressesByAccount(user.toLowerCase(), function(err, addresses) {
|
||||
coin.listReceivedByAddress(settings.coin.min_confirmations, true, function(err, reply) {
|
||||
if(err) {
|
||||
winston.error('Tried to get address listing but failed.', err);
|
||||
res.send(500, 'Could not get address list');
|
||||
return;
|
||||
}
|
||||
|
||||
var addresses = [];
|
||||
for(var key in reply) {
|
||||
var address = reply[key];
|
||||
if(address.account.toLowerCase() == user.toLowerCase()) {
|
||||
addresses.push({address: address.address, amount: address.amount})
|
||||
}
|
||||
}
|
||||
|
||||
var body = JSON.stringify({
|
||||
addresses: addresses
|
||||
});
|
||||
|
||||
@@ -87,6 +87,7 @@
|
||||
<thead>
|
||||
<th>#</th>
|
||||
<th>Address</th>
|
||||
<th>Total deposited</th>
|
||||
</thead>
|
||||
<tbody id="userinfo_address_list">
|
||||
|
||||
@@ -106,9 +107,14 @@
|
||||
$('#userinfo_address_list').empty();
|
||||
$.getJSON('/user/' + user, function(data) {
|
||||
$.each(data.addresses, function(key, val) {
|
||||
$('#userinfo_address_list').append('<tr><td>' + key + '</td><td>' + val + '</td></tr>');
|
||||
})
|
||||
})
|
||||
$('#userinfo_address_list').append('
|
||||
<tr>
|
||||
<td>' + (key + 1) + '</td>
|
||||
<td>' + val.address + '</td>
|
||||
<td>' + val.amount + '</td>
|
||||
</tr>');
|
||||
});
|
||||
});
|
||||
$('#userinfo_modal').modal('show');
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user