fix: hotspot save now restarts AP immediately (down + 1s wait + up)

This commit is contained in:
Mathieu Moran
2026-08-12 05:28:28 -04:00
parent a7ea97259d
commit 6ac750f53b
2 changed files with 14 additions and 3 deletions
+12 -3
View File
@@ -178,9 +178,18 @@ def hotspot_config_update():
["sudo", "-n", "nmcli", "con", "mod", _HOTSPOT_PROFILE, "802-11-wireless-security.psk", password],
capture_output=True, text=True, timeout=10, check=True,
)
return jsonify(message=f"Hotspot SSID updated to '{ssid}'."
+ (" Password saved." if password else "")
+ " Restart hotspot or device to apply.")
# Restart the hotspot so changes take effect immediately.
subprocess.run(
["sudo", "-n", "nmcli", "con", "down", _HOTSPOT_PROFILE],
capture_output=True, text=True, timeout=10,
)
time.sleep(1)
subprocess.run(
["sudo", "-n", "nmcli", "con", "up", _HOTSPOT_PROFILE],
capture_output=True, text=True, timeout=15, check=True,
)
return jsonify(message=f"Hotspot updated to '{ssid}' and restarted."
+ (" New password saved." if password else ""))
except subprocess.CalledProcessError as e:
return jsonify(error=f"Could not update hotspot: {e.stderr.strip() or 'nmcli failed'}"), 500