From 29477026028229bba8a2fbd313d2947f00af9110 Mon Sep 17 00:00:00 2001 From: Alexandre Fiori Date: Tue, 15 Mar 2016 00:54:43 -0400 Subject: [PATCH] Add rate limit info, update copyright --- cmd/freegeoip/public/index.html | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cmd/freegeoip/public/index.html b/cmd/freegeoip/public/index.html index 6a5a469..925e6ac 100644 --- a/cmd/freegeoip/public/index.html +++ b/cmd/freegeoip/public/index.html @@ -42,6 +42,7 @@ $scope.record = {}; $scope.searching = false; $scope.lastUpdated = ''; + $scope.rateLimit = {remaining: 0, expires: 0}; $scope.search = function(q) { $scope.searching = true; $http.get("json/" + (q || '')). @@ -56,10 +57,14 @@ } $scope.record = data; $scope.lastUpdated = headers('X-Database-Date'); + var n = headers('X-RateLimit-Remaining'); + reset = parseInt(headers('X-RateLimit-Reset'), 10); + $scope.rateLimit = {remaining: n, expires: Math.floor(reset/60) + ' minutes'}; $scope.searching = false; }) .error(function(data, status) { $scope.lastUpdated = ''; + $scope.rateLimit = {remaining: 0, expires: 0}; $scope.error = 'HTTP ' + status + ': ' + data; $scope.searching = false; }); @@ -117,7 +122,8 @@

About


Searching, please wait...

Server returned {{error}}

- IP database date:
{{lastUpdated}}
+ IP database date: {{lastUpdated}}
+ {{rateLimit.remaining}} calls remaining, resets in {{rateLimit.expires}}
@@ -240,7 +246,7 @@
JSON
This service includes GeoLite2 data created by MaxMind, available from maxmind.com.
- © 2009-2015 freegeoip.net + © 2009-2016 freegeoip.net
IP