Fix a couple of issues with the relays map (geoip, 'data unavailable')
- Move to ipinfo.io for geoip, rather than Telize. Telize has been closed down. ipinfo.io has apparently got decent availability, and allows 1,000 requests per day on the free tier. Since requests are made by the client, this should be more than enough (and the total across all clients should still be less than this). - Fix issue where one nonresponsive relay would cause 'data unavailable' to be shown for many relays. This was caused by the relay status promise not being correctly added to the list of things being waited for before the map was rendered. Any delayed relay status requests would therefore occur after the map was rendered, which was too late.
This commit is contained in:
@@ -143,7 +143,7 @@
|
||||
$scope.uri[relay.url] = uri;
|
||||
|
||||
initProgress("Resolving location for " + uri.hostname);
|
||||
var resolveGeoIp = $http.get('http://www.telize.com/geoip/' + uri.hostname).then(function (response) {
|
||||
var resolveGeoIp = $http.get('http://ipinfo.io/' + uri.hostname).then(function (response) {
|
||||
progressDone("Resolving location for " + uri.hostname);
|
||||
|
||||
$scope.geoip[relay.url] = response.data;
|
||||
@@ -173,7 +173,7 @@
|
||||
resolveStatus.resolve(response.data);
|
||||
});
|
||||
|
||||
promises.push(resolveStatus);
|
||||
promises.push(resolveStatus.promise);
|
||||
});
|
||||
|
||||
$q.all(promises).then(function() {
|
||||
@@ -183,7 +183,8 @@
|
||||
angular.forEach($scope.relays, function(relay) {
|
||||
var scope = $rootScope.$new(true);
|
||||
var geoip = $scope.geoip[relay.url];
|
||||
var position = new google.maps.LatLng(geoip.latitude, geoip.longitude);
|
||||
var locParts = geoip.loc.split(',');
|
||||
var position = new google.maps.LatLng(locParts[0], locParts[1]);
|
||||
|
||||
scope.status = $scope.status[relay.url];
|
||||
scope.geoip = geoip;
|
||||
|
||||
Reference in New Issue
Block a user