mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-02 04:46:18 -05:00
captive portal: address review
* React: re-read the hotspot address whenever the HotspotToggle starts or stops the hotspot, matching the fallback UI's refresh-on-status. * A WPA3 start that reverts to WPA2 leaves the hotspot up, so it now gets the captive portal address correction too. * The corrective `nmcli connection up` logs a warning on a non-zero exit; dnsmasq would otherwise keep the old address silently. * HotspotStatusResponse.captive_portal defaults to true like everywhere else. * Trim design narrative from the module docstring and React comments. * The include-before-activate test now observes the include at the moment of the `nmcli ... hotspot` call instead of inferring from call order. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
6bea09600e
commit
85c27b91df
6 changed files with 118 additions and 28 deletions
|
|
@ -530,6 +530,8 @@ def start_hotspot() -> dict:
|
|||
capture_output=True, text=True, timeout=30,
|
||||
)
|
||||
if revert_modify.returncode == 0 and revert_up.returncode == 0:
|
||||
# The hotspot is up (as WPA2), so it still needs its captive portal address.
|
||||
_fix_captive_portal_ip(device)
|
||||
return {"success": False,
|
||||
"error": f"WPA3 is not supported by {device}; hotspot reverted to WPA2: {error}"}
|
||||
revert_error = (revert_modify.stderr if revert_modify.returncode != 0 else revert_up.stderr).strip()
|
||||
|
|
@ -572,7 +574,10 @@ def _fix_captive_portal_ip(device: str):
|
|||
if not captive_portal_lib.apply_dnsmasq_config(ip):
|
||||
return
|
||||
try:
|
||||
subprocess.run(["nmcli", "connection", "up", "Hotspot"], capture_output=True, text=True, timeout=30)
|
||||
up = subprocess.run(["nmcli", "connection", "up", "Hotspot"], capture_output=True, text=True, timeout=30)
|
||||
if up.returncode != 0:
|
||||
logger.warning("Could not re-activate hotspot for captive portal; dnsmasq still serves the old"
|
||||
" address: %s", up.stderr.strip())
|
||||
except (subprocess.SubprocessError, FileNotFoundError) as e:
|
||||
logger.warning("Could not re-activate hotspot for captive portal: %s", e)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue