diff --git a/html/launcher.php b/html/launcher.php index 42d3036..5f8a66a 100755 --- a/html/launcher.php +++ b/html/launcher.php @@ -542,6 +542,53 @@ if ($type == "linux_memory") { echo $output; } +if ($type == "wifi_status") { + header('Content-Type: application/json'); + + $result = array( + 'connected' => false, + 'mode' => 'unknown', + 'ssid' => '', + 'ip' => '', + 'hostname' => '' + ); + + // Get hostname + $result['hostname'] = trim(shell_exec('hostname')); + + // Get wlan0 connection info + $connection = trim(shell_exec("nmcli -t -f GENERAL.CONNECTION device show wlan0 2>/dev/null | cut -d: -f2")); + + if (!empty($connection) && $connection != '--') { + $result['connected'] = true; + $result['ssid'] = $connection; + + // Check if it's a hotspot + if (strpos(strtolower($connection), 'hotspot') !== false || strpos($connection, 'nebuleair') !== false) { + $result['mode'] = 'hotspot'; + } else { + $result['mode'] = 'wifi'; + } + + // Get IP address + $ip = trim(shell_exec("nmcli -t -f IP4.ADDRESS device show wlan0 2>/dev/null | head -1 | cut -d: -f2 | cut -d/ -f1")); + if (!empty($ip)) { + $result['ip'] = $ip; + } + } else { + // Check if eth0 is connected + $eth_ip = trim(shell_exec("nmcli -t -f IP4.ADDRESS device show eth0 2>/dev/null | head -1 | cut -d: -f2 | cut -d/ -f1")); + if (!empty($eth_ip)) { + $result['connected'] = true; + $result['mode'] = 'ethernet'; + $result['ssid'] = 'Ethernet'; + $result['ip'] = $eth_ip; + } + } + + echo json_encode($result); +} + if ($type == "sshTunnel") { $ssh_port=$_GET['ssh_port']; $command = 'sudo ssh -i /var/www/.ssh/id_rsa -f -N -R "'.$ssh_port.':localhost:22" -p 50221 -o StrictHostKeyChecking=no "airlab_server1@aircarto.fr"'; diff --git a/html/saraR4.html b/html/saraR4.html index e802b86..67e91d2 100755 --- a/html/saraR4.html +++ b/html/saraR4.html @@ -375,6 +375,15 @@