fix: duplicate to the config.mesh structure after saving. (#170)

This commit is contained in:
dman776 2021-11-09 23:16:25 -06:00 committed by GitHub
parent f0c62fc2a7
commit 90d9ac94bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 10 deletions

View File

@ -13,3 +13,6 @@ config map
option maptiles 'http://stamen-tiles-{s}.a.ssl.fastly.net/terrain/{z}/{x}/{y}.jpg'
config meshstatus
config location

View File

@ -221,6 +221,7 @@ if($parms{button_updatelocation})
# set values/commit
$rc=&uci_set_indexed_option("aredn","location",0,"gridsquare", $parms{gridsquare});
$rc=&uci_commit("aredn");
&uci_clone("aredn");
push @errors, "Cannot save gridsquare in uci" if $rc ne "0";
push @output, "Gridsquare updated.\n";
} else {
@ -229,6 +230,7 @@ if($parms{button_updatelocation})
} else {
$rc=&uci_set_indexed_option("aredn","location",0,"gridsquare", "");
$rc=&uci_commit("aredn");
&uci_clone("aredn");
push @output, "Gridsquare purged.\n";
}
@ -242,6 +244,7 @@ if($parms{button_updatelocation})
$rc=&uci_set_indexed_option("aredn","location",0,"lat", $parms{latitude});
$rc=&uci_set_indexed_option("aredn","location",0,"lon", $parms{longitude});
$rc=&uci_commit("aredn");
&uci_clone("aredn");
push @errors, "Cannot save latitude/longitude in uci" if $rc ne "0";
push @output, "Lat/lon updated.\n";
} else {
@ -254,6 +257,7 @@ if($parms{button_updatelocation})
$rc=&uci_set_indexed_option("aredn","location",0,"lat", "");
$rc=&uci_set_indexed_option("aredn","location",0,"lon", "");
$rc=&uci_commit("aredn");
&uci_clone("aredn");
push @output, "Lat/lon purged.\n";
}
}

View File

@ -73,16 +73,11 @@ if ( ! $wifi_disable )
$node_desc = `/sbin/uci -q get system.\@system[0].description`; #pull the node description from uci
#get location info if available
$lat_lon = "<strong>Location Not Available</strong>";
if(-f "/etc/latlon") {
$rcgood=open(FILE, "/etc/latlon");
if($rcgood) {
while(<FILE>){
chomp;
push @lat_lon,$_;
}
}
close(FILE);
$lat_lon = "<center><strong>Location: </strong> $lat_lon[0] $lat_lon[1]</center>";
$lat=&uci_get_indexed_option("aredn","location",0,"lat");
$lon=&uci_get_indexed_option("aredn","location",0,"lon");
if($lat ne "" and $lon ne "") {
$lat_lon = "<center><strong>Location: </strong> $lat $lon</center>";
}
$olsrTotal = `/sbin/ip route list table 30 | wc -l`; #num hosts olsr is keeping track of
$olsrNodes = `/sbin/ip route list table 30 | egrep "/" | wc -l`; #num *nodes* on the network (minus other hosts)