feat(ui): add WiFi/network info to self-test

Add informational network status check at the beginning of self-test:
- Shows connection mode (Hotspot, WiFi, or Ethernet)
- Displays SSID/connection name
- Shows IP address and hostname.local
- Add wifi_status endpoint in launcher.php using nmcli

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
PaulVua
2026-02-10 10:39:02 +01:00
parent 3c8558ea1d
commit 3a6b529cba
2 changed files with 116 additions and 0 deletions

View File

@@ -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"';