feat: access point name and password setting, ap_on in status

- ap_ssid and ap_password on /api/network: empty name uses led-XXXXXX, a password of 8-63 characters
  makes the access point WPA2, empty is open; the password is never sent back (ap_password_set)
- a running access point restarts when its name or password changes
- /api/status reports ap_on; the web page gets the fields

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
jimmyandClaude Sonnet 5.5 committed 2026-11-12 00:46:04 +13:00
1 parent af82cb4c4a
commit 59eb37cad5
7 files changed
+97 -6

No files matched your search

+18
View File
@@ -596,6 +596,8 @@
$('globalOut').textContent = level;
}
$('apName').textContent = s.ap_ssid;
$('apInfo').hidden = !s.ap_on;
$('apOffInfo').hidden = !!s.ap_on;
$('staState').textContent = s.sta_connected ? 'connected (' + s.sta_ip + ')' : 'not connected';
await loadPatterns(s);
}
@@ -888,6 +890,11 @@
$('sGw').value = n.gateway;
$('sDns').value = n.dns;
$('apOn').checked = n.ap_enabled !== false;
$('apSsid').value = n.ap_ssid_custom ? n.ap_ssid : '';
$('apSsid').placeholder = n.ap_ssid;
$('apPass').value = '';
$('apOpen').checked = false;
$('apPassHint').textContent = n.ap_password_set ? '(set; blank keeps it)' : '(open network now)';
$('ddpOn').checked = n.ddp_enabled !== false;
updateStaticFields();
}
@@ -942,12 +949,23 @@
dns: $('sDns').value.trim(),
ap_enabled: $('apOn').checked,
ddp_enabled: $('ddpOn').checked,
ap_ssid: $('apSsid').value.trim(),
};
if ($('apOpen').checked) {
body.ap_password = '';
} else if ($('apPass').value) {
body.ap_password = $('apPass').value;
}
$('netMsg').textContent = 'Saving…';
try {
const j = await post('/api/network', body);
$('netMsg').textContent = `Saved. The client reconnects; open http://${j.address}/ in a few seconds.`;
$('mdnsName').textContent = body.hostname;
$('apPass').value = '';
$('apOpen').checked = false;
if (body.ap_password !== undefined) {
$('apPassHint').textContent = body.ap_password ? '(set; blank keeps it)' : '(open network now)';
}
} catch (e) {
$('netMsg').textContent = e.message;
}