Geolocation update for peer sync
-freegeoip.app now requires an api key so the peer sync has been updated to use reallyfreegeoip.org instead -Added extra error checking to the peer sync so that it will error out when the geolocation service does not return a proper object
This commit is contained in:
+1
-1
@@ -975,7 +975,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
get_geo_location: function(address, cb) {
|
get_geo_location: function(address, cb) {
|
||||||
request({uri: 'https://freegeoip.app/json/' + address, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, geo) {
|
request({uri: 'https://reallyfreegeoip.org/json/' + address, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, geo) {
|
||||||
return cb(error, geo);
|
return cb(error, geo);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -458,6 +458,9 @@ if (lib.is_locked([database]) == false) {
|
|||||||
if (error) {
|
if (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
} else if (geo == null || typeof geo != 'object') {
|
||||||
|
console.log('Error: geolocation api did not return a valid object');
|
||||||
|
exit(1);
|
||||||
} else {
|
} else {
|
||||||
// add peer to collection
|
// add peer to collection
|
||||||
db.create_peer({
|
db.create_peer({
|
||||||
|
|||||||
Reference in New Issue
Block a user