mirror of https://github.com/aredn/aredn.git
bugfix: check to see if internet is reachable before loading external resources (#224)
This commit is contained in:
parent
7a1817935c
commit
b11a4fc95d
|
@ -1703,9 +1703,13 @@ sub is_online()
|
||||||
{
|
{
|
||||||
my $online=0;
|
my $online=0;
|
||||||
if(get_default_gw() ne "none")
|
if(get_default_gw() ne "none")
|
||||||
|
{
|
||||||
|
system("ping -W1 -c1 8.8.8.8 &>/dev/null"); # google DNS
|
||||||
|
if($? eq 0)
|
||||||
{
|
{
|
||||||
$online=1;
|
$online=1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $online;
|
return $online;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -473,8 +473,8 @@ my ($rc, $maptiles, $leafletcss, $leafletjs);
|
||||||
|
|
||||||
http_header() unless $debug == 2;
|
http_header() unless $debug == 2;
|
||||||
html_header(nvram_get("node") . " setup", 0);
|
html_header(nvram_get("node") . " setup", 0);
|
||||||
print "<link rel='stylesheet' href='${leafletcss}' />\n";
|
print "<link rel='stylesheet' href='${leafletcss}' />\n" if $pingOk;
|
||||||
print "<script src='${leafletjs}'></script>\n";
|
print "<script src='${leafletjs}'></script>\n" if $pingOk;
|
||||||
print "</head>";
|
print "</head>";
|
||||||
print "<body><center>\n";
|
print "<body><center>\n";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue