mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-03 21:29:59 -05:00
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:
parent
0d2c13e4e7
commit
2887309aae
4 changed files with 27 additions and 8 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue