From 6a00ab85d90acc1928470c0351e7125058ed0892 Mon Sep 17 00:00:00 2001 From: PaulVua Date: Tue, 17 Mar 2026 19:58:49 +0100 Subject: [PATCH] Fix: overlay connexion WiFi affiche hostname.local au lieu de deviceName.local Le mDNS utilise le hostname systeme (aircarto), pas le deviceName de la DB (NebuleAir-pro034). Ajout de /html/ dans l'URL aussi. Co-Authored-By: Claude Opus 4.6 (1M context) --- html/launcher.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/html/launcher.php b/html/launcher.php index 9a3ddc4..6557b3c 100755 --- a/html/launcher.php +++ b/html/launcher.php @@ -1109,7 +1109,7 @@ if ($type == "wifi_connect") { $SSID=$_GET['SSID']; $PASS=$_GET['pass']; - // Get device name from database for instructions + // Get device name and hostname for instructions try { $db = new PDO("sqlite:$database_path"); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); @@ -1121,6 +1121,7 @@ if ($type == "wifi_connect") { } catch (PDOException $e) { $deviceName = 'NebuleAir'; } + $hostname = trim(shell_exec('hostname 2>/dev/null')) ?: 'aircarto'; // Launch connection script in background $script_path = '/var/www/nebuleair_pro_4g/connexion.sh'; @@ -1133,6 +1134,7 @@ if ($type == "wifi_connect") { 'success' => true, 'ssid' => $SSID, 'deviceName' => $deviceName, + 'hostname' => $hostname, 'message' => 'Connection attempt started', 'instructions' => [ 'fr' => [ @@ -1140,7 +1142,7 @@ if ($type == "wifi_connect") { 'step1' => "Le capteur tente de se connecter au réseau « $SSID »", 'step2' => "Vous allez être déconnecté du hotspot dans quelques secondes", 'step3' => "Reconnectez-vous au WiFi « $SSID » sur votre appareil", - 'step4' => "Accédez au capteur via http://$deviceName.local ou cherchez son IP dans votre routeur", + 'step4' => "Accédez au capteur via http://$hostname.local/html/ ou cherchez son IP dans votre routeur", 'warning' => "Si la connexion échoue, le capteur recréera automatiquement le hotspot" ], 'en' => [ @@ -1148,7 +1150,7 @@ if ($type == "wifi_connect") { 'step1' => "The sensor is attempting to connect to network « $SSID »", 'step2' => "You will be disconnected from the hotspot in a few seconds", 'step3' => "Reconnect your device to WiFi « $SSID »", - 'step4' => "Access the sensor via http://$deviceName.local or find its IP in your router", + 'step4' => "Access the sensor via http://$hostname.local/html/ or find its IP in your router", 'warning' => "If connection fails, the sensor will automatically recreate the hotspot" ] ]