浏览代码

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.
Antony Male 10 年之前
父节点
当前提交
6ee36fe361
共有 2 个文件被更改,包括 5 次插入4 次删除
  1. 1 1
      cmd/strelaypoolsrv/auto/gui.go
  2. 4 3
      cmd/strelaypoolsrv/gui/index.html

文件差异内容过多而无法显示
+ 1 - 1
cmd/strelaypoolsrv/auto/gui.go


+ 4 - 3
cmd/strelaypoolsrv/gui/index.html

@@ -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;

部分文件因为文件数量过多而无法显示