From 8d0507852aa1be614fe74d034aee08b1c0a988e3 Mon Sep 17 00:00:00 2001 From: PaulVua Date: Tue, 17 Mar 2026 17:34:30 +0100 Subject: [PATCH] Fix forget WiFi: appel bash explicite + disconnect wlan0 avant delete Co-Authored-By: Claude Opus 4.6 (1M context) --- forget_wifi.sh | 6 +++++- html/launcher.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/forget_wifi.sh b/forget_wifi.sh index d661629..e645c84 100644 --- a/forget_wifi.sh +++ b/forget_wifi.sh @@ -18,6 +18,10 @@ fi echo "Forgetting WiFi connection: $ACTIVE_WIFI" +# Disconnect wlan0 first to prevent NetworkManager from auto-reconnecting +sudo nmcli device disconnect wlan0 +echo "wlan0 disconnected" + # Delete (forget) the saved connection sudo nmcli connection delete "$ACTIVE_WIFI" @@ -27,7 +31,7 @@ else echo "Failed to delete connection '$ACTIVE_WIFI'" fi -sleep 2 +sleep 1 # Start hotspot echo "Starting hotspot with SSID: $DEVICE_NAME" diff --git a/html/launcher.php b/html/launcher.php index f7b4ad2..065fc8b 100755 --- a/html/launcher.php +++ b/html/launcher.php @@ -1172,7 +1172,7 @@ if ($type == "wifi_forget") { // Launch forget script in background $script_path = '/var/www/nebuleair_pro_4g/forget_wifi.sh'; $log_file = '/var/www/nebuleair_pro_4g/logs/app.log'; - shell_exec("$script_path >> $log_file 2>&1 &"); + shell_exec("bash $script_path >> $log_file 2>&1 &"); header('Content-Type: application/json'); echo json_encode([