Split out peer cmds into new functions
-Add new setting for getpeerinfo cmd -getpeerinfo api call moved to explorer.js -Peer geo location api call moved to explorer.js
This commit is contained in:
@@ -733,6 +733,40 @@ module.exports = {
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
get_peerinfo: function(cb) {
|
||||
var cmd = prepareRpcCommand(settings.api_cmds.getpeerinfo);
|
||||
|
||||
if (!(cmd.method == '' && cmd.parameters.length == 0)) {
|
||||
if (settings.use_rpc) {
|
||||
rpcCommand([{method:cmd.method, parameters: cmd.parameters}], function(response) {
|
||||
// check if an error msg was received from the rpc server
|
||||
if (response == 'There was an error. Check your console.')
|
||||
return cb(null);
|
||||
else
|
||||
return cb(response);
|
||||
});
|
||||
} else {
|
||||
var uri = base_url + 'getpeerinfo';
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
|
||||
// check if an error msg was received from the web api server
|
||||
if (body == 'There was an error. Check your console.')
|
||||
return cb(null);
|
||||
else
|
||||
return cb(body);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// cmd not in use. return null.
|
||||
return cb(null);
|
||||
}
|
||||
},
|
||||
|
||||
get_geo_location: function(address, cb) {
|
||||
request({uri: 'https://freegeoip.app/json/' + address, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, geo) {
|
||||
return cb(error, geo);
|
||||
});
|
||||
},
|
||||
|
||||
is_unique: function(array, object, cb) {
|
||||
var unique = true;
|
||||
|
||||
Reference in New Issue
Block a user