Hotspot: address review comments.

* POST /api/hotspot/settings checks is_docker_mode() directly instead of
  string-matching the error message (still 500, matching the sibling
  hotspot/bluetooth/throttle endpoints).
* Escape \ ; , " in the WiFi QR code per the WPA QR format.
* Skip the controller.yaml write when a settings update changes nothing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Roland 2026-07-04 08:56:12 -06:00
parent 0d2c13e4e7
commit 2887309aae
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
4 changed files with 27 additions and 8 deletions

View file

@ -76,17 +76,22 @@ def update_hotspot_settings(device: str = None, ssid: str = None, password: str
if password is not None and not 8 <= len(password) <= 63:
return {"success": False, "error": "Hotspot password must be 8 to 63 characters"}
changed = False
if device:
config_lib.update_config('hotspot.device', device)
changed = True
if ssid:
config_lib.update_config('hotspot.ssid', ssid)
changed = True
if password:
config_lib.update_config('hotspot.password', password)
changed = True
try:
config_lib.save_config()
except RuntimeError as e:
return {"success": False, "error": str(e)}
if changed:
try:
config_lib.save_config()
except RuntimeError as e:
return {"success": False, "error": str(e)}
logger.info("Hotspot settings updated (device=%s, ssid=%s)", get_hotspot_device(), get_hotspot_ssid())
return {