From 90d9ac94bce8868be11e49b06fbb1babd67beafd Mon Sep 17 00:00:00 2001 From: dman776 Date: Tue, 9 Nov 2021 23:16:25 -0600 Subject: [PATCH] fix: duplicate to the config.mesh structure after saving. (#170) --- files/etc/config.mesh/aredn | 3 +++ files/www/cgi-bin/setup | 4 ++++ files/www/cgi-bin/status | 15 +++++---------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/files/etc/config.mesh/aredn b/files/etc/config.mesh/aredn index 757caba2..85b9337d 100644 --- a/files/etc/config.mesh/aredn +++ b/files/etc/config.mesh/aredn @@ -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 + diff --git a/files/www/cgi-bin/setup b/files/www/cgi-bin/setup index 4e3b79f4..0afb5aac 100755 --- a/files/www/cgi-bin/setup +++ b/files/www/cgi-bin/setup @@ -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"; } } diff --git a/files/www/cgi-bin/status b/files/www/cgi-bin/status index 3787344d..2ad5f12d 100755 --- a/files/www/cgi-bin/status +++ b/files/www/cgi-bin/status @@ -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 = "Location Not Available"; -if(-f "/etc/latlon") { - $rcgood=open(FILE, "/etc/latlon"); - if($rcgood) { - while(){ - chomp; - push @lat_lon,$_; - } - } - close(FILE); - $lat_lon = "
Location: $lat_lon[0] $lat_lon[1]
"; +$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 = "
Location: $lat $lon
"; } $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)