bugfix: check to see if internet is reachable before loading external resources (#224)

This commit is contained in:
dman776 2018-10-15 21:58:52 -05:00 committed by GitHub
parent 7a1817935c
commit b11a4fc95d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -1704,7 +1704,11 @@ sub is_online()
my $online=0;
if(get_default_gw() ne "none")
{
$online=1;
system("ping -W1 -c1 8.8.8.8 &>/dev/null"); # google DNS
if($? eq 0)
{
$online=1;
}
}
return $online;
}

View File

@ -473,8 +473,8 @@ my ($rc, $maptiles, $leafletcss, $leafletjs);
http_header() unless $debug == 2;
html_header(nvram_get("node") . " setup", 0);
print "<link rel='stylesheet' href='${leafletcss}' />\n";
print "<script src='${leafletjs}'></script>\n";
print "<link rel='stylesheet' href='${leafletcss}' />\n" if $pingOk;
print "<script src='${leafletjs}'></script>\n" if $pingOk;
print "</head>";
print "<body><center>\n";