Use a different provider for GeoIP

This commit is contained in:
Girish Ramakrishnan
2016-09-07 20:00:44 -07:00
parent e21df0ea92
commit ad34838f92
+4 -4
View File
@@ -189,20 +189,20 @@ function setTimeZone(ip, callback) {
// { url: 'http://ip-api.com/json/%s', jpath: 'timezone' },
// { url: 'http://geoip.nekudo.com/api/%s', jpath: 'time_zone }
superagent.get('http://freegeoip.net/json/' + ip).end(function (error, result) {
superagent.get('http://ip-api.com/json/' + ip).end(function (error, result) {
if ((error && !error.response) || result.statusCode !== 200) {
debug('Failed to get geo location: %s', error.message);
return callback(null);
}
if (!result.body.time_zone || typeof result.body.time_zone !== 'string') {
if (!result.body.timezone || typeof result.body.timezone !== 'string') {
debug('No timezone in geoip response : %j', result.body);
return callback(null);
}
debug('Setting timezone to ', result.body.time_zone);
debug('Setting timezone to ', result.body.timezone);
settings.setTimeZone(result.body.time_zone, callback);
settings.setTimeZone(result.body.timezone, callback);
});
}