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], ["sudo", "-n", "nmcli", "con", "mod", _HOTSPOT_PROFILE, "802-11-wireless-security.psk", password],
capture_output=True, text=True, timeout=10, check=True, capture_output=True, text=True, timeout=10, check=True,
) )
return jsonify(message=f"Hotspot SSID updated to '{ssid}'." # Restart the hotspot so changes take effect immediately.
+ (" Password saved." if password else "") subprocess.run(
+ " Restart hotspot or device to apply.") ["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: except subprocess.CalledProcessError as e:
return jsonify(error=f"Could not update hotspot: {e.stderr.strip() or 'nmcli failed'}"), 500 return jsonify(error=f"Could not update hotspot: {e.stderr.strip() or 'nmcli failed'}"), 500
+2
View File
@@ -1,3 +1,5 @@
yaris ALL=(root) NOPASSWD: /usr/bin/nmcli -t -f 802-11-wireless.ssid con show Hotspot-local yaris ALL=(root) NOPASSWD: /usr/bin/nmcli -t -f 802-11-wireless.ssid con show Hotspot-local
yaris ALL=(root) NOPASSWD: /usr/bin/nmcli con mod Hotspot-local 802-11-wireless.ssid * yaris ALL=(root) NOPASSWD: /usr/bin/nmcli con mod Hotspot-local 802-11-wireless.ssid *
yaris ALL=(root) NOPASSWD: /usr/bin/nmcli con mod Hotspot-local 802-11-wireless-security.psk * yaris ALL=(root) NOPASSWD: /usr/bin/nmcli con mod Hotspot-local 802-11-wireless-security.psk *
yaris ALL=(root) NOPASSWD: /usr/bin/nmcli con down Hotspot-local
yaris ALL=(root) NOPASSWD: /usr/bin/nmcli con up Hotspot-local