🎁 Sync 2026-10-28 19:35:15

This commit is contained in:
github-actions[bot] committed 2026-10-28 19:35:15 +08:00
1 parent 85209f310d
commit 390801c844
90 files changed
+5821 -1967

No files matched your search

@@ -286,31 +286,31 @@ function enhanceMemory() {
const usedPct = pctOf(inuse, total);
const summary = '%s: %s %s, %s %s (%s), %s %s, %s %s'.format(_('Memory'),
_('In use'), fmtBytes(inuse), _('Cache'), fmtBytes(reclaim), _('reclaimable'),
_('Free'), fmtBytes(free), _('Total'), fmtBytes(total));
_('In use', 'vantage-theme'), fmtBytes(inuse), _('Cache'), fmtBytes(reclaim), _('reclaimable'),
_('Free', 'vantage-theme'), fmtBytes(free), _('Total', 'vantage-theme'), fmtBytes(total));
const children = [
E('div', { 'class': 'v-meter-head' }, [
E('span', { 'class': 'v-meter-big' }, [ pctOf(available, total) + '%', E('small', {}, [ _('available') ]) ]),
E('span', { 'class': 'v-meter-big' }, [ pctOf(available, total) + '%', E('small', {}, [ _('available', 'vantage-theme') ]) ]),
E('span', { 'class': 'v-meter-sub' }, [ '%s / %s'.format(fmtBytes(available), fmtBytes(total)) ])
]),
E('div', { 'class': 'v-meter-bar', 'role': 'img', 'aria-label': summary }, [
segment('v-seg-used' + (usedPct >= 90 ? ' is-crit' : usedPct >= 75 ? ' is-warn' : ''), inuse, total, _('In use')),
segment('v-seg-used' + (usedPct >= 90 ? ' is-crit' : usedPct >= 75 ? ' is-warn' : ''), inuse, total, _('In use', 'vantage-theme')),
segment('v-seg-cache', reclaim, total, _('Cache') + ' (' + _('reclaimable') + ')')
]),
E('ul', { 'class': 'v-meter-legend', 'aria-hidden': 'true' }, [
legendKey('v-seg-used', _('In use'), inuse),
legendKey('v-seg-used', _('In use', 'vantage-theme'), inuse),
legendKey('v-seg-cache', _('Cache'), reclaim, _('reclaimable')),
legendKey('v-seg-free', _('Free'), free)
legendKey('v-seg-free', _('Free', 'vantage-theme'), free)
])
];
if (swap) {
const swapUsed = swap.total - swap.value;
children.push(E('div', { 'class': 'v-meter-rows v-meter-swap' }, E('div', { 'class': 'v-meter-row' }, [
E('span', { 'class': 'v-meter-label' }, [ _('Swap') ]),
E('span', { 'class': 'v-meter-label' }, [ _('Swap', 'vantage-theme') ]),
E('div', { 'class': 'v-meter-bar is-thin', 'role': 'img',
'aria-label': '%s: %s / %s'.format(_('Swap'), fmtBytes(swapUsed), fmtBytes(swap.total)) },
'aria-label': '%s: %s / %s'.format(_('Swap', 'vantage-theme'), fmtBytes(swapUsed), fmtBytes(swap.total)) },
segment('v-seg-used', swapUsed, swap.total)),
E('span', { 'class': 'v-meter-val' }, [ E('b', {}, [ fmtBytes(swapUsed) ]), ' / ' + fmtBytes(swap.total) ])
])));
@@ -367,6 +367,19 @@ function decorateRadios() {
});
}
/* Port status: the ▲ / ▼ before each counter in a span of its own, for the
dashboard's upload and download colours */
function decoratePorts() {
document.querySelectorAll('#view .ifacebox > .ifacebox-head.cbi-tooltip-container + .ifacebox-body > .cbi-tooltip-container').forEach(stats => {
Array.prototype.slice.call(stats.childNodes).forEach(n => {
const dir = n.nodeType === 3 && { '▲': 'tx', '▼': 'rx' }[n.data.charAt(0)];
if (!dir) return;
stats.insertBefore(E('span', { 'class': 'vt-port-dir', 'data-dir': dir }, [ n.data.charAt(0) ]), n);
n.data = n.data.slice(1);
});
});
}
function setupStockEnhancers() {
const view = document.getElementById('view');
if (!view || !window.MutationObserver) return;
@@ -375,7 +388,7 @@ function setupStockEnhancers() {
const run = () => {
if (busy) return;
busy = true;
try { enhanceMemory(); enhanceStorage(); decorateRadios(); }
try { enhanceMemory(); enhanceStorage(); decorateRadios(); decoratePorts(); }
catch (e) { if (window.console) console.warn('vantage: status enhancer', e); }
busy = false;
};
@@ -891,7 +904,7 @@ return baseclass.extend({
ul.appendChild(item);
}
fly.appendChild(ul);
fly.appendChild(E('div', { 'class': 'vt-fly-foot' }, [ _('Press'), ' ', E('kbd', {}, [ 'Ctrl K' ]), ' ', _('to search all pages') ]));
fly.appendChild(E('div', { 'class': 'vt-fly-foot' }, [ _('Press', 'vantage-theme'), ' ', E('kbd', {}, [ 'Ctrl K' ]), ' ', _('to search all pages') ]));
fly.setAttribute('data-cat', cat.name);
fly.setAttribute('role', 'region');
fly.setAttribute('aria-labelledby', 'vt-fly-title');
@@ -1087,9 +1100,9 @@ return baseclass.extend({
actions() {
const pref = this.themePref();
const list = [];
if (pref !== 'dark') list.push({ title: _('Use dark theme'), path: _('Appearance'), icon: 'moon', run: () => this.setTheme('dark') });
if (pref !== 'light') list.push({ title: _('Use light theme'), path: _('Appearance'), icon: 'sun', run: () => this.setTheme('light') });
if (pref !== 'auto') list.push({ title: _('Follow system theme'), path: _('Appearance'), icon: 'auto', run: () => this.setTheme('auto') });
if (pref !== 'dark') list.push({ title: _('Use dark theme'), path: _('Appearance', 'vantage-theme'), icon: 'moon', run: () => this.setTheme('dark') });
if (pref !== 'light') list.push({ title: _('Use light theme'), path: _('Appearance', 'vantage-theme'), icon: 'sun', run: () => this.setTheme('light') });
if (pref !== 'auto') list.push({ title: _('Follow system theme'), path: _('Appearance', 'vantage-theme'), icon: 'auto', run: () => this.setTheme('auto') });
list.push({ title: _('Log out'), path: _('Session'), icon: 'logout', segs: [ 'admin', 'logout' ] });
list.forEach(a => { a.hay = a.path + ' › ' + a.title; a.group = _('Actions'); });
return list;
@@ -1110,14 +1123,14 @@ return baseclass.extend({
'aria-controls': 'vt-pal-list', 'aria-autocomplete': 'list', 'autocomplete': 'off', 'spellcheck': 'false',
'placeholder': _('Jump to a page or action…'), 'aria-label': _('Search pages')
});
const list = E('ul', { 'class': 'vt-pal-list', 'id': 'vt-pal-list', 'role': 'listbox', 'aria-label': _('Results') });
const list = E('ul', { 'class': 'vt-pal-list', 'id': 'vt-pal-list', 'role': 'listbox', 'aria-label': _('Results', 'vantage-theme') });
const count = E('span', { 'class': 'vt-pal-count' });
const box = E('div', { 'class': 'vt-pal', 'role': 'dialog', 'aria-modal': 'true', 'aria-label': _('Command palette') }, [
E('div', { 'class': 'vt-pal-field' }, [ svg('search', 18), input, E('kbd', {}, [ 'Esc' ]) ]),
list,
E('div', { 'class': 'vt-pal-foot' }, [
E('span', {}, [ E('kbd', {}, [ '↑' ]), E('kbd', {}, [ '↓' ]), _('navigate') ]),
E('span', {}, [ E('kbd', {}, [ '↵' ]), _('open') ]),
E('span', {}, [ E('kbd', {}, [ '↵' ]), _('open', 'vantage-theme') ]),
E('span', {}, [ E('kbd', {}, [ 'Esc' ]), _('close') ]),
count
])
@@ -1185,7 +1198,7 @@ return baseclass.extend({
if (!results.length)
pal.list.appendChild(E('li', { 'class': 'vt-pal-empty', 'role': 'presentation' }, [ _('No matching pages') ]));
pal.count.textContent = q ? '%d / %d'.format(results.length, pool.length) : '%d %s'.format(pool.length, _('items'));
pal.count.textContent = q ? '%d / %d'.format(results.length, pool.length) : '%d %s'.format(pool.length, _('items', 'vantage-theme'));
this.setPaletteActive(0, true);
},
@@ -1270,7 +1283,7 @@ return baseclass.extend({
const btn = document.getElementById('vt-theme');
if (btn) {
const names = { auto: _('Auto'), light: _('Light'), dark: _('Dark') };
const names = { auto: _('Auto', 'vantage-theme'), light: _('Light', 'vantage-theme'), dark: _('Dark', 'vantage-theme') };
const label = '%s: %s'.format(_('Colour theme'), names[pref]) + (pref === 'auto' ? ' (%s)'.format(dark ? names.dark : names.light) : '');
btn.textContent = '';
btn.appendChild(svg(pref === 'auto' ? 'auto' : (pref === 'dark' ? 'moon' : 'sun'), 18));
@@ -1499,7 +1512,7 @@ return baseclass.extend({
const btn = E('button', {
'type': 'button', 'class': 'cbi-button cbi-button-neutral vt-acts-more',
'aria-haspopup': 'menu', 'aria-expanded': 'false', 'aria-controls': 'vt-actmenu',
'aria-label': _('More actions'), 'title': _('More actions')
'aria-label': _('More actions', 'vantage-theme'), 'title': _('More actions', 'vantage-theme')
}, [ svg('more', 18) ]);
btn.addEventListener('click', ev => {
ev.preventDefault();
@@ -1516,7 +1529,7 @@ return baseclass.extend({
actMenuEl() {
if (this.actMenu) return this.actMenu;
const menu = E('div', { 'id': 'vt-actmenu', 'class': 'vt-actmenu', 'role': 'menu', 'aria-label': _('More actions'), 'hidden': 'hidden' });
const menu = E('div', { 'id': 'vt-actmenu', 'class': 'vt-actmenu', 'role': 'menu', 'aria-label': _('More actions', 'vantage-theme'), 'hidden': 'hidden' });
menu.addEventListener('keydown', ev => {
const items = Array.prototype.filter.call(menu.querySelectorAll('[role="menuitem"]'), n => !n.disabled);
const i = items.indexOf(document.activeElement);
@@ -27,7 +27,6 @@
const MODE_KEY = 'vantage.nft.mode';
const MAX_DEPTH = 8;
const MAX_STEPS = 200; /* rules drawn per chain before "Show all" */
const CTX = 'Status -> Firewall flow chart';
function storageGet(k) { try { return localStorage.getItem(k); } catch (e) { return null; } }
function storageSet(k, v) { try { localStorage.setItem(k, v); } catch (e) {} }
@@ -35,21 +34,21 @@ function reducedMotion() { return !!(window.matchMedia && window.matchMedia('(pr
function hookName(h) {
switch (h) {
case 'prerouting': return _('Prerouting', CTX);
case 'input': return _('Input', CTX);
case 'forward': return _('Forward', CTX);
case 'output': return _('Output', CTX);
case 'postrouting': return _('Postrouting', CTX);
case 'ingress': return _('Ingress', CTX);
case 'egress': return _('Egress', CTX);
case 'prerouting': return _('Prerouting', 'vantage-theme');
case 'input': return _('Input', 'vantage-theme');
case 'forward': return _('Forward', 'vantage-theme');
case 'output': return _('Output', 'vantage-theme');
case 'postrouting': return _('Postrouting', 'vantage-theme');
case 'ingress': return _('Ingress');
case 'egress': return _('Egress');
default: return h;
}
}
function stageName(s) {
switch (s.hook) {
case 'bridgeIn': case 'bridgeOut': return _('Bridge', CTX);
case 'bridged': return _('Bridged between ports', CTX);
case 'bridgeIn': case 'bridgeOut': return _('Bridge');
case 'bridged': return _('Bridged between ports', 'vantage-theme');
default: return hookName(s.hook);
}
}
@@ -153,14 +152,14 @@ function chip(kind, label, title) {
function verdictLabel(v) {
switch (v.kind) {
case 'accept': return _('Accept', CTX);
case 'drop': return _('Drop', CTX);
case 'reject': return _('Reject', CTX);
case 'queue': return _('Queue to a program', CTX);
case 'accept': return _('Accept', 'vantage-theme');
case 'drop': return _('Drop', 'vantage-theme');
case 'reject': return _('Reject', 'vantage-theme');
case 'queue': return _('Queue to a program', 'vantage-theme');
case 'nat':
return v.nat === 'masquerade' ? _('Masquerade', CTX) : v.nat === 'snat' ? _('Rewrite source', CTX)
: v.nat === 'dnat' ? _('Rewrite destination', CTX) : _('Redirect', CTX);
default: return _('Next rule', CTX);
return v.nat === 'masquerade' ? _('Masquerade', 'vantage-theme') : v.nat === 'snat' ? _('Rewrite source', 'vantage-theme')
: v.nat === 'dnat' ? _('Rewrite destination', 'vantage-theme') : _('Redirect', 'vantage-theme');
default: return _('Next rule', 'vantage-theme');
}
}
@@ -202,11 +201,11 @@ return baseclass.extend({
Object.keys(m.chains).forEach((k, i) => { this.ids[k] = 'v-nft-c' + i; });
this.cards = Object.create(null);
const tabs = E('ul', { 'class': 'cbi-tabmenu v-nft-tabs', 'role': 'group', 'aria-label': _('View', CTX) });
const tabs = E('ul', { 'class': 'cbi-tabmenu v-nft-tabs', 'role': 'group', 'aria-label': _('View', 'vantage-theme') });
const panel = E('div', { 'class': 'v-nft-panel' }, [
E('h3', {}, [ _('Packet path', CTX) ]),
E('h3', {}, [ _('Packet path', 'vantage-theme') ]),
this.chart(),
E('h3', {}, [ _('Chains', CTX) ]),
E('h3', {}, [ _('Chains', 'vantage-theme') ]),
E('div', { 'class': 'v-nft-chains' }, this.cardsOf(m.bases))
]);
m.others.forEach((t) => {
@@ -214,7 +213,7 @@ return baseclass.extend({
panel.appendChild(E('div', { 'class': 'v-nft-chains' }, this.cardsOf(t.chains)));
});
if (m.unused.length) {
panel.appendChild(E('h3', {}, [ m.namedMaps ? _('Chains no rule jumps to directly', CTX) : _('Chains no rule jumps to', CTX) ]));
panel.appendChild(E('h3', {}, [ m.namedMaps ? _('Chains no rule jumps to directly', 'vantage-theme') : _('Chains no rule jumps to', 'vantage-theme') ]));
panel.appendChild(E('div', { 'class': 'v-nft-chains' }, this.cardsOf(m.unused, true)));
}
@@ -229,7 +228,7 @@ return baseclass.extend({
if (mode === 'flow') this.fit();
};
/* LuCI's tab markup for the look; buttons for what they do */
[ [ 'flow', _('Flow', CTX) ], [ 'table', _('Rules table', CTX) ] ].forEach((t) => {
[ [ 'flow', _('Flow', 'vantage-theme') ], [ 'table', _('Rules table', 'vantage-theme') ] ].forEach((t) => {
const pick = (ev) => { ev.preventDefault(); storageSet(MODE_KEY, t[0]); set(t[0]); };
tabs.appendChild(E('li', { 'data-mode': t[0], 'role': 'presentation' }, [
E('a', { 'href': '#', 'role': 'button', 'click': pick,
@@ -247,7 +246,7 @@ return baseclass.extend({
const st = this.m.stages;
const arrow = () => E('span', { 'class': 'v-nft-arrow', 'aria-hidden': 'true' });
const pass = () => E('span', { 'class': 'v-nft-pass', 'aria-hidden': 'true' });
const end = (where) => E('span', { 'class': 'v-nft-endpoint', 'data-where': where }, [ where === 'device' ? _('This device', CTX) : _('Network', CTX) ]);
const end = (where) => E('span', { 'class': 'v-nft-endpoint', 'data-where': where }, [ where === 'device' ? _('This device', 'vantage-theme') : _('Network') ]);
const row = [ end('net') ];
[ st.ingress, st.bridgeIn, st.prerouting ].filter(Boolean).forEach((s) => { row.push(arrow(), this.stage(s)); });
row.push(arrow(), E('div', { 'class': 'v-nft-fork' }, [
@@ -263,9 +262,9 @@ return baseclass.extend({
const notes = [];
if (!st.bridged.chains.length)
notes.push(E('p', { 'class': 'v-nft-note' }, [ _('Frames bridged between ports of one bridge, such as Wi-Fi and LAN in br-lan on an access point, never reach the input, forward or output chains, and no bridge chain filters them here. (The kernel can hand them to the IP chains if br_netfilter is enabled; the ruleset doesn\'t show that.)', CTX) ]));
notes.push(E('p', { 'class': 'v-nft-note' }, [ _('Frames bridged between ports of one bridge, such as Wi-Fi and LAN in br-lan on an access point, never reach the input, forward or output chains, and no bridge chain filters them here. (The kernel can hand them to the IP chains if br_netfilter is enabled; the ruleset doesn\'t show that.)', 'vantage-theme') ]));
if (this.m.offload)
notes.push(E('p', { 'class': 'v-nft-note' }, [ _('Flow offloading is on: once a forwarded connection is established, its packets can skip prerouting, forward and postrouting, so these chains and their counters see only its first packets.', CTX) ]));
notes.push(E('p', { 'class': 'v-nft-note' }, [ _('Flow offloading is on: once a forwarded connection is established, its packets can skip prerouting, forward and postrouting, so these chains and their counters see only its first packets.', 'vantage-theme') ]));
this.el = E('div', { 'class': 'v-nft-chart' }, [
E('div', { 'class': 'v-nft-chart-row' }, row),
@@ -291,11 +290,11 @@ return baseclass.extend({
const none = s.hook === 'bridged' && !s.chains.length;
const name = [ stageName(s) ];
if (s.drops === 'all')
name.push(E('small', {}, [ s.only ? _('drops unmatched %s', CTX).format(familyName(s.only)) : _('drops unmatched', CTX) ]));
name.push(E('small', {}, [ s.only ? _('drops unmatched %s', 'vantage-theme').format(familyName(s.only)) : _('drops unmatched', 'vantage-theme') ]));
else if (s.drops === 'some')
name.push(E('small', {}, [ _('rules drop some', CTX) ]));
name.push(E('small', {}, [ _('rules drop some', 'vantage-theme') ]));
else if (none)
name.push(E('small', {}, [ _('no bridge chains', CTX) ]));
name.push(E('small', {}, [ _('no bridge chains', 'vantage-theme') ]));
/* a name twice at one hook (docker, mwan3): say whose */
const seen = Object.create(null);
s.chains.forEach((k) => { seen[m.chains[k].name] = (seen[m.chains[k].name] || 0) + 1; });
@@ -304,13 +303,13 @@ return baseclass.extend({
E('div', { 'class': 'v-nft-stage-chains' }, list.length ? list.map((k) => {
const c = m.chains[k];
const b = E('button', { 'type': 'button', 'class': 'v-nft-link', 'click': () => this.show(k),
'title': _('%s: table %s (%s), priority %d', CTX).format(c.name, c.table, familyName(c.family), c.prio) }, [ c.name ]);
'title': _('%s: table %s (%s), priority %d', 'vantage-theme').format(c.name, c.table, familyName(c.family), c.prio) }, [ c.name ]);
if (seen[c.name] > 1 || (nftmodel.HOOKS.indexOf(s.hook) < 0 && c.family !== 'netdev' && c.family !== 'bridge'))
b.appendChild(E('small', {}, [ c.table + ' · ' + familyName(c.family) ]));
else if (c.type === 'nat')
b.appendChild(E('small', {}, [ _('NAT', CTX) ]));
b.appendChild(E('small', {}, [ _('NAT') ]));
return b;
}) : none ? [] : [ E('span', { 'class': 'v-nft-none' }, [ _('no rules', CTX) ]) ])
}) : none ? [] : [ E('span', { 'class': 'v-nft-none' }, [ _('no rules', 'vantage-theme') ]) ])
]);
},
@@ -330,7 +329,7 @@ return baseclass.extend({
const out = keys.filter((k) => regular ? c(k).rules.length : live(c(k))).map((k) => this.card(k));
const empty = keys.filter((k) => regular ? !c(k).rules.length : !live(c(k)));
if (empty.length)
out.push(E('p', { 'class': 'v-nft-empty' }, [ _('No rules: %s', CTX).format(empty.map((k) => c(k).name).join(', ')) ]));
out.push(E('p', { 'class': 'v-nft-empty' }, [ _('No rules: %s', 'vantage-theme').format(empty.map((k) => c(k).name).join(', ')) ]));
return out;
},
@@ -338,19 +337,19 @@ return baseclass.extend({
const m = this.m, c = m.chains[k];
const meta = [];
if (c.base) {
meta.push(hookName(c.hook), _('priority %d', CTX).format(c.prio));
meta.push(hookName(c.hook), _('priority %d', 'vantage-theme').format(c.prio));
if (c.family !== 'inet') meta.push(familyName(c.family));
if (c.type === 'nat') meta.push(_('NAT', CTX));
if (c.dev.length) meta.push(_('on %s', CTX).format(c.dev.join(', ')));
if (c.type === 'nat') meta.push(_('NAT'));
if (c.dev.length) meta.push(_('on %s', 'vantage-theme').format(c.dev.join(', ')));
}
meta.push(N_(c.rules.length, '%d rule', '%d rules').format(c.rules.length));
meta.push(N_(c.rules.length, '%d rule', '%d rules', 'vantage-theme').format(c.rules.length));
/* other chains at the same hook (and family group) still see what
this one accepts */
if (c.base) {
const group = (f) => f === 'bridge' ? 'bridge' : f === 'netdev' ? 'netdev' : 'ip';
const more = Object.keys(m.chains).filter((o) => o !== k && m.chains[o].base && m.chains[o].hook === c.hook
&& group(m.chains[o].family) === group(c.family) && live(m.chains[o])).length;
if (more) meta.push(N_(more, '%d more chain at this hook', '%d more chains at this hook').format(more));
if (more) meta.push(N_(more, '%d more chain at this hook', '%d more chains at this hook', 'vantage-theme').format(more));
}
const card = E('details', { 'class': 'v-nft-card', 'id': this.ids[k], 'data-chain': c.name, 'data-family': c.family }, [
E('summary', {}, [ E('strong', {}, [ c.name ]), E('span', { 'class': 'v-nft-meta' }, [ meta.join(' · ') ]) ].concat(c.base ? [ this.policyChip(c) ] : []))
@@ -366,9 +365,9 @@ return baseclass.extend({
},
policyChip(c) {
if (c.policy === 'drop') return chip('drop', _('Drops unmatched', CTX));
if (c.type === 'filter') return chip('accept', _('Passes unmatched', CTX));
return chip('none', _('Leaves unmatched unchanged', CTX));
if (c.policy === 'drop') return chip('drop', _('Drops unmatched', 'vantage-theme'));
if (c.type === 'filter') return chip('accept', _('Passes unmatched', 'vantage-theme'));
return chip('none', _('Leaves unmatched unchanged', 'vantage-theme'));
},
/* where a packet goes when it leaves the chain without a verdict:
@@ -376,12 +375,12 @@ return baseclass.extend({
with none, the base chain's policy */
away(path, stack) {
const up = stack.length ? this.m.chains[stack[stack.length - 1]] : null;
if (up) return chip('return', _('Back to %s', CTX).format(up.name));
if (up) return chip('return', _('Back to %s', 'vantage-theme').format(up.name));
const b = this.m.chains[path[0]];
if (!b.base) return chip('return', _('Back to the calling chain', CTX));
if (b.policy === 'drop') return chip('drop', _('Drop: %s policy', CTX).format(b.name));
if (b.type === 'filter') return chip('accept', _('Pass: %s policy', CTX).format(b.name));
return chip('none', _('Unchanged', CTX));
if (!b.base) return chip('return', _('Back to the calling chain', 'vantage-theme'));
if (b.policy === 'drop') return chip('drop', _('Drop: %s policy', 'vantage-theme').format(b.name));
if (b.type === 'filter') return chip('accept', _('Pass: %s policy', 'vantage-theme').format(b.name));
return chip('none', _('Unchanged', 'vantage-theme'));
},
/* a chain's rules as steps. path: the chains opened above it (to stop
@@ -397,7 +396,7 @@ return baseclass.extend({
const also = row && r.verdict.kind !== 'vmap' && (nat || r.parts.acts > (r.parts.last >= 0 ? 1 : 0)) ? sideActions(row, r.parts, nat) : null;
/* a rule with conditions LuCI's rows can't supply never reads
as "Any packet" */
const label = r.comment || (cond ? '' : r.parts.conds ? _('Conditions in the rules table', CTX) : _('Any packet', 'nft match any traffic'));
const label = r.comment || (cond ? '' : r.parts.conds ? _('Conditions in the rules table', 'vantage-theme') : _('Any packet', 'nft match any traffic'));
const what = [ E('div', { 'class': 'v-nft-what-name', 'data-muted': String(!r.comment && !cond && !!r.parts.conds) }, [ label ]) ];
if (!r.comment && cond) what[0] = cond;
else if (cond) what.push(cond);
@@ -405,7 +404,7 @@ return baseclass.extend({
const then = this.outcome(r.verdict, c, path, stack);
if (r.counter)
then.push(E('span', { 'class': 'v-nft-count', 'title': _('Traffic matched by rule: %.1000mPackets, %.1024mBytes', 'nft counter').format(r.counter.packets, r.counter.bytes) },
[ _('%s matched', CTX).format('%.1024mB'.format(r.counter.bytes)) ]));
[ _('%s matched', 'vantage-theme').format('%.1024mB'.format(r.counter.bytes)) ]));
return E('li', { 'class': 'v-nft-step' }, [
E('span', { 'class': 'v-nft-n' }, [ String(r.index + 1) ]),
E('div', { 'class': 'v-nft-what' }, what),
@@ -419,7 +418,7 @@ return baseclass.extend({
E('button', { 'type': 'button', 'class': 'v-nft-verdict v-nft-jump', 'click': () => {
c.rules.slice(MAX_STEPS).forEach((r) => list.insertBefore(step(r), more));
more.remove();
} }, [ N_(c.rules.length - MAX_STEPS, 'Show %d more rule', 'Show %d more rules').format(c.rules.length - MAX_STEPS) ])
} }, [ N_(c.rules.length - MAX_STEPS, 'Show %d more rule', 'Show %d more rules', 'vantage-theme').format(c.rules.length - MAX_STEPS) ])
]);
list.appendChild(more);
}
@@ -433,10 +432,10 @@ return baseclass.extend({
const tk = nftmodel.keyOf(c.family, c.table, target);
const label = (key != null ? key + ' → ' : '→ ') + target;
if (!this.m.chains[tk]) return chip(kind, label);
if (path.indexOf(tk) >= 0) return chip(kind, label + ' ' + _('(open above)', CTX));
if (path.length >= MAX_DEPTH) return chip(kind, label + ' ' + _('(too deep to open here)', CTX));
if (path.indexOf(tk) >= 0) return chip(kind, label + ' ' + _('(open above)', 'vantage-theme'));
if (path.length >= MAX_DEPTH) return chip(kind, label + ' ' + _('(too deep to open here)', 'vantage-theme'));
const b = E('button', { 'type': 'button', 'class': 'v-nft-verdict v-nft-jump', 'data-kind': kind, 'aria-expanded': 'false',
'title': kind === 'goto' ? _('Continues in %s and does not come back here', CTX).format(target) : _('Continues in %s, then comes back here', CTX).format(target) }, [ label ]);
'title': kind === 'goto' ? _('Continues in %s and does not come back here', 'vantage-theme').format(target) : _('Continues in %s, then comes back here', 'vantage-theme').format(target) }, [ label ]);
let sub = null;
b.addEventListener('click', () => {
if (!sub) {
@@ -452,7 +451,7 @@ return baseclass.extend({
};
if (v.kind === 'return') return [ this.away(path, stack) ];
if (v.kind === 'jump' || v.kind === 'goto') return [ jump(v.kind, v.target) ];
if (v.kind === 'vmap' && v.named) return [ chip('none', _('Verdict map %s', CTX).format(v.named)) ];
if (v.kind === 'vmap' && v.named) return [ chip('none', _('Verdict map %s', 'vantage-theme').format(v.named)) ];
if (v.kind === 'vmap') {
/* keys with the same verdict share a chip: "established, related → Accept" */
const out = [], same = Object.create(null);
@@ -473,7 +472,7 @@ return baseclass.extend({
end(path, stack) {
return E('li', { 'class': 'v-nft-step v-nft-step-end' }, [
E('span', { 'class': 'v-nft-n', 'aria-hidden': 'true' }),
E('div', { 'class': 'v-nft-what' }, [ _('No rule matched', CTX) ]),
E('div', { 'class': 'v-nft-what' }, [ _('No rule matched', 'vantage-theme') ]),
E('div', { 'class': 'v-nft-then' }, [ this.away(path, stack) ])
]);
}
@@ -785,6 +785,8 @@ a.vt-crumb:hover { color: var(--text); }
padding: 10px !important;
border: none !important;
}
/* Card padding supplies the space after the final paragraph. */
.cbi-section > p:last-child { margin-bottom: 0; }
/* card header row */
.cbi-section > h3:first-child, .cbi-section > legend:first-child, .cbi-section > .cbi-title:first-child,
.cbi-section > .cbi-section-remove:first-child + .cbi-title {
@@ -1299,6 +1301,19 @@ input[type="button"], input[type="reset"], input[type="submit"]) {
:is(.btn, .cbi-button, .cbi-dropdown).cbi-button-save.important:hover {
background: color-mix(in srgb, var(--accent) 20%, transparent);
}
/* LuCI's emphasis without .important (Bootstrap outlines these, apps mark
Open / Restart / Refresh with them): the signal as text and line on the
plain fill. In table rows only Edit keeps it: a row of Start / Restart /
Reload / Stop on every line (System -> Startup) stays plain */
:is(.btn, .cbi-button):is(.cbi-button-action, .cbi-button-reload, .cbi-button-find, .cbi-button-link, .cbi-button-download):not(.important, .cbi-dropdown, .td *),
:is(.btn, .cbi-button).cbi-button-edit:not(.important, .cbi-dropdown) {
border-color: var(--accent-line);
color: var(--accent-text);
}
:is(.btn, .cbi-button):is(.cbi-button-action, .cbi-button-reload, .cbi-button-find, .cbi-button-link, .cbi-button-download):not(.important, .cbi-dropdown, .td *):hover,
:is(.btn, .cbi-button).cbi-button-edit:not(.important, .cbi-dropdown):hover {
background: var(--accent-soft);
}
.cbi-value-field :is(.btn, .cbi-button).cbi-button-apply,
.td :is(.btn, .cbi-button).cbi-button-apply {
background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-text); font-weight: 500;
@@ -1422,6 +1437,9 @@ table { border-collapse: separate; border-spacing: 0; width: 100%; }
:is(.cbi-section, .cbi-value) .table .tr > :is(.th, .td):first-child { padding-left: var(--card-px); }
:is(.cbi-section, .cbi-value) .table .tr > :is(.th, .td):last-child { padding-right: var(--card-px); }
.cbi-section > .table:last-child, .cbi-section > div:last-child > .table:last-child { margin-bottom: calc(-1 * var(--card-py) + 4px); }
/* Nested sections have no bottom padding for the table to bleed into. */
.cbi-section .cbi-section > .table:last-child,
.cbi-section .cbi-section > div:last-child > .table:last-child { margin-bottom: 0; }
.table .tr.table-titles > .th, .table .cbi-section-table-titles > .th, thead .th {
position: sticky; top: var(--stick-top); z-index: 20;
}
@@ -1550,7 +1568,9 @@ div.right > .btn, div.right > .cbi-button, div.right > button { margin-left: 0;
}
:is(.cbi-tabmenu > li > a, .vt-pagetabs > .vt-tab):hover { color: var(--text); }
:is(.cbi-tabmenu > li > a, .vt-pagetabs > .vt-tab):focus-visible { outline-offset: -1px; border-radius: calc(var(--r) + 3px); }
.cbi-tabmenu > li.cbi-tab > a, .vt-pagetabs > .vt-tab[aria-current] { background-color: var(--seg-on); color: var(--text); font-weight: 600; box-shadow: var(--seg-on-ring); }
/* the selected segment carries the signal (text and ring): white on the
grey track alone was hard to pick out; hover keeps it */
.cbi-tabmenu > li.cbi-tab > a, .cbi-tabmenu > li.cbi-tab > a:hover, .vt-pagetabs > .vt-tab[aria-current] { background-color: var(--seg-on); color: var(--accent-text); font-weight: 600; box-shadow: inset 0 0 0 1px var(--accent-line); }
.cbi-tabmenu > li[data-errors] > a::after {
content: attr(data-errors);
display: inline-flex; align-items: center; justify-content: center;
@@ -1685,6 +1705,45 @@ div:has(> .ifacebox > .ifacebox-head.cbi-tooltip-container) > .ifacebox { width:
.ifacebox-head.active { background: var(--accent-soft); color: var(--accent-text); }
.ifacebox-body { padding: 8px 10px; font-size: var(--fs-sm); color: var(--text-2); }
.ifacebox-body img { width: 18px; height: 18px; }
/* Status -> Port status, each box: a link dot by the name (as on the
upstream and radio cards), the speed as its figure, the zone as a bare
bar and the counters' arrows in the dashboard's upload and download
colours (menu-vantage.js puts them in spans). LuCI's port picture only
repeats the link state: hidden. A port without link is muted throughout */
.ifacebox:has(> .ifacebox-head.cbi-tooltip-container) > .ifacebox-head:first-child {
display: flex; align-items: center; gap: 8px;
padding: 10px 10px 2px;
background: none; border-bottom: 0;
font-family: var(--mono); font-weight: 650 !important; text-align: left;
}
.ifacebox:has(> .ifacebox-head.cbi-tooltip-container) > .ifacebox-head:first-child::before {
content: ""; flex: none;
width: 8px; height: 8px; border-radius: 50%;
box-shadow: inset 0 0 0 1.5px var(--text-3);
}
.ifacebox:has(> .ifacebox-body > img[src$="_down.svg"]) > .ifacebox-head:first-child { color: var(--text-2); }
.ifacebox:has(> .ifacebox-body > img[src$="_up.svg"]) > .ifacebox-head:first-child::before { background: var(--v-chart-1); box-shadow: 0 0 0 3px var(--accent-soft); }
.ifacebox:has(> .ifacebox-head.cbi-tooltip-container) > .ifacebox-head:first-child + .ifacebox-body { padding: 2px 10px 6px; color: var(--text-3); }
.ifacebox:has(> .ifacebox-body > img[src$="_up.svg"]) > .ifacebox-head:first-child + .ifacebox-body { color: var(--text-2); }
.ifacebox:has(> .ifacebox-head.cbi-tooltip-container) > .ifacebox-head:first-child + .ifacebox-body > :is(img, br) { display: none; }
.ifacebox:has(> .ifacebox-head.cbi-tooltip-container) > .ifacebox-head:first-child + .ifacebox-body > span {
color: var(--text);
font: 600 var(--fs-md)/1.4 var(--font); font-variant-numeric: tabular-nums;
}
.ifacebox-head.cbi-tooltip-container:has(> .zonebadge) { gap: 3px; padding: 4px 10px; background: none; border-bottom: 0; }
.ifacebox-head.cbi-tooltip-container > .zonebadge[style*="--zone-color-rgb"] {
height: 3px !important; padding: 0;
border: 0; border-radius: 2px; box-shadow: none;
background-color: rgb(var(--zone-color-rgb)) !important;
}
.ifacebox-head.cbi-tooltip-container > .zonebadge:is([style*="--zone-color-rgb: 238, 238, 238"], [style*="--zone-color-rgb:238, 238, 238"], [style*="--zone-color-rgb:238,238,238"]) { background-color: var(--text-3) !important; }
.ifacebox-head.cbi-tooltip-container + .ifacebox-body { padding: 4px 10px 10px; color: var(--text-2); font-variant-numeric: tabular-nums; }
/* the PoE power line comes inline as black: black on the dark card */
.ifacebox-head.cbi-tooltip-container + .ifacebox-body > .cbi-tooltip-container > span[style*="color:#000"] { color: inherit !important; }
.ifacebox:has(> .ifacebox-body > img[src$="_down.svg"]) > .ifacebox-head.cbi-tooltip-container + .ifacebox-body { color: var(--text-3); }
.vt-port-dir[data-dir="tx"] { color: var(--v-chart-5); }
.vt-port-dir[data-dir="rx"] { color: var(--v-chart-1); }
.ifacebox:has(> .ifacebox-body > img[src$="_down.svg"]) .vt-port-dir { color: inherit; }
.network-status-table > .ifacebox { display: flex; }
.network-status-table .ifacebox-head {