controller: address hotspot protocol review findings
Some checks are pending
CodeQL / Analyze (push) Waiting to run
Controller Tests / controller-tests (push) Waiting to run
Jest Tests / jest-tests (push) Waiting to run

- Reset a saved protocol the newly probed device does not support
  instead of offering it (both UIs); a successful probe is
  authoritative, the saved value is only kept when probing fails.
- Ignore out-of-order protocol probe responses when switching devices
  quickly (both UIs).
- Verify the WPA2 rollback after a failed WPA3 activation; report that
  the hotspot may be down instead of claiming the revert succeeded.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Roland 2026-07-28 20:59:10 -06:00
parent 8687816b84
commit 2baa9cbd2e
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
5 changed files with 67 additions and 12 deletions

View file

@ -1464,14 +1464,19 @@
savedProtocol = savedProtocol || select.value;
try {
const response = await apiCall(`api/hotspot/protocols?device=${encodeURIComponent(device)}`);
// Ignore out-of-order responses when the user switches devices quickly.
if (document.getElementById('hotspot-device').value !== device) return;
select.innerHTML = '';
// Keep the saved protocol selectable even if the device does not report it.
const protocols = [...new Set([...(response.protocols || []), savedProtocol])].filter(Boolean);
// Keep the saved protocol only when probing found nothing (e.g. the saved
// device is unplugged); a successful probe is authoritative.
const supported = (response.protocols || []).filter(Boolean);
const protocols = supported.length ? supported : [savedProtocol].filter(Boolean);
const selected = protocols.includes(savedProtocol) ? savedProtocol : protocols[0];
for (const protocol of protocols) {
const option = document.createElement('option');
option.value = protocol;
option.textContent = hotspotProtocolLabels[protocol] || protocol;
option.selected = protocol === savedProtocol;
option.selected = protocol === selected;
select.appendChild(option);
}
} catch (e) {