Skip to content

Commit b4d2000

Browse files
committed
#77 ignore hostaddrs
1 parent a6fb861 commit b4d2000

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

js/health.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,14 @@ function health_discover(root) {
7474

7575
function health_flag(host) {
7676
var $td = $('#health td[data-ip="' + host + '"]');
77-
$.getJSON('https://ssl.geoplugin.net/json.gp?k=af0ad95fd7caa623&ip=' + $td.data('ip'), function(json) {
78-
var country = json.geoplugin_countryCode;
79-
$td.html('<img src="https://flagpedia.net/data/flags/normal/' +
80-
country.toLowerCase() + '.png" alt="' + country + '" style="width:1em;"/>');
81-
}).fail(function() { $td.text('?'); });
77+
var ip = $td.data('ip');
78+
if (ip.match(/^[0-9\.]+$/)) {
79+
$.getJSON('https://ssl.geoplugin.net/json.gp?k=af0ad95fd7caa623&ip=' + ip, function(json) {
80+
var country = json.geoplugin_countryCode;
81+
$td.html('<img src="https://flagpedia.net/data/flags/normal/' +
82+
country.toLowerCase() + '.png" alt="' + country + '" style="width:1em;"/>');
83+
}).fail(function() { $td.text('?'); });
84+
}
8285
}
8386

8487
function health_check_wallet() {

0 commit comments

Comments
 (0)