From 76e2eecaec5817f07ee3f890988f29a0717afa43 Mon Sep 17 00:00:00 2001 From: Christian Zeitnitz Date: Wed, 10 Mar 2021 23:45:04 +0100 Subject: [PATCH] Correct internet device GUI and udev config --- ajax/networking/save_net_dev_config.php | 2 +- app/js/custom.js | 4 +- config/config.php | 2 + includes/dashboard.php | 9 +++-- includes/functions.php | 5 ++- includes/get_clients.php | 4 ++ includes/wifi_functions.php | 1 + templates/dashboard.php | 2 +- templates/networking.php | 52 ++++++++++++------------- 9 files changed, 46 insertions(+), 35 deletions(-) diff --git a/ajax/networking/save_net_dev_config.php b/ajax/networking/save_net_dev_config.php index 6c34e053..af79cfb4 100644 --- a/ajax/networking/save_net_dev_config.php +++ b/ajax/networking/save_net_dev_config.php @@ -88,7 +88,7 @@ if (isset($_POST['interface'])) { $cfg['static'] = $_POST[$int.'-static']; $cfg['failover'] = $_POST[$int.'-failover']; } - if (write_php_ini($cfg, RASPI_CONFIG_NETWORKING.'/'.$file)) { + if (write_php_ini($cfg, RASPI_CONFIG.'/networking/'.$file)) { $jsonData = ['return'=>0,'output'=>['Successfully Updated Network Configuration']]; } else { $jsonData = ['return'=>1,'output'=>['Error saving network configuration to file']]; diff --git a/app/js/custom.js b/app/js/custom.js index f298a77e..fff618af 100644 --- a/app/js/custom.js +++ b/app/js/custom.js @@ -130,8 +130,8 @@ function setupBtns() { $('#btnSummaryRefresh').click(function(){getAllInterfaces();}); $('.intsave').click(function(){ var int = $(this).data('int'); - saveNetDeviceSettings(int); - saveNetworkSettings(int); + var opts = $(this).data('opts'); + saveNetDeviceSettings(int,opts); }); $('.intapply').click(function(){ applyNetworkSettings(); diff --git a/config/config.php b/config/config.php index 2c476b57..f0516cfc 100755 --- a/config/config.php +++ b/config/config.php @@ -25,6 +25,8 @@ define('RASPI_TORPROXY_CONFIG', '/etc/tor/torrc'); define('RASPI_LIGHTTPD_CONFIG', '/etc/lighttpd/lighttpd.conf'); define('RASPI_ACCESS_CHECK_IP', '1.1.1.1'); define('RASPI_ACCESS_CHECK_DNS', 'one.one.one.one'); +define('RASPI_CLIENT_CONFIG_PATH', '/etc/raspap/networking/client_udev_prototypes.json'); +define('RASPI_CLIENT_SCRIPT_PATH', '/usr/local/sbin'); // Constant for the 5GHz wireless regulatory domain define('RASPI_5GHZ_ISO_ALPHA2', array('NL','US')); diff --git a/includes/dashboard.php b/includes/dashboard.php index 6d74581c..93e640c0 100755 --- a/includes/dashboard.php +++ b/includes/dashboard.php @@ -96,12 +96,12 @@ function DisplayDashboard(&$extraFooterScripts) $clientinfo=array("name"=>"none","type"=>-1,"connected"=>"n"); $raspi_client=$_SESSION['wifi_client_interface']; load_client_config(); - $clients = getClients(false); - if(!empty($clients)) { - $ncl=$clients["clients"]; + $client_devs = getClients(false); + if(!empty($client_devs)) { + $ncl=$client_devs["clients"]; if($ncl > 0) { $ty=-1; - foreach($clients["device"] as $dev) { + foreach($client_devs["device"] as $dev) { if(($id=array_search($dev["type"],$_SESSION["net-device-types"])) > $ty && !$dev["isAP"]) { $ty=$id; $clientinfo=$dev; @@ -162,6 +162,7 @@ function DisplayDashboard(&$extraFooterScripts) $client_interface = $clientinfo["name"]; } $apInterface = $_SESSION['ap_interface']; + $clientInterface = $raspi_client; $MACPattern = '"([[:xdigit:]]{2}:){5}[[:xdigit:]]{2}"'; if (getBridgedState()) { $moreLink = "hostapd_conf"; diff --git a/includes/functions.php b/includes/functions.php index 10699190..2a70712b 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -728,6 +728,8 @@ function getNightmode(){ } else { return false; } +} + // search array for matching string and return only first matching group function preg_only_match($pat,$haystack) { $match = ""; @@ -738,5 +740,6 @@ function preg_only_match($pat,$haystack) { } return $match; } -} + +?> diff --git a/includes/get_clients.php b/includes/get_clients.php index 999b5bfa..b04610a4 100644 --- a/includes/get_clients.php +++ b/includes/get_clients.php @@ -137,6 +137,10 @@ function getClients($simple=true) { break; default: } + if (!isset($cl["device"][$i]["signal"])){ + $cl["device"][$i]["signal"]= $cl["device"][$i]["connected"] == "n" ? "-100 dB (0%)": "0 dB (100%)";; + } + if (!isset($cl["device"][$i]["isAP"])) $cl["device"][$i]["isAP"]=false; } } return $cl; diff --git a/includes/wifi_functions.php b/includes/wifi_functions.php index 8296c57c..7aa4cece 100755 --- a/includes/wifi_functions.php +++ b/includes/wifi_functions.php @@ -157,3 +157,4 @@ function getWifiInterface() } } +?> \ No newline at end of file diff --git a/templates/dashboard.php b/templates/dashboard.php index 9c185ac6..bf841b59 100755 --- a/templates/dashboard.php +++ b/templates/dashboard.php @@ -107,7 +107,7 @@ - + diff --git a/templates/networking.php b/templates/networking.php index 90a3ab00..6df5ba87 100755 --- a/templates/networking.php +++ b/templates/networking.php @@ -13,8 +13,8 @@
@@ -84,31 +84,6 @@ -
-
-
-

-
-
- -
- - " > -
-

-
- - " > - - " > - - " > -
- -
-
-
-

@@ -194,6 +169,31 @@
+
+
+
+

+
+
+ +
+ + " > +
+

+
+ + " > + + " > + + " > +
+ +
+
+
+