mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-02 04:03:56 +08:00
🤞 Sync 2026-09-27 22:16:29
This commit is contained in:
1 parent
8ede4a8320
commit
618f51e9dc
459 files changed
+44817
-2191
No files matched your search
@@ -0,0 +1,230 @@
|
||||
'use strict';
|
||||
'require view';
|
||||
'require rpc';
|
||||
'require poll';
|
||||
'require ui';
|
||||
|
||||
(function() {
|
||||
if (!document.querySelector('link[href*="trafficctl/status.css"]')) {
|
||||
var lnk = document.createElement('link');
|
||||
lnk.rel = 'stylesheet';
|
||||
lnk.type = 'text/css';
|
||||
lnk.href = '/luci-static/resources/view/trafficctl/status.css';
|
||||
document.head.appendChild(lnk);
|
||||
}
|
||||
})();
|
||||
|
||||
var callPortfwList = rpc.declare({
|
||||
object: 'luci.trafficctl',
|
||||
method: 'portfw_list',
|
||||
expect: { result: [] }
|
||||
});
|
||||
|
||||
var callPortfwCtl = rpc.declare({
|
||||
object: 'luci.trafficctl',
|
||||
method: 'portfw_ctl',
|
||||
params: ['action', 'scope', 'proto', 'ip', 'port', 'rate_kbit']
|
||||
});
|
||||
|
||||
var LIMIT_PRESETS = [
|
||||
{ label: '1M', kbit: 1000 },
|
||||
{ label: '5M', kbit: 5000 },
|
||||
{ label: '10M', kbit: 10000 },
|
||||
{ label: '50M', kbit: 50000 }
|
||||
];
|
||||
|
||||
function fmtBytes(b) {
|
||||
b = b || 0;
|
||||
if (b >= 1000000000) return (b / 1000000000).toFixed(b >= 10000000000 ? 0 : 1) + ' GB';
|
||||
if (b >= 1000000) return (b / 1000000).toFixed(b >= 10000000 ? 0 : 1) + ' MB';
|
||||
if (b >= 1000) return (b / 1000).toFixed(0) + ' KB';
|
||||
return b + ' B';
|
||||
}
|
||||
|
||||
function fmtRate(kbit) {
|
||||
kbit = kbit || 0;
|
||||
if (kbit >= 1000) {
|
||||
var m = kbit / 1000;
|
||||
return (m === Math.floor(m) ? m : m.toFixed(1)) + ' Mbit/s';
|
||||
}
|
||||
return kbit + ' kbit/s';
|
||||
}
|
||||
|
||||
function scopeOf(row) {
|
||||
return row.kind === 'open' ? 'input' : 'forward';
|
||||
}
|
||||
|
||||
function protoParam(row) {
|
||||
// backend accepts "tcp", "udp" or "tcpudp"
|
||||
return row.proto.indexOf('tcp') >= 0 && row.proto.indexOf('udp') >= 0
|
||||
? 'tcpudp' : row.proto;
|
||||
}
|
||||
|
||||
return view.extend({
|
||||
rows: [],
|
||||
tbody: null,
|
||||
statusEl: null,
|
||||
|
||||
handleSaveApply: null,
|
||||
handleSave: null,
|
||||
handleReset: null,
|
||||
|
||||
load: function() {
|
||||
return callPortfwList().catch(function() { return []; });
|
||||
},
|
||||
|
||||
doCtl: function(action, row, kbit) {
|
||||
var self = this;
|
||||
self.statusEl.textContent = _('Applying…');
|
||||
return callPortfwCtl(action, scopeOf(row), protoParam(row),
|
||||
row.kind === 'open' ? '-' : row.ip, String(row.port), kbit || 0)
|
||||
.then(function(res) {
|
||||
if (res && res.ok) {
|
||||
self.statusEl.textContent = '';
|
||||
return self.refresh();
|
||||
}
|
||||
self.statusEl.textContent = '';
|
||||
ui.addNotification(null, E('p', (res && res.msg) || _('Operation failed')), 'error');
|
||||
}).catch(function(e) {
|
||||
self.statusEl.textContent = '';
|
||||
ui.addNotification(null, E('p', e.message), 'error');
|
||||
});
|
||||
},
|
||||
|
||||
renderRow: function(row) {
|
||||
var self = this;
|
||||
|
||||
var dest = row.kind === 'open'
|
||||
? E('span', { 'class': 'tc-c-muted' }, _('router'))
|
||||
: E('span', { 'class': 'tc-mono' }, row.ip + ':' + row.port);
|
||||
|
||||
var state;
|
||||
if (!row.enabled) {
|
||||
state = E('span', { 'class': 'tc-c-faint' }, _('disabled'));
|
||||
} else if (row.paused) {
|
||||
state = E('span', { 'class': 'tc-c-warn tc-fw-bold' }, '⏸ ' + _('paused'));
|
||||
} else {
|
||||
state = E('span', { 'class': 'tc-c-ok' }, '●');
|
||||
}
|
||||
|
||||
var pauseBtn = E('button', {
|
||||
'class': 'cbi-button ' + (row.paused ? 'cbi-button-apply' : 'cbi-button-remove'),
|
||||
'style': 'font-size:11px;padding:1px 8px'
|
||||
}, row.paused ? _('Resume') : _('Pause'));
|
||||
pauseBtn.addEventListener('click', function() {
|
||||
pauseBtn.disabled = true;
|
||||
self.doCtl(row.paused ? 'resume' : 'pause', row);
|
||||
});
|
||||
|
||||
var limitCell;
|
||||
if (row.limit_kbit > 0) {
|
||||
var rmBtn = E('button', {
|
||||
'class': 'cbi-button cbi-button-remove',
|
||||
'style': 'font-size:11px;padding:1px 6px;margin-left:6px',
|
||||
'title': _('Remove limit')
|
||||
}, '✕');
|
||||
rmBtn.addEventListener('click', function() {
|
||||
rmBtn.disabled = true;
|
||||
self.doCtl('limit', row, 0);
|
||||
});
|
||||
limitCell = E('span', {}, [
|
||||
E('span', { 'class': 'tc-c-warn tc-fw-bold' }, '⚡ ' + fmtRate(row.limit_kbit)),
|
||||
rmBtn
|
||||
]);
|
||||
} else {
|
||||
var chips = LIMIT_PRESETS.map(function(p) {
|
||||
var b = E('button', {
|
||||
'class': 'cbi-button',
|
||||
'style': 'font-size:10px;padding:0 5px;margin-right:2px',
|
||||
'title': _('Limit inbound to') + ' ' + fmtRate(p.kbit)
|
||||
}, p.label);
|
||||
b.addEventListener('click', function() {
|
||||
b.disabled = true;
|
||||
self.doCtl('limit', row, p.kbit);
|
||||
});
|
||||
return b;
|
||||
});
|
||||
limitCell = E('span', {}, chips);
|
||||
}
|
||||
|
||||
return E('tr', { 'class': 'tr' }, [
|
||||
E('td', { 'class': 'td', 'style': row.enabled ? '' : 'opacity:.5' }, [
|
||||
E('div', { 'class': 'tc-fw-bold' }, row.name || '*'),
|
||||
E('div', { 'class': 'tc-c-faint', 'style': 'font-size:10px' },
|
||||
row.kind === 'open' ? _('open port') : _('port forward'))
|
||||
]),
|
||||
E('td', { 'class': 'td tc-center' }, row.proto),
|
||||
E('td', { 'class': 'td tc-center tc-mono' }, String(row.ext_port)),
|
||||
E('td', { 'class': 'td' }, dest),
|
||||
E('td', { 'class': 'td tc-center' }, state),
|
||||
E('td', { 'class': 'td tc-right tc-fw-bold' }, String(row.conns || 0)),
|
||||
E('td', { 'class': 'td tc-right' }, String(row.clients || 0)),
|
||||
E('td', { 'class': 'td tc-right tc-mono tc-sm' }, fmtBytes(row.bytes_in)),
|
||||
E('td', { 'class': 'td tc-right tc-mono tc-sm' }, fmtBytes(row.bytes_out)),
|
||||
E('td', { 'class': 'td' }, limitCell),
|
||||
E('td', { 'class': 'td tc-center' }, pauseBtn)
|
||||
]);
|
||||
},
|
||||
|
||||
renderTable: function() {
|
||||
var self = this;
|
||||
while (this.tbody.firstChild) this.tbody.removeChild(this.tbody.firstChild);
|
||||
if (!this.rows.length) {
|
||||
this.tbody.appendChild(E('tr', { 'class': 'tr' }, [
|
||||
E('td', { 'class': 'td tc-c-faint', 'colspan': 11 },
|
||||
_('No port forwards or WAN-open ports are configured in the firewall.'))
|
||||
]));
|
||||
return;
|
||||
}
|
||||
this.rows.forEach(function(r) {
|
||||
self.tbody.appendChild(self.renderRow(r));
|
||||
});
|
||||
},
|
||||
|
||||
refresh: function() {
|
||||
var self = this;
|
||||
return callPortfwList().then(function(rows) {
|
||||
self.rows = rows || [];
|
||||
self.renderTable();
|
||||
}).catch(function() {});
|
||||
},
|
||||
|
||||
render: function(rows) {
|
||||
var self = this;
|
||||
this.rows = rows || [];
|
||||
this.statusEl = E('span', { 'class': 'tc-c-muted', 'style': 'margin-left:10px;font-size:12px' });
|
||||
|
||||
this.tbody = E('tbody', {});
|
||||
var table = E('table', { 'class': 'table tc-table' }, [
|
||||
E('thead', {}, [
|
||||
E('tr', { 'class': 'tr cbi-section-table-titles' }, [
|
||||
E('th', { 'class': 'th' }, _('Name')),
|
||||
E('th', { 'class': 'th tc-center' }, _('Proto')),
|
||||
E('th', { 'class': 'th tc-center', 'title': _('External (WAN) port') }, _('Ext. port')),
|
||||
E('th', { 'class': 'th' }, _('Destination')),
|
||||
E('th', { 'class': 'th tc-center' }, _('State')),
|
||||
E('th', { 'class': 'th tc-right', 'title': _('Active inbound connections') }, _('Conns')),
|
||||
E('th', { 'class': 'th tc-right', 'title': _('Distinct remote clients') }, _('Clients')),
|
||||
E('th', { 'class': 'th tc-right', 'title': _('Bytes received from remote clients') }, _('In')),
|
||||
E('th', { 'class': 'th tc-right', 'title': _('Bytes sent back to remote clients') }, _('Out')),
|
||||
E('th', { 'class': 'th', 'title': _('Inbound rate limit (drops packets above the rate)') }, _('Limit')),
|
||||
E('th', { 'class': 'th tc-center' }, _('Action'))
|
||||
])
|
||||
]),
|
||||
this.tbody
|
||||
]);
|
||||
|
||||
this.renderTable();
|
||||
|
||||
poll.add(function() { return self.refresh(); }, 5);
|
||||
|
||||
return E('div', {}, [
|
||||
E('h2', {}, _('Port Forwards & Open Ports')),
|
||||
E('div', { 'class': 'cbi-map-descr' }, [
|
||||
document.createTextNode(_('Inbound traffic control for DNAT port forwards and router-local open ports configured in the firewall. Pause drops all inbound traffic on the port instantly (without touching the firewall config); Limit polices the inbound rate.')),
|
||||
this.statusEl
|
||||
]),
|
||||
table
|
||||
]);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,796 @@
|
||||
/* trafficctl status view — native LuCI UI variant */
|
||||
|
||||
/* ── Semantic colour bridge (LuCI-native → tc-* aliases) ───────────── */
|
||||
:root {
|
||||
--tc-speed: var(--primary-color-high, #3182ce);
|
||||
--tc-ok: var(--success-color-high, #276749);
|
||||
--tc-warn: var(--warn-color-high, #c05621);
|
||||
--tc-err: var(--error-color-high, #c53030);
|
||||
--tc-muted: var(--text-color-medium, #718096);
|
||||
--tc-faint: var(--text-color-low, #a0aec0);
|
||||
--tc-border: var(--border-color-medium, #e2e8f0);
|
||||
--tc-bg: var(--background-color-high,#ffffff);
|
||||
--tc-bg-alt: var(--background-color-low, #f7fafc);
|
||||
--tc-hover: var(--background-color-low, #ebf8ff);
|
||||
/* Text drawn ON TOP of an accent fill (chips, primary buttons). Themes
|
||||
whose accent is pale need dark text here, so it must be a variable
|
||||
rather than a hardcoded white. */
|
||||
--tc-on-accent: #ffffff;
|
||||
/* Tooltips need a surface that CONTRASTS with the page, not one that
|
||||
matches it — so these flip in the dark blocks below. */
|
||||
--tc-tip-bg: #2d3748;
|
||||
--tc-tip-fg: #ffffff;
|
||||
--tc-shadow: rgba(0,0,0,.15);
|
||||
/* Telegram brand colour, kept deliberately brand-accurate. */
|
||||
--tg-primary: #0088cc;
|
||||
}
|
||||
|
||||
/* Bootstrap explicit dark mode */
|
||||
:root[data-darkmode="true"], html[data-darkmode="true"] {
|
||||
--tc-speed: #63b3ed;
|
||||
--tc-ok: #68d391;
|
||||
--tc-warn: #f6ad55;
|
||||
--tc-err: #fc8181;
|
||||
--tc-muted: #a0aec0;
|
||||
--tc-faint: #718096;
|
||||
--tc-border: #3a3a3a;
|
||||
--tc-bg: #1e1e1e;
|
||||
--tc-bg-alt: #262626;
|
||||
--tc-hover: #2d3748;
|
||||
--tc-on-accent: #1a202c;
|
||||
--tc-tip-bg: #e2e8f0;
|
||||
--tc-tip-fg: #1a202c;
|
||||
--tc-shadow: rgba(0,0,0,.5);
|
||||
--tg-primary: #3390ec;
|
||||
}
|
||||
|
||||
/* OS dark preference (Argon auto mode, other themes) */
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root:not([data-darkmode="false"]) {
|
||||
--tc-speed: #63b3ed;
|
||||
--tc-ok: #68d391;
|
||||
--tc-warn: #f6ad55;
|
||||
--tc-err: #fc8181;
|
||||
--tc-muted: #a0aec0;
|
||||
--tc-faint: #718096;
|
||||
--tc-border: #3a3a3a;
|
||||
--tc-bg: #1e1e1e;
|
||||
--tc-bg-alt: #262626;
|
||||
--tc-hover: #2d3748;
|
||||
--tc-on-accent: #1a202c;
|
||||
--tc-tip-bg: #e2e8f0;
|
||||
--tc-tip-fg: #1a202c;
|
||||
--tc-shadow: rgba(0,0,0,.5);
|
||||
--tg-primary: #3390ec;
|
||||
}
|
||||
}
|
||||
|
||||
/* ── Utility ─────────────────────────────────────────────────────── */
|
||||
.tc-hidden { display: none !important; }
|
||||
|
||||
/* ── Colour utilities ────────────────────────────────────────────── */
|
||||
.tc-c-speed { color: var(--tc-speed); }
|
||||
.tc-c-ok { color: var(--tc-ok); }
|
||||
.tc-c-warn { color: var(--tc-warn); }
|
||||
.tc-c-err { color: var(--tc-err); }
|
||||
.tc-c-muted { color: var(--tc-muted); }
|
||||
.tc-c-faint { color: var(--tc-faint); }
|
||||
.tc-fw-bold { font-weight: 600; }
|
||||
.tc-mono { font-family: monospace; }
|
||||
.tc-right { text-align: right; }
|
||||
.tc-center { text-align: center; }
|
||||
.tc-sm { font-size: 11px; }
|
||||
|
||||
/* ── Table extras ────────────────────────────────────────────────── */
|
||||
/* Base styles come from LuCI's .table .tr .th .td cascade */
|
||||
.table.tc-table .th { cursor: pointer; user-select: none; white-space: nowrap; font-size: 12px; }
|
||||
.table.tc-table .th:hover { opacity: 0.75; }
|
||||
.table.tc-table .td { font-size: 12px; vertical-align: middle; }
|
||||
.table.tc-table--rows-clickable .tr:not(.cbi-section-table-titles):hover .td {
|
||||
background: var(--tc-hover);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* ── Speed indicator in table ────────────────────────────────────── */
|
||||
.tc-speed-active { color: var(--tc-speed); font-weight: 600; }
|
||||
.tc-speed-idle { color: var(--tc-faint); }
|
||||
|
||||
/* ── Inline badge (block/limit/shape status in cell) ─────────────── */
|
||||
.tc-badge {
|
||||
display: inline-block;
|
||||
padding: 1px 6px;
|
||||
border-radius: 3px;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.tc-badge--blocked { color: var(--tc-err); }
|
||||
.tc-badge--limited { color: var(--tc-warn); }
|
||||
.tc-badge--shaped { color: var(--tc-speed); }
|
||||
.tc-badge--wifi { color: var(--tc-ok); }
|
||||
.tc-badge--drop { color: var(--tc-err); }
|
||||
|
||||
/* ── Offload banner ───────────────────────────────────────────────── */
|
||||
.tc-offload-banner {
|
||||
padding: 10px 14px;
|
||||
margin-bottom: 8px;
|
||||
border-radius: 6px;
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.tc-offload-banner__row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
}
|
||||
.tc-offload-banner__icon {
|
||||
font-size: 15px;
|
||||
margin-right: 8px;
|
||||
}
|
||||
.tc-offload-banner__body { flex: 1; }
|
||||
.tc-offload-banner__close {
|
||||
cursor: pointer;
|
||||
opacity: 0.5;
|
||||
padding: 0 0 0 10px;
|
||||
font-size: 18px;
|
||||
line-height: 1;
|
||||
}
|
||||
.tc-offload-ul {
|
||||
margin: 4px 0 4px 18px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* ── Action row (block / wifi buttons) ───────────────────────────── */
|
||||
.tc-action-row {
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
/* ── Rate / mode panel ────────────────────────────────────────────── */
|
||||
.tc-rate-panel {
|
||||
padding: 12px 14px;
|
||||
border-radius: 4px;
|
||||
margin-bottom: 8px;
|
||||
border: 1px solid var(--tc-border);
|
||||
background: var(--tc-bg-alt);
|
||||
}
|
||||
.tc-rate-panel__header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.tc-rate-panel__title {
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* ── Mode toggle (segmented) ─────────────────────────────────────── */
|
||||
.tc-mode-toggle {
|
||||
display: inline-flex;
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--tc-border);
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
/* ── Custom rate input row ───────────────────────────────────────── */
|
||||
.tc-custom-row {
|
||||
display: flex;
|
||||
margin-top: 6px;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
.tc-custom-input {
|
||||
width: 70px;
|
||||
font-size: 12px;
|
||||
padding: 4px 8px;
|
||||
border: 1px solid var(--tc-border);
|
||||
border-radius: 4px;
|
||||
background: var(--tc-bg);
|
||||
color: inherit;
|
||||
}
|
||||
.tc-custom-unit-btns {
|
||||
display: inline-flex;
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--tc-border);
|
||||
}
|
||||
|
||||
/* ── Chips (rate preset pills) ───────────────────────────────────── */
|
||||
.tc-chip {
|
||||
display: inline-block;
|
||||
padding: 3px 10px;
|
||||
margin: 2px;
|
||||
border-radius: 14px;
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: all .15s;
|
||||
border: 1px solid var(--tc-border);
|
||||
background: var(--tc-bg);
|
||||
color: inherit;
|
||||
user-select: none;
|
||||
}
|
||||
.tc-chip--active {
|
||||
border-color: var(--tc-speed);
|
||||
background: var(--tc-speed);
|
||||
color: var(--tc-on-accent);
|
||||
font-weight: 600;
|
||||
}
|
||||
.tc-chips-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
/* ── Column visibility chips ─────────────────────────────────────── */
|
||||
.tc-col-chip {
|
||||
display: inline-block;
|
||||
padding: 2px 8px;
|
||||
border-radius: 10px;
|
||||
font-size: 11px;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
margin: 2px;
|
||||
transition: all .15s;
|
||||
font-weight: 500;
|
||||
}
|
||||
.tc-col-chip--on { background: var(--tc-speed); color: var(--tc-on-accent); border: 1px solid var(--tc-speed); }
|
||||
.tc-col-chip--off { background: var(--tc-bg); color: var(--tc-muted); border: 1px solid var(--tc-border); }
|
||||
|
||||
/* ── Settings panel (collapsible) ────────────────────────────────── */
|
||||
.tc-settings-panel {
|
||||
border-radius: 4px;
|
||||
margin-bottom: 10px;
|
||||
background: var(--tc-bg-alt);
|
||||
border: 1px solid var(--tc-border);
|
||||
}
|
||||
.tc-settings-toggle {
|
||||
padding: 8px 14px;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: var(--tc-muted);
|
||||
}
|
||||
.tc-settings-body {
|
||||
padding: 0 14px 10px;
|
||||
}
|
||||
.tc-settings-section-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding-top: 4px;
|
||||
}
|
||||
.tc-divider {
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
color: var(--tc-muted);
|
||||
margin-top: 12px;
|
||||
margin-bottom: 6px;
|
||||
padding-bottom: 4px;
|
||||
border-bottom: 1px solid var(--tc-border);
|
||||
}
|
||||
|
||||
/* ── Quick bar (All + recent device chips) ───────────────────────── */
|
||||
.tc-quick-bar {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.tc-recent-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 3px;
|
||||
padding: 3px 8px;
|
||||
border-radius: 12px;
|
||||
font-size: 11px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: all .15s;
|
||||
user-select: none;
|
||||
border: 1px solid var(--tc-border);
|
||||
background: var(--tc-bg);
|
||||
}
|
||||
.tc-recent-chip--active {
|
||||
border-color: var(--tc-speed);
|
||||
background: var(--tc-bg-alt);
|
||||
color: var(--tc-speed);
|
||||
font-weight: 600;
|
||||
}
|
||||
.tc-recent-remove {
|
||||
margin-left: 2px;
|
||||
font-size: 10px;
|
||||
opacity: 0;
|
||||
transition: opacity .15s;
|
||||
cursor: pointer;
|
||||
}
|
||||
.tc-recent-chip:hover .tc-recent-remove { opacity: 0.5; }
|
||||
|
||||
/* ── Search / device picker ──────────────────────────────────────── */
|
||||
.tc-search-wrapper {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
max-width: 480px;
|
||||
}
|
||||
.tc-search-input {
|
||||
width: 100%;
|
||||
padding: 7px 30px 7px 10px;
|
||||
font-size: 14px;
|
||||
border: 1px solid var(--tc-border);
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
background: var(--tc-bg);
|
||||
color: inherit;
|
||||
}
|
||||
.tc-search-clear {
|
||||
position: absolute;
|
||||
right: 8px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
cursor: pointer;
|
||||
color: var(--tc-muted);
|
||||
font-size: 16px;
|
||||
line-height: 1;
|
||||
}
|
||||
.tc-search-dropdown {
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
max-height: 280px;
|
||||
overflow-y: auto;
|
||||
background: var(--tc-bg);
|
||||
border: 1px solid var(--tc-border);
|
||||
border-top: none;
|
||||
border-radius: 0 0 4px 4px;
|
||||
box-shadow: 0 4px 8px var(--tc-shadow);
|
||||
z-index: 100;
|
||||
}
|
||||
.tc-dropdown-item {
|
||||
padding: 6px 10px;
|
||||
cursor: pointer;
|
||||
font-size: 13px;
|
||||
border-bottom: 1px solid var(--tc-border);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.tc-dropdown-item:hover { background: var(--tc-hover); }
|
||||
.tc-dropdown-item--section {
|
||||
padding: 3px 10px;
|
||||
font-size: 11px;
|
||||
color: var(--tc-muted);
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: .3px;
|
||||
cursor: default;
|
||||
border-bottom: 1px solid var(--tc-border);
|
||||
}
|
||||
.tc-dropdown-item--all {
|
||||
font-weight: 600;
|
||||
color: var(--tc-speed);
|
||||
}
|
||||
|
||||
/* ── Speed graph popup ───────────────────────────────────────────── */
|
||||
.tc-graph-popup {
|
||||
position: fixed;
|
||||
z-index: 500;
|
||||
padding: 10px;
|
||||
border-radius: 6px;
|
||||
background: var(--tc-bg);
|
||||
border: 1px solid var(--tc-border);
|
||||
box-shadow: 0 4px 16px var(--tc-shadow);
|
||||
}
|
||||
.tc-graph-popup__note {
|
||||
font-size: 10px;
|
||||
color: var(--tc-faint);
|
||||
margin-top: 4px;
|
||||
text-align: center;
|
||||
}
|
||||
.tc-graph-popup__empty {
|
||||
color: var(--tc-muted);
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
/* ── Extended stats panel ────────────────────────────────────────── */
|
||||
.tc-offload-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-top: 6px;
|
||||
}
|
||||
.tc-offload-row--hw {
|
||||
margin-top: 10px;
|
||||
}
|
||||
.tc-offload-desc {
|
||||
font-size: 11px;
|
||||
color: var(--tc-muted);
|
||||
margin: 2px 0 0 32px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.tc-device-graph {
|
||||
margin: 8px 0;
|
||||
border: 1px solid var(--tc-border);
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
background: var(--tc-bg-alt);
|
||||
}
|
||||
.tc-device-graph svg { display: block; width: 100%; }
|
||||
|
||||
.tc-ext-panel {
|
||||
border: 1px solid var(--tc-border);
|
||||
border-radius: 4px;
|
||||
padding: 10px 14px;
|
||||
font-size: 13px;
|
||||
margin: 8px 0;
|
||||
background: var(--tc-bg-alt);
|
||||
}
|
||||
.tc-ext-panel__title {
|
||||
margin-bottom: 8px;
|
||||
font-weight: 600;
|
||||
font-size: 14px;
|
||||
}
|
||||
.tc-ext-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: baseline;
|
||||
padding: 3px 0;
|
||||
border-bottom: 1px dotted var(--tc-border);
|
||||
}
|
||||
|
||||
/* ── Activity log ────────────────────────────────────────────────── */
|
||||
.tc-log-area {
|
||||
max-height: 250px;
|
||||
overflow-y: auto;
|
||||
font-family: monospace;
|
||||
font-size: 11px;
|
||||
background: var(--tc-bg);
|
||||
border: 1px solid var(--tc-border);
|
||||
border-radius: 4px;
|
||||
padding: 6px;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
}
|
||||
.tc-log-line {
|
||||
padding: 1px 0;
|
||||
border-bottom: 1px solid var(--tc-border);
|
||||
}
|
||||
|
||||
/* ── Inline label / toggle layout ────────────────────────────────── */
|
||||
.tc-toggle-wrap {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin-right: 12px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.tc-inline-label {
|
||||
font-size: 12px;
|
||||
margin-right: 4px;
|
||||
white-space: nowrap;
|
||||
color: var(--tc-muted);
|
||||
}
|
||||
.tc-sep {
|
||||
border-left: 1px solid var(--tc-border);
|
||||
height: 18px;
|
||||
margin: 0 4px;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
/* ── Toggle switch ───────────────────────────────────────────────── */
|
||||
.tc-toggle-input { position: absolute; opacity: 0; width: 0; height: 0; }
|
||||
.tc-toggle {
|
||||
position: relative; display: inline-block;
|
||||
width: 34px; height: 18px;
|
||||
background: var(--tc-border);
|
||||
border-radius: 9px; cursor: pointer; transition: background .2s;
|
||||
}
|
||||
.tc-toggle::after {
|
||||
content: ""; position: absolute;
|
||||
top: 2px; left: 2px;
|
||||
width: 14px; height: 14px;
|
||||
background: var(--tc-bg); border-radius: 50%;
|
||||
transition: transform .2s; box-shadow: 0 1px 2px var(--tc-shadow);
|
||||
}
|
||||
.tc-toggle-input:checked + .tc-toggle { background: var(--tc-speed); }
|
||||
.tc-toggle-input:checked + .tc-toggle::after { transform: translateX(16px); }
|
||||
|
||||
/* ── Tooltip ─────────────────────────────────────────────────────── */
|
||||
[data-tip] { position: relative; }
|
||||
[data-tip]::after {
|
||||
content: attr(data-tip);
|
||||
position: absolute; bottom: calc(100% + 4px); left: 50%;
|
||||
transform: translateX(-50%);
|
||||
padding: 4px 8px; border-radius: 4px;
|
||||
font-size: 11px; font-weight: 400; white-space: nowrap;
|
||||
background: var(--tc-tip-bg); color: var(--tc-tip-fg);
|
||||
pointer-events: none; opacity: 0; transition: opacity .1s; z-index: 999;
|
||||
}
|
||||
[data-tip]:hover::after { opacity: 1; }
|
||||
|
||||
/* ── Version footer ──────────────────────────────────────────────── */
|
||||
.tc-version-footer {
|
||||
text-align: right;
|
||||
font-size: 10px;
|
||||
color: var(--tc-faint);
|
||||
padding: 8px 4px 0;
|
||||
user-select: all;
|
||||
}
|
||||
|
||||
/* ── Ethernet SVG icon ───────────────────────────────────────────── */
|
||||
.tc-eth-icon { display: inline-block; vertical-align: middle; margin-right: 3px; }
|
||||
|
||||
/* ── Inline pick (poll interval etc.) ───────────────────────────── */
|
||||
.tc-inline-pick-display {
|
||||
color: inherit;
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
border-bottom: 1px dashed var(--tc-muted);
|
||||
padding-bottom: 1px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.tc-inline-pick-wrapper { position: relative; display: inline-block; }
|
||||
.tc-inline-pick-popup {
|
||||
position: absolute;
|
||||
top: calc(100% + 4px); left: 50%;
|
||||
transform: translateX(-50%);
|
||||
background: var(--tc-bg);
|
||||
border: 1px solid var(--tc-border);
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 4px 12px var(--tc-shadow);
|
||||
z-index: 200; padding: 4px 0; white-space: nowrap;
|
||||
}
|
||||
|
||||
/* ── Telegram settings section ───────────────────────────────────── */
|
||||
.tg-section { border-left: 3px solid var(--tg-primary); padding-left: 12px; margin-top: 4px; }
|
||||
.tg-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
|
||||
.tg-row + .tg-row { margin-top: 8px; }
|
||||
.tg-input {
|
||||
font-size: 12px; padding: 4px 8px;
|
||||
background: var(--tc-bg); color: inherit;
|
||||
border: 1px solid var(--tc-border); border-radius: 4px;
|
||||
outline: none; transition: border-color .2s;
|
||||
}
|
||||
.tg-input:focus { border-color: var(--tg-primary); }
|
||||
.tg-input--token { width: 240px; }
|
||||
.tg-input--chat { width: 120px; }
|
||||
.tg-input--template { width: 100%; min-height: 60px; resize: vertical; font-family: monospace; font-size: 11px; }
|
||||
.tg-btn {
|
||||
font-size: 11px; padding: 3px 10px;
|
||||
border: 1px solid var(--tc-border); border-radius: 4px;
|
||||
background: var(--tc-bg); color: inherit;
|
||||
cursor: pointer; transition: background .15s;
|
||||
}
|
||||
.tg-btn:hover { background: var(--tc-hover); }
|
||||
.tg-btn--primary { background: var(--tg-primary); color: var(--tc-on-accent); border-color: var(--tg-primary); }
|
||||
.tg-btn--primary:hover { background: #006fa3; }
|
||||
.tg-label { font-size: 11px; color: var(--tc-muted); font-weight: 500; }
|
||||
.tg-status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 6px; vertical-align: middle; }
|
||||
.tg-status-dot--on { background: var(--tc-ok); }
|
||||
.tg-status-dot--off { background: var(--tc-faint); }
|
||||
.tg-segmented { display: inline-flex; border: 1px solid var(--tc-border); border-radius: 4px; overflow: hidden; font-size: 12px; }
|
||||
.tg-segmented__item {
|
||||
padding: 5px 14px; cursor: pointer;
|
||||
background: var(--tc-bg); color: var(--tc-muted);
|
||||
transition: background .15s, color .15s; user-select: none;
|
||||
border-right: 1px solid var(--tc-border);
|
||||
border-top: none; border-bottom: none; border-left: none;
|
||||
font-family: inherit; font-size: inherit; line-height: inherit; outline: none;
|
||||
}
|
||||
.tg-segmented__item:last-child { border-right: none; }
|
||||
.tg-segmented__item--active { background: var(--tg-primary); color: var(--tc-on-accent); }
|
||||
.tg-divider { font-size: 11px; font-weight: 600; color: var(--tc-muted); margin-top: 12px; margin-bottom: 6px; padding-bottom: 4px; border-bottom: 1px solid var(--tc-border); }
|
||||
.tg-bubble { background: var(--tc-bg-alt); border: 1px solid var(--tc-border); border-radius: 12px 12px 12px 4px; padding: 10px 14px; max-width: 280px; font-size: 12px; line-height: 1.5; box-shadow: 0 1px 2px var(--tc-shadow); }
|
||||
.tg-bubble--kbd { text-align: center; border-radius: 12px; }
|
||||
.tg-kbd-row { display: flex; gap: 2px; justify-content: center; margin-top: 4px; }
|
||||
.tg-kbd-btn { background: var(--tg-primary); color: var(--tc-on-accent); border-radius: 6px; padding: 5px 10px; font-size: 11px; flex: 1; text-align: center; min-width: 0; }
|
||||
.tg-commands { background: var(--tc-bg-alt); border: 1px solid var(--tc-border); border-radius: 4px; padding: 8px 12px; font-family: monospace; font-size: 11px; line-height: 1.8; }
|
||||
.tg-eye { cursor: pointer; font-size: 14px; user-select: none; line-height: 1; }
|
||||
.tg-template-hint { font-size: 10px; color: var(--tc-faint); margin-top: 2px; }
|
||||
.tg-save-status { font-size: 11px; margin-left: 8px; transition: opacity .3s; }
|
||||
|
||||
/* ── Spinner ─────────────────────────────────────────────────────── */
|
||||
@keyframes tc-spin { to { transform: rotate(360deg); } }
|
||||
.tc-spinner {
|
||||
display: inline-block; width: 14px; height: 14px;
|
||||
border: 2px solid var(--tc-border);
|
||||
border-top-color: inherit;
|
||||
border-radius: 50%;
|
||||
animation: tc-spin .7s linear infinite;
|
||||
vertical-align: middle; margin-right: 6px;
|
||||
}
|
||||
|
||||
/* ── Link style ──────────────────────────────────────────────────── */
|
||||
.tc-link { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--tc-faint); }
|
||||
.tc-link:hover { border-bottom-style: solid; }
|
||||
|
||||
/* ── Conn filter row ─────────────────────────────────────────────── */
|
||||
.tc-conn-filters-row {
|
||||
display: flex; flex-wrap: wrap; align-items: center;
|
||||
gap: 6px; margin-bottom: 6px;
|
||||
}
|
||||
.tc-table-speed-row {
|
||||
display: flex; flex-wrap: wrap; align-items: center;
|
||||
gap: 6px; margin-bottom: 8px;
|
||||
}
|
||||
.tc-log-row {
|
||||
display: flex; flex-wrap: wrap; align-items: center;
|
||||
gap: 6px; padding-top: 4px;
|
||||
}
|
||||
|
||||
/* Device rename affordance — the pencil only appears on row hover so the
|
||||
name column stays clean, and it must sit above the row's click handler. */
|
||||
.tc-name-cell { display: flex; align-items: center; gap: 6px; }
|
||||
.tc-rename {
|
||||
opacity: 0;
|
||||
cursor: pointer;
|
||||
font-size: 11px;
|
||||
color: var(--tc-muted);
|
||||
transition: opacity .15s ease, color .15s ease;
|
||||
}
|
||||
.table.tc-table--rows-clickable .tr:hover .tc-rename { opacity: .6; }
|
||||
.tc-rename:hover { opacity: 1 !important; color: var(--tc-speed); }
|
||||
|
||||
/* DPI application label (netifyd). Muted pill so it reads as metadata rather
|
||||
than a control. */
|
||||
.tc-app-badge {
|
||||
font-size: 11px;
|
||||
padding: 1px 6px;
|
||||
border-radius: 8px;
|
||||
background: var(--tc-chip-bg, rgba(127,127,127,.12));
|
||||
color: var(--tc-muted);
|
||||
cursor: help;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* Split down/up speed cell */
|
||||
|
||||
/* ── Global overview (bmon-style) ─────────────────────────────────────
|
||||
A whole-router panel above the per-device table. Every colour comes from
|
||||
the --tc-* bridge at the top of this file, so it follows the theme (and
|
||||
Argon's auto dark mode) without a second set of rules down here. */
|
||||
.tc-overview {
|
||||
border: 1px solid var(--tc-border);
|
||||
border-radius: 8px;
|
||||
background: var(--tc-bg-alt);
|
||||
padding: 12px;
|
||||
margin: 8px 0;
|
||||
}
|
||||
|
||||
.tc-ov-tiles {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 18px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.tc-ov-tile { min-width: 150px; }
|
||||
.tc-ov-tile-cap {
|
||||
font-size: 11px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: .04em;
|
||||
color: var(--tc-muted);
|
||||
}
|
||||
.tc-ov-tile-val { font-size: 20px; font-weight: 600; line-height: 1.3; }
|
||||
.tc-ov-tile-sub { font-size: 11px; }
|
||||
|
||||
.tc-ov-graph { margin: 4px 0 12px; }
|
||||
.tc-ov-graph svg { max-width: 100%; }
|
||||
|
||||
/* Two columns on a desktop, stacked on a phone — the router dashboard is
|
||||
opened from a phone often enough that this must not need a sideways
|
||||
scroll. */
|
||||
.tc-ov-cols {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 18px;
|
||||
}
|
||||
.tc-ov-col { flex: 1 1 280px; min-width: 0; }
|
||||
.tc-ov-subtitle {
|
||||
font-size: 11px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: .04em;
|
||||
color: var(--tc-muted);
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.tc-ov-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 3px 0;
|
||||
border-bottom: 1px solid var(--tc-border);
|
||||
font-size: 12px;
|
||||
}
|
||||
.tc-ov-row:last-child { border-bottom: none; }
|
||||
/* A down interface keeps its counters — they are history, not live traffic —
|
||||
so it is dimmed rather than hidden. */
|
||||
.tc-ov-row--down { opacity: .55; }
|
||||
|
||||
.tc-ov-badge {
|
||||
font-size: 10px;
|
||||
font-weight: 600;
|
||||
padding: 1px 5px;
|
||||
border-radius: 4px;
|
||||
color: var(--tc-on-accent);
|
||||
flex: 0 0 auto;
|
||||
min-width: 34px;
|
||||
text-align: center;
|
||||
}
|
||||
.tc-ov-badge--wan { background: var(--tc-speed); }
|
||||
.tc-ov-badge--vpn { background: var(--tc-warn); }
|
||||
.tc-ov-badge--lan { background: var(--tc-ok); }
|
||||
.tc-ov-badge--other { background: var(--tc-muted); }
|
||||
|
||||
.tc-ov-ifname {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 5px;
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.tc-ov-ifdev { font-size: 10px; }
|
||||
.tc-ov-defroute { font-size: 11px; color: var(--tc-speed); cursor: help; }
|
||||
|
||||
.tc-ov-spark { flex: 0 0 auto; width: 74px; }
|
||||
.tc-ov-rate { flex: 0 0 auto; width: 92px; text-align: right; font-size: 11px; cursor: help; }
|
||||
.tc-ov-total { flex: 0 0 auto; width: 132px; text-align: right; font-size: 11px; cursor: help; }
|
||||
|
||||
.tc-ov-more {
|
||||
font-size: 11px;
|
||||
color: var(--tc-muted);
|
||||
cursor: pointer;
|
||||
padding: 4px 0 0;
|
||||
}
|
||||
.tc-ov-more:hover { color: var(--tc-speed); }
|
||||
.tc-ov-note { font-size: 10px; margin-top: 6px; line-height: 1.4; }
|
||||
.tc-ov-empty { font-size: 12px; padding: 8px 0; }
|
||||
|
||||
/* Top talkers — a bar per device, scaled to the busiest one, so the shape of
|
||||
"one device is saturating the line" is visible without reading numbers. */
|
||||
.tc-ov-talkers { display: flex; flex-direction: column; gap: 6px; }
|
||||
.tc-ov-talker-head {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: baseline;
|
||||
gap: 8px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.tc-ov-talker-name {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
min-width: 0;
|
||||
}
|
||||
.tc-ov-talker-rate { font-size: 11px; white-space: nowrap; flex: 0 0 auto; }
|
||||
.tc-ov-talker-up { margin-left: 8px; }
|
||||
.tc-ov-bar {
|
||||
height: 5px;
|
||||
border-radius: 3px;
|
||||
background: var(--tc-border);
|
||||
overflow: hidden;
|
||||
margin-top: 2px;
|
||||
}
|
||||
.tc-ov-bar-fill { height: 100%; background: var(--tc-speed); }
|
||||
|
||||
@media (max-width: 560px) {
|
||||
.tc-ov-total { display: none; }
|
||||
.tc-ov-rate { width: 78px; }
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user