httpd: move the management VLAN into /vlanlist

Review feedback on #306. The value used to ride in /information.json and
the picker fetched /vlanlist separately, so the page needed both requests
to mean anything. /vlanlist now answers {"mgmt":N,"vlan":[...]} and the
picker reads both from the one response. Both consumers in vlan.js were
taught the new shape, and /information.json no longer carries mgmt_vlan.

The truncation guard now reserves 141 bytes instead of 139: the closing
grew to two bytes with the wrapping object, and the comma in front of a
non-first entry was never counted, so the worst case could land one byte
past outbuf even before this change. char_to_html() does not check.

The comments added on this branch are gone as well, style.css and
system.js both, since these files are served byte for byte.

page_impl.rel stays at DSEG 5, OSEG 0, BSEG 3 and the image reports the
same 10183 bytes of XDATA before and after.
This commit is contained in:
d00f
2026-08-08 18:26:49 +02:00
parent 1a55a134c7
commit e30976be76
4 changed files with 14 additions and 16 deletions
+6 -7
View File
@@ -133,7 +133,7 @@ function fetchIP() {
document.getElementById("gw").value=s.ip_gateway;
document.getElementById("hostname").value=s.hostname;
document.getElementById("model").textContent=s.hw_ver;
loadMgmtVlan(parseInt(s.mgmt_vlan, 10) || 0);
loadMgmtVlan();
clearInterval(systemInterval);
// Fetch and populate the config textbox
fetchConfig().then((configText) => {
@@ -170,14 +170,13 @@ window.addEventListener("load", function() {
var mgmtVlanCurrent = 0;
/* Populate the management-VLAN picker from the configured VLANs. If management
* is untagged there is no VLAN to select, so show that as a disabled entry
* rather than inventing an id the switch would reject. */
function loadMgmtVlan(cur) {
function loadMgmtVlan() {
var sel = document.getElementById('mgmtvlan');
if (!sel) return;
mgmtVlanCurrent = cur;
fetch('/vlanlist').then(function(r) { return r.json(); }).then(function(list) {
fetch('/vlanlist').then(function(r) { return r.json(); }).then(function(d) {
var cur = d.mgmt || 0;
var list = d.vlan || [];
mgmtVlanCurrent = cur;
sel.innerHTML = '';
if (!cur) {
var none = document.createElement('option');