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) <noreply@anthropic.com>
This commit is contained in:
@@ -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"
|
||||
]
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user