Skip to content

LordOS — a free, fast and secure GNU/Linux distribution based on Debian, with its own desktop environment: display server and Wayland compositor in C, a React UI engine on QuickJS, and private native apps.

Monitor → Network, second generation: tree, chips, view menu, native rows, blocklists page and the menu bar item

Federico Pereiracbf39336693c
diff --git a/apps/monitor/Blocklists.jsx b/apps/monitor/Blocklists.jsx
new file mode 100644
index 0000000..5297241
--- /dev/null
+++ b/apps/monitor/Blocklists.jsx
@@ -0,0 +1,112 @@
+// Blocklists.jsx — Settings → Privacy → "Blocklists" (0.8.4; registered with registerPrivacySection,
+// like the other Monitor items). See docs/FIREWALL.md, "Blocklists".
+// - the curated catalog by topic (advertising, trackers, malware), each list with its source, its
+// licence, how many entries it has and when it was last downloaded; a checkbox turns it on;
+// - custom lists: an https address and its format (hosts file, one domain per line, one address
+// or network per line);
+// - "Update now"; otherwise lord-server downloads the enabled lists once a day.
+// Lists never override a rule the owner wrote for a destination, and lord-server writes every file
+// (lord.fw.*List); this screen writes none.
+import { View, Text, Button, Segmented, GroupBox, TextInput, useTheme, useLocale, useStore, firewall, firewallState, spacing, typeScale, formatNumber, formatDate, formatTime, tOptional, errorText } from '@lordos/sdk';
+import { useEffect, useState } from 'react';
+
+const TOPICS = ['ads', 'trackers', 'malware', 'custom'];
+
+function CheckBox({ on, onChange }) {
+ const t = useTheme();
+ return (
+ <View onClick={() => onChange(!on)} style={{ width: 16, height: 16, borderRadius: 4, border: `1px solid ${on ? t.accent : t.textDim}`,
+ backgroundColor: on ? t.accent : 'transparent', alignItems: 'center', justifyContent: 'center' }}>
+ {on ? <Text style={{ fontSize: 11, color: '#fff', fontWeight: 700 }}>✓</Text> : null}
+ </View>
+ );
+}
+
+const when = (s) => { const d = new Date(s * 1000); return `${formatDate(d)} ${formatTime(d)}`; };
+
+function ListRow({ l, tr, onToggle, onRemove }) {
+ const t = useTheme();
+ const name = l.custom ? l.url.replace(/^https:\/\//, '') : tOptional(`firewall.lists.name.${l.id}`) || l.id;
+ const entries = l.domains + l.nets;
+ const status = l.error ? tr('firewall.lists.failed', { error: tOptional(`firewall.lists.err.${l.error.split(' ')[0]}`) || l.error })
+ : l.updated ? tr('firewall.lists.updated', { count: formatNumber(entries, 0), when: when(l.updated) })
+ : l.on ? tr('firewall.lists.pending') : l.approx ? tr('firewall.lists.about', { count: formatNumber(l.approx, 0) }) : '';
+ return (
+ <View style={{ minHeight: 44, flexDirection: 'row', alignItems: 'center', gap: spacing.m, paddingVertical: 7 }}>
+ <CheckBox on={l.on} onChange={onToggle} />
+ <View style={{ flex: 1, minWidth: 0, gap: 2 }}>
+ <Text style={{ fontSize: typeScale.body, color: t.text, textAlign: 'start' }} numberOfLines={2}>{name}</Text>
+ <Text style={{ fontSize: typeScale.caption, color: t.textDim, lineHeight: 1.35, textAlign: 'start' }} numberOfLines={2}>
+ {l.custom ? tr(`firewall.lists.format.${l.format}`) : tr('firewall.lists.source', { source: l.source, license: l.license })}
+ </Text>
+ {status ? <Text style={{ fontSize: typeScale.caption, color: l.error ? '#ff9f0a' : t.textDim, lineHeight: 1.35, textAlign: 'start' }}>
+ {status}{l.truncated ? ` · ${tr('firewall.lists.truncated')}` : ''}</Text> : null}
+ </View>
+ {onRemove ? <Button small label={tr('firewall.remove')} onClick={onRemove} /> : null}
+ </View>
+ );
+}
+
+export function BlocklistsPrivacy() {
+ const t = useTheme();
+ const { t: tr } = useLocale();
+ useStore(firewallState);
+ const [st, setSt] = useState(() => firewall.lists());
+ const [url, setUrl] = useState('');
+ const [format, setFormat] = useState('domains');
+ const [msg, setMsg] = useState(null);
+ // while a job runs (a download, a compile) the state is read again every 2 s
+ useEffect(() => {
+ const id = setInterval(() => setSt(firewall.lists()), st?.busy ? 1500 : 6000);
+ return () => clearInterval(id);
+ }, [st?.busy]);
+ if (!firewall.available() || !st) return null;
+ const refresh = () => setSt(firewall.lists());
+ const toggle = (l, on) => { try { firewall.setList(l.id, on); } catch (e) { setMsg(errorText(e)); } refresh(); };
+ const add = () => {
+ try { firewall.addList(url.trim(), format); setUrl(''); setMsg(null); } catch (e) { setMsg(e.message || errorText(e)); }
+ refresh();
+ };
+ const head = (text) => <Text style={{ fontSize: typeScale.body, fontWeight: 600, color: t.text, paddingHorizontal: spacing.xs, textAlign: 'start' }}>{text}</Text>;
+ const foot = (text, color) => <Text style={{ fontSize: typeScale.caption, color: color || t.textDim, lineHeight: 1.4, marginHorizontal: spacing.xs, textAlign: 'start' }}>{text}</Text>;
+ const on = st.lists.filter((l) => l.on).length;
+ return (
+ <View style={{ gap: 20 }}>
+ <View style={{ gap: 6 }}>
+ <View style={{ flexDirection: 'row', alignItems: 'center', minHeight: 22, paddingHorizontal: spacing.xs, gap: spacing.s }}>
+ <Text style={{ flex: 1, fontSize: typeScale.body, fontWeight: 600, color: t.text, textAlign: 'start' }}>{tr('firewall.lists.title')}</Text>
+ <Button small plain label={st.busy ? tr('firewall.lists.working') : tr('firewall.lists.update')} disabled={st.busy || !on}
+ onClick={() => { firewall.updateLists(true); refresh(); }} />
+ </View>
+ {foot(tr('firewall.lists.summary', { lists: formatNumber(on, 0), entries: formatNumber(st.domains + st.nets, 0) }))}
+ </View>
+ {TOPICS.map((topic) => {
+ const lists = st.lists.filter((l) => l.topic === topic);
+ if (!lists.length && topic !== 'custom') return null;
+ return (
+ <View key={topic} style={{ gap: 6 }}>
+ {head(tr(`firewall.lists.topic.${topic}`))}
+ <GroupBox>
+ {lists.map((l) => <ListRow key={l.id} l={l} tr={tr} onToggle={(v) => toggle(l, v)}
+ onRemove={l.custom ? () => { try { firewall.removeList(l.id); } catch (e) { setMsg(e.message); } refresh(); } : null} />)}
+ {topic === 'custom' ? (
+ <View style={{ gap: spacing.s, paddingVertical: spacing.s }}>
+ <TextInput value={url} onChange={setUrl} placeholder={tr('firewall.lists.urlPlaceholder')} onSubmit={add} />
+ <View style={{ flexDirection: 'row', alignItems: 'center', gap: spacing.s }}>
+ <Segmented small value={format} onChange={setFormat}
+ options={[['hosts', tr('firewall.lists.format.hosts')], ['domains', tr('firewall.lists.format.domains')], ['ips', tr('firewall.lists.format.ips')]]} />
+ <View style={{ flex: 1 }} />
+ <Button small label={tr('firewall.lists.add')} disabled={!/^https:\/\/\S+$/.test(url.trim())} onClick={add} />
+ </View>
+ {msg ? <Text style={{ fontSize: typeScale.caption, color: '#ff453a', textAlign: 'start' }}>{msg}</Text> : null}
+ </View>
+ ) : null}
+ </GroupBox>
+ {topic === 'custom' ? foot(tr('firewall.lists.customHint')) : null}
+ </View>
+ );
+ })}
+ {foot(tr('firewall.lists.footer'))}
+ </View>
+ );
+}
diff --git a/apps/monitor/Firewall.jsx b/apps/monitor/Firewall.jsx
index 4d9b5f5..cb2b1ee 100644
--- a/apps/monitor/Firewall.jsx
+++ b/apps/monitor/Firewall.jsx
@@ -10,7 +10,7 @@
// and the clipboard isn't offered yet; a help line per restriction says what it covers.
// The rules are saved by lord-server (lord.fw); this screen writes no files. Drawn like the
// Settings sections: 13/600 headers, inset GroupBoxes with hairlines, footers.
-import { View, Text, Button, Segmented, ScrollView, GroupBox, useTheme, useLocale, useStore, useLauncherApps, firewall, firewallState, spacing, typeScale, errorText } from '@lordos/sdk';
+import { View, Text, Button, Segmented, ScrollView, GroupBox, useTheme, useLocale, useStore, useLauncherApps, firewall, firewallState, spacing, typeScale, errorText, netModel } from '@lordos/sdk';
import { useState } from 'react';
// Firewall id of a launcher app: the built-in ones run inside LordOS.
@@ -24,7 +24,12 @@ const LINUX_NOT_YET = ['no-clipboard'];
// sound streams, notifications), except files: the app's view is built when it starts.
const NEXT_LAUNCH = ['no-files'];
const isLinux = (id) => id.startsWith('desktop:');
-const offered = (id) => (id === 'lordos' ? firewall.RESTRICTIONS.filter((f) => !DESKTOP_ALWAYS.includes(f))
+// (0.8.4) LordOS's components with their own scope (Mail, Store, Printers, Terminal, Blocklists): they
+// take restrictions like an app; the system services (system:*) and the VPN row never do
+const { COMPONENTS } = netModel;
+const COMPONENT_IDS = Object.keys(COMPONENTS).filter((id) => id.startsWith('lordos:') && !COMPONENTS[id].system);
+const NET_ONLY = ['no-internet', 'no-lan', 'no-network', 'no-incoming'];
+const offered = (id) => (COMPONENTS[id] ? NET_ONLY : id === 'lordos' ? firewall.RESTRICTIONS.filter((f) => !DESKTOP_ALWAYS.includes(f))
: isLinux(id) ? firewall.RESTRICTIONS.filter((f) => !LINUX_NOT_YET.includes(f)) : firewall.RESTRICTIONS);
function useAppIndex() {
@@ -45,7 +50,7 @@ function AppLabel({ id, apps, tr }) {
<View style={{ flex: 1, flexDirection: 'row', alignItems: 'center', gap: 8, minWidth: 0 }}>
{Icon ? <Icon size={24} /> : <View style={{ width: 24, height: 24, borderRadius: 6, backgroundColor: t.control }} />}
<View style={{ flex: 1, minWidth: 0, gap: 1 }}>
- <Text style={{ fontSize: typeScale.body, color: t.text, whiteSpace: 'nowrap', overflow: 'hidden', textAlign: 'start' }}>{id === 'lordos' ? tr('monitor.lordos') : a?.name || id.replace(/^(desktop|lpk):/, '')}</Text>
+ <Text style={{ fontSize: typeScale.body, color: t.text, whiteSpace: 'nowrap', overflow: 'hidden', textAlign: 'start' }}>{id === 'lordos' ? tr('monitor.lordos') : COMPONENTS[id] ? tr(COMPONENTS[id].label) : a?.name || id.replace(/^(desktop|lpk):/, '')}</Text>
<Text style={{ fontSize: 10, color: t.textDim, whiteSpace: 'nowrap', overflow: 'hidden', fontFamily: 'monospace', textAlign: 'start' }}>{id}</Text>
</View>
</View>
@@ -56,7 +61,7 @@ function AppLabel({ id, apps, tr }) {
function AddApp({ apps, exclude, onPick, tr }) {
const t = useTheme();
const [open, setOpen] = useState(false);
- const choices = ['lordos', ...apps.keys()].filter((id) => !exclude.has(id));
+ const choices = ['lordos', ...COMPONENT_IDS, ...apps.keys()].filter((id) => !exclude.has(id));
return (
<View style={{ gap: spacing.s, paddingVertical: spacing.s }}>
<View style={{ flexDirection: 'row' }}>
@@ -121,10 +126,10 @@ export function FirewallPrivacy() {
<View style={{ minHeight: 36, flexDirection: 'row', alignItems: 'center', gap: spacing.m, paddingVertical: 7 }}>
<View style={{ flex: 1, minWidth: 0, gap: 2 }}>
<Text style={{ fontSize: typeScale.body, color: t.text, textAlign: 'start' }}>{tr('firewall.mode')}</Text>
- <Text style={{ fontSize: typeScale.caption, color: t.textDim, lineHeight: 1.35, textAlign: 'start' }}>{tr(st.mode === 'off' ? 'firewall.mode.offHint' : 'firewall.mode.silentHint')}</Text>
+ <Text style={{ fontSize: typeScale.caption, color: t.textDim, lineHeight: 1.35, textAlign: 'start' }}>{tr(st.mode === 'off' ? 'firewall.mode.offHint' : st.mode === 'deny' ? 'firewall.mode.denyHint' : 'firewall.mode.silentHint')}</Text>
</View>
- <Segmented small value={st.mode === 'off' ? 'off' : 'silent'} onChange={(m) => firewall.setMode(m)}
- options={[['silent', tr('firewall.mode.silent')], ['off', tr('firewall.mode.off')]]} />
+ <Segmented small value={st.mode === 'off' || st.mode === 'deny' ? st.mode : 'silent'} onChange={(m) => firewall.setMode(m)}
+ options={[['silent', tr('firewall.mode.silent')], ['deny', tr('firewall.mode.deny')], ['off', tr('firewall.mode.off')]]} />
</View>
</GroupBox>
{foot(statusText, status.daemon && status.bpf ? null : '#ff9f0a')}
diff --git a/apps/monitor/FwRules.jsx b/apps/monitor/FwRules.jsx
index ff90abe..d03dd68 100644
--- a/apps/monitor/FwRules.jsx
+++ b/apps/monitor/FwRules.jsx
@@ -12,7 +12,7 @@
// The rules are saved by lord-server (lord.fw); this screen writes no files.
import {
View, Text, Button, Segmented, ScrollView, GroupBox, useTheme, useLocale, useStore, useLauncherApps, firewall, firewallState, fwRule,
- spacing, typeScale, formatDate, formatTime, direction,
+ spacing, typeScale, formatDate, formatTime, direction, netModel,
} from '@lordos/sdk';
import { useEffect, useState } from 'react';
import { RuleSheet, destKind, RED, GREEN } from './RuleSheet.jsx';
@@ -32,7 +32,10 @@ function useAppIndex() {
return byId;
}
-export const appLabelOf = (tr, apps, id) => (id === 'lordos' ? tr('monitor.lordos') : apps.get(id)?.name || id.replace(/^(desktop|lpk):/, ''));
+// (0.8.4) LordOS's own components with their own scope take rules too (Mail, Store, Printers, Terminal, Blocklists)
+const { COMPONENTS } = netModel;
+const COMPONENT_IDS = Object.keys(COMPONENTS).filter((id) => id.startsWith('lordos:') && !COMPONENTS[id].system);
+export const appLabelOf = (tr, apps, id) => (id === 'lordos' ? tr('monitor.lordos') : COMPONENTS[id] ? tr(COMPONENTS[id].label) : apps.get(id)?.name || id.replace(/^(desktop|lpk):/, ''));
function AppIcon({ a, size = 24 }) {
const t = useTheme();
@@ -149,7 +152,7 @@ function AddApp({ apps, exclude, onPick }) {
const t = useTheme();
const { t: tr } = useLocale();
const [open, setOpen] = useState(false);
- const choices = ['lordos', ...apps.keys()].filter((id) => !exclude.has(id));
+ const choices = ['lordos', ...COMPONENT_IDS, ...apps.keys()].filter((id) => !exclude.has(id));
return (
<View style={{ gap: spacing.s, paddingVertical: spacing.s }}>
<View style={{ flexDirection: 'row' }}>
diff --git a/apps/monitor/NetTree.jsx b/apps/monitor/NetTree.jsx
new file mode 100644
index 0000000..f90a59c
--- /dev/null
+++ b/apps/monitor/NetTree.jsx
@@ -0,0 +1,285 @@
+// NetTree.jsx — Monitor → Network's left column, second generation (0.8.4, docs/MONITOR.md):
+// TokenSearch the search field: "app:firefox", "port:443"… (and, on Enter, any word) become chips
+// that combine (sdk/netmodel.js parseSearch / chipFor)
+// ViewButton one pop-up button with the whole view: group by (app, domain, IP, port, country),
+// direction, protocol, status and sort; remembered per user (settings.monitor.netView)
+// NetTree the tree: app → destination (name or address) → address → port, or the other
+// groupings, each row with its sent and received bytes, a small up/down meter and,
+// where a rule can be written, its switch; "N more…" folds long lists
+import {
+ View, Text, SearchField, Overlay, useTheme, useLocale, useSettings, formatBytes, formatNumber, tOptional, direction, firewall, fwRule, netModel, addListener,
+} from '@lordos/sdk';
+import { useEffect, useRef, useState } from 'react';
+import { C, AppGlyph } from './index.jsx';
+
+const { parseSearch, addChips, fold, normView } = netModel;
+const countryName = (cc) => (cc ? tOptional(`countries.${cc}`) || cc : '');
+
+// ---- search with chips ----
+
+const CHIP_COLORS = { app: '#0a84ff', domain: '#30b0c7', ip: '#5e5ce6', port: '#ff9f0a', proto: '#bf5af2', country: '#34c759' };
+
+export function TokenSearch({ chips, setChips, text, setText, tr }) {
+ const t = useTheme();
+ // a finished "type:value" token (followed by a space) becomes a chip at once; Enter turns every word
+ const change = (v) => {
+ if (/\s$/.test(v)) {
+ const q = parseSearch(v, false);
+ if (q.chips.length) { setChips(addChips(chips, q.chips)); setText(q.rest ? `${q.rest} ` : ''); return; }
+ }
+ setText(v);
+ };
+ const commit = () => {
+ const q = parseSearch(text, true);
+ if (q.chips.length) setChips(addChips(chips, q.chips));
+ setText(q.rest);
+ };
+ return (
+ <View style={{ gap: 6 }}>
+ <SearchField value={text} onChange={change} onSubmit={commit} placeholder={tr('monitor.net.searchTokens')}
+ onKeyDown={(e) => { if ((e.key === 'Backspace') && !text && chips.length) { setChips(chips.slice(0, -1)); return true; } return false; }} />
+ {chips.length ? (
+ <View style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 4 }}>
+ {chips.map((c) => (
+ <View key={`${c.type}:${c.value}`} onClick={() => setChips(chips.filter((x) => x !== c))}
+ style={{ flexDirection: 'row', alignItems: 'center', gap: 4, height: 20, paddingHorizontal: 7, borderRadius: 10, backgroundColor: `${CHIP_COLORS[c.type]}2e` }}>
+ <Text style={{ fontSize: 10, fontWeight: 600, color: CHIP_COLORS[c.type] }}>{tr(`monitor.net.chip.${c.type}`)}</Text>
+ <Text style={{ fontSize: 11, color: t.text, direction: 'ltr' }}>{c.type === 'country' && c.value.length === 2 ? countryName(c.value) : c.value}</Text>
+ <Text style={{ fontSize: 10, color: t.textDim }}>✕</Text>
+ </View>
+ ))}
+ <View onClick={() => setChips([])} style={{ height: 20, justifyContent: 'center', paddingHorizontal: 4 }}>
+ <Text style={{ fontSize: 10, color: t.accent }}>{tr('monitor.net.clearChips')}</Text>
+ </View>
+ </View>
+ ) : null}
+ </View>
+ );
+}
+
+// ---- the view pop-up button ----
+
+export function useNetView() {
+ const [s, set] = useSettings();
+ const m = s.monitor || {};
+ const view = normView(m.netView);
+ const setView = (patch) => set({ monitor: { ...m, netView: { ...view, ...patch } } });
+ return [view, setView, m, (patch) => set({ monitor: { ...m, ...patch } })];
+}
+
+const SECTIONS = [
+ ['group', ['app', 'domain', 'ip', 'port', 'country']],
+ ['dir', ['all', 'out', 'in']],
+ ['proto', ['all', 'tcp', 'udp']],
+ ['status', ['all', 'allowed', 'denied', 'rules']],
+ ['sort', ['name', 'most', 'least', 'recent', 'conns']],
+];
+
+export function ViewButton({ view, setView, extra, tr }) {
+ const t = useTheme();
+ const [open, setOpen] = useState(false);
+ const btn = useRef(null), menu = useRef(null);
+ useEffect(() => {
+ if (!open) return undefined;
+ return addListener('pointerdown', (e) => {
+ const inside = (n) => { if (!n) return false; const [x, y, w, h] = lord.getLayout(n.id); return e.x >= x && e.x <= x + w && e.y >= y && e.y <= y + h; };
+ if (!inside(menu.current) && !inside(btn.current)) setOpen(false);
+ });
+ }, [open]);
+ const changed = ['dir', 'proto', 'status'].filter((k) => view[k] !== 'all').length;
+ return (
+ <View ref={btn}>
+ <View onClick={() => setOpen((o) => !o)} style={{ height: 24, paddingHorizontal: 9, borderRadius: t.controlRadiusSmall || 6, flexDirection: 'row', alignItems: 'center', gap: 6,
+ backgroundColor: t.control, boxShadow: '0 1px 1px rgba(0,0,0,0.12)', ...(t.buttonBorder ? { border: `1px solid ${t.separator}` } : null) }}>
+ <Text style={{ fontSize: 12, color: t.text, whiteSpace: 'nowrap' }}>{tr('monitor.net.view.button', { group: tr(`monitor.net.view.group.${view.group}`) })}</Text>
+ {changed ? (
+ <View style={{ minWidth: 14, height: 14, borderRadius: 7, paddingHorizontal: 3, backgroundColor: t.accent, alignItems: 'center', justifyContent: 'center' }}>
+ <Text style={{ fontSize: 9, fontWeight: 700, color: '#fff' }}>{formatNumber(changed, 0)}</Text>
+ </View>
+ ) : null}
+ {t.menuHighlight === 'subtle'
+ ? <View style={{ width: 16, height: 18, alignItems: 'center', justifyContent: 'center' }}>
+ <View style={{ width: 6, height: 6, marginTop: -3, borderRightWidth: 1.5, borderBottomWidth: 1.5, borderColor: t.textDim, transform: 'rotate(45deg)' }} />
+ </View>
+ : <View style={{ width: 16, height: 18, borderRadius: 4, backgroundColor: t.accent, alignItems: 'center', justifyContent: 'center' }}>
+ <Text style={{ fontSize: 8, color: '#fff', lineHeight: 8 }}>▲</Text>
+ <Text style={{ fontSize: 8, color: '#fff', lineHeight: 8 }}>▼</Text>
+ </View>}
+ </View>
+ {open && (
+ <Overlay anchor={btn}>
+ <View ref={menu} style={{ position: 'absolute', top: 28, [direction() === 'rtl' ? 'right' : 'left']: 0, width: 236, paddingVertical: 5, paddingHorizontal: 5,
+ borderRadius: t.menuRadius, backgroundColor: t.popupBg || (t.mode === 'dark' ? '#2c2c31' : '#ffffff'), border: `1px solid ${t.separator}`,
+ boxShadow: '0 10px 30px rgba(0,0,0,0.35)' }}>
+ {SECTIONS.map(([key, values], si) => (
+ <View key={key}>
+ {si ? <View style={{ height: 1, marginVertical: 4, marginHorizontal: 6, backgroundColor: t.separator }} /> : null}
+ <Text style={{ fontSize: 10, fontWeight: 600, color: t.textDim, paddingHorizontal: 8, paddingVertical: 3 }}>{tr(`monitor.net.view.${key}`)}</Text>
+ {values.map((v) => <MenuItem key={v} label={tr(`monitor.net.view.${key}.${v}`)} checked={view[key] === v} onClick={() => setView({ [key]: v })} />)}
+ </View>
+ ))}
+ {(extra || []).map((it) => (
+ <View key={it.label}>
+ <View style={{ height: 1, marginVertical: 4, marginHorizontal: 6, backgroundColor: t.separator }} />
+ <MenuItem label={it.label} checked={it.checked} onClick={() => { setOpen(false); it.onClick(); }} />
+ </View>
+ ))}
+ </View>
+ </Overlay>
+ )}
+ </View>
+ );
+}
+
+function MenuItem({ label, checked, onClick }) {
+ const t = useTheme();
+ const [hover, setHover] = useState(false);
+ const on = hover && t.menuHighlight !== 'subtle';
+ return (
+ <View onClick={onClick} onMouseEnter={() => setHover(true)} onMouseLeave={() => setHover(false)}
+ style={{ height: 22, paddingHorizontal: 8, borderRadius: t.menuItemRadius, flexDirection: 'row', alignItems: 'center', gap: 6,
+ backgroundColor: on ? t.accent : hover ? t.hover : 'transparent' }}>
+ <Text style={{ width: 12, fontSize: 11, color: on ? '#fff' : t.text }}>{checked ? '✓' : ''}</Text>
+ <Text style={{ flex: 1, fontSize: 12, whiteSpace: 'nowrap', color: on ? '#fff' : t.text, textAlign: 'start' }}>{label}</Text>
+ </View>
+ );
+}
+
+// ---- the tree ----
+
+// A small up/down meter: received (down, green) and sent (up, orange) on a log scale of the rate.
+function Meter({ rx, tx, selected }) {
+ const t = useTheme();
+ const h = (v) => (v > 0 ? Math.max(1, Math.min(6, Math.round(Math.log10(v / 64 + 1) * 1.6))) : 0);
+ return (
+ <View style={{ width: 9, height: 14, justifyContent: 'center', alignItems: 'center', direction: 'ltr' }}>
+ <View style={{ width: 4, height: 6, justifyContent: 'flex-end' }}>
+ <View style={{ width: 4, height: h(tx), borderRadius: 1, backgroundColor: selected ? '#fff' : C.tx }} />
+ </View>
+ <View style={{ width: 7, height: 1, backgroundColor: selected ? 'rgba(255,255,255,0.5)' : t.separator }} />
+ <View style={{ width: 4, height: 6 }}>
+ <View style={{ width: 4, height: h(rx), borderRadius: 1, backgroundColor: selected ? '#fff' : C.rx }} />
+ </View>
+ </View>
+ );
+}
+
+// "↓ 1.2 MB ↑ 40 KB", shorter when one side is empty
+export function upDownShort(n) {
+ const parts = [];
+ if (n.rx) parts.push(`↓ ${formatBytes(n.rx)}`);
+ if (n.tx) parts.push(`↑ ${formatBytes(n.tx)}`);
+ return parts.join(' ') || '—';
+}
+
+const placeOf = (tr, n) => (n.cc ? countryName(n.cc) : n.scope ? tr(`monitor.net.scope.${n.scope}`) : '');
+
+// The verdict of a destination row for its app (sdk/fwrule.js decide, as the kernel decides), and a
+// click that writes, flips or removes the rule for exactly that name or address.
+function DestSwitch({ app, name, addr, port, proto, listed, mode, restricted }) {
+ if (!firewall.available() || !firewall.enforceable(app)) return null;
+ const rules = firewall.rules(app);
+ const opts = { listed: !!listed, mode };
+ const q = { names: name ? [name] : [], addr, port: port || 443, proto: proto === 'udp' ? 'udp' : 'tcp' };
+ const v = fwRule.decide(rules, q, restricted, opts);
+ const on = v ? v.action === 'allow' : true;
+ const locked = v?.by === 'restricted';
+ const flip = (e) => {
+ e.stopPropagation();
+ if (locked) return;
+ const op = fwRule.toggleOp(rules, { name, addr, proto: q.proto, port: q.port }, restricted, opts);
+ if (!op) return;
+ if (op.op === 'add') firewall.addRule({ app, ...op.rule });
+ else if (op.op === 'update') firewall.updateRule(op.id, op.rule);
+ else firewall.removeRule(op.id);
+ };
+ return (
+ <View onClick={flip} style={{ width: 22, height: 12, borderRadius: 6, backgroundColor: on ? 'rgba(48,209,88,0.32)' : 'rgba(255,69,58,0.32)',
+ opacity: locked ? 0.45 : 1, justifyContent: 'center', alignItems: on ? 'flex-end' : 'flex-start', paddingHorizontal: 2, direction: 'ltr' }}>
+ <View style={{ width: 8, height: 8, borderRadius: 4, backgroundColor: on ? '#30d158' : '#ff453a' }} />
+ </View>
+ );
+}
+
+const SHOWN = 8;
+
+// Why a destination is allowed or blocked when its own switch isn't what decides: a blocklist, a
+// restriction, another rule ("*.example.com") or the app's default.
+function verdictHint(tr, ctx, app, name, addr, port, proto, listed) {
+ if (!app || !firewall.available() || !firewall.enforceable(app)) return listed ? tr('monitor.net.onList', { list: ctx.listName(listed) }) : '';
+ const v = fwRule.decide(firewall.rules(app), { names: name ? [name] : [], addr, port: port || 443, proto: proto === 'udp' ? 'udp' : 'tcp' },
+ ctx.restrictedOf(app), { listed: !!listed, mode: ctx.mode });
+ if (!v) return '';
+ if (v.by === 'list') return tr('monitor.net.blockedByList', { list: ctx.listName(listed) });
+ if (v.by === 'restricted') return tr('monitor.net.domainRestricted');
+ if (v.by === 'mode') return tr('monitor.net.deniedByMode');
+ const own = name ? fwRule.normDomain(name) : addr;
+ if (v.rule.dst === own && !v.rule.port && !v.rule.proto) return '';
+ return v.rule.dst === 'any' ? tr('monitor.net.domainByDefault') : tr('monitor.net.domainByRule', { rule: v.rule.dst });
+}
+
+// One row below the top level (a destination, an address, a port or an app under a destination).
+export function Child({ node, depth, path, ctx }) {
+ const t = useTheme();
+ const { tr } = ctx;
+ const key = path ? `${path}\u0001${node.key}` : node.key;
+ const open = ctx.open.has(key);
+ const kids = node.children || [];
+ const { list, more } = fold(kids, SHOWN, ctx.all.has(key));
+ const appOf = ctx.appOf(node, path);
+ const sel = ctx.selectedHost && node.addr && ctx.selectedHost === node.addr && ctx.selected === appOf;
+ const label = node.kind === 'app' ? ctx.appLabel(node) : node.kind === 'country' ? (node.cc ? countryName(node.cc) : tr(`monitor.net.scope.${node.scope || 'local'}`)) : node.label;
+ const dot = node.denied || node.blocked ? '#ff453a' : node.listed ? '#ff9f0a' : node.rateRx + node.rateTx > 0 ? t.accent : t.textDim;
+ const destName = node.kind === 'domain' ? node.name : null;
+ const destAddr = node.addr || node.flows[0]?.addr;
+ const canSwitch = appOf && (node.kind === 'domain' || node.kind === 'ip') && !ctx.isSystem(appOf);
+ const inset = 14 + depth * 14;
+ return (
+ <View>
+ <View onClick={() => ctx.onPick(node, appOf)} style={{ flexDirection: 'row', alignItems: 'center', gap: 5, minHeight: 22, borderRadius: 5,
+ ...(direction() === 'rtl' ? { paddingRight: inset } : { paddingLeft: inset }), backgroundColor: sel ? (t.mode === 'dark' ? 'rgba(255,255,255,0.06)' : 'rgba(0,0,0,0.05)') : 'transparent' }}>
+ <View onClick={(e) => { if (!kids.length) return; e.stopPropagation(); ctx.toggle(key); }} style={{ width: 10, alignItems: 'center' }}>
+ <Text style={{ fontSize: 8, color: t.textDim }}>{kids.length ? (open ? '▾' : direction() === 'rtl' ? '◂' : '▸') : ''}</Text>
+ </View>
+ {node.kind === 'app' ? <AppGlyph item={ctx.itemOf(node)} size={13} /> : <View style={{ width: 6, height: 6, borderRadius: 3, backgroundColor: dot }} />}
+ <View style={{ flex: 1, minWidth: 0 }}>
+ <Text style={{ fontSize: 11, color: t.text, whiteSpace: 'nowrap', overflow: 'hidden', fontFamily: node.kind === 'app' || node.kind === 'country' ? undefined : 'monospace',
+ direction: node.kind === 'app' || node.kind === 'country' ? undefined : 'ltr', textAlign: 'start' }}>
+ {label}{node.kind === 'domain' && new Set(node.flows.map((f) => f.addr)).size > 1 ? ` (${new Set(node.flows.map((f) => f.addr)).size})` : ''}
+ </Text>
+ <Text style={{ fontSize: 9, color: t.textDim, whiteSpace: 'nowrap', overflow: 'hidden', textAlign: 'start' }}>
+ {[upDownShort(node), node.kind !== 'country' && node.kind !== 'port' ? placeOf(tr, node.flows[0] || {}) : '',
+ canSwitch ? verdictHint(tr, ctx, appOf, destName, destAddr, node.flows[0]?.port, node.flows[0]?.proto, node.listed)
+ : node.listed ? tr('monitor.net.onList', { list: ctx.listName(node.listed) }) : ''].filter(Boolean).join(' · ')}
+ </Text>
+ </View>
+ <Meter rx={node.rateRx} tx={node.rateTx} />
+ {canSwitch ? <DestSwitch app={appOf} name={destName} addr={destAddr} port={node.flows[0]?.port} proto={node.flows[0]?.proto} listed={node.listed}
+ mode={ctx.mode} restricted={ctx.restrictedOf(appOf)} /> : <View style={{ width: 22 }} />}
+ </View>
+ {open && list.map((c) => <Child key={c.key} node={c} depth={depth + 1} path={key} ctx={ctx} />)}
+ {open && (more || ctx.all.has(key)) && kids.length > SHOWN ? (
+ <View onClick={() => ctx.toggleAll(key)} style={{ height: 18, justifyContent: 'center', ...(direction() === 'rtl' ? { paddingRight: inset + 26 } : { paddingLeft: inset + 26 }) }}>
+ <Text style={{ fontSize: 10, color: t.accent }}>{more ? tr('monitor.net.moreDomains', { count: more }) : tr('monitor.net.fewer')}</Text>
+ </View>
+ ) : null}
+ </View>
+ );
+}
+
+export function TreeChildren({ node, ctx }) {
+ const t = useTheme();
+ const key = node.key;
+ const kids = node.children || [];
+ const { list, more } = fold(kids, SHOWN, ctx.all.has(key));
+ return (
+ <View style={{ paddingBottom: 4, gap: 0 }}>
+ {list.map((c) => <Child key={c.key} node={c} depth={1} path={key} ctx={ctx} />)}
+ {kids.length > SHOWN ? (
+ <View onClick={() => ctx.toggleAll(key)} style={{ height: 20, justifyContent: 'center', ...(direction() === 'rtl' ? { paddingRight: 40 } : { paddingLeft: 40 }) }}>
+ <Text style={{ fontSize: 10, color: t.accent }}>{more ? ctx.tr('monitor.net.moreDomains', { count: more }) : ctx.tr('monitor.net.fewer')}</Text>
+ </View>
+ ) : null}
+ </View>
+ );
+}
diff --git a/apps/monitor/Network.jsx b/apps/monitor/Network.jsx
index 5bcfa06..9b58c43 100644
--- a/apps/monitor/Network.jsx
+++ b/apps/monitor/Network.jsx
@@ -12,8 +12,9 @@
// reglas futuras son { appKey, host | país, puerto, protocolo, dirección, verdict }: la columna
// de regla de la lista y los contadores de permitidas/denegadas ya están en su lugar.
import {
- View, Text, Image, ScrollView, SearchField, useTheme, useLocale, useStore, monitor, monitorConnections, useMonitor,
- formatBytes, formatNumber, tOptional, useSystemInfo, wm, direction, firewall, firewallState, useLauncherApps, Lumo, Button, useAppWindow, fwRule, useSettings,
+ View, Text, ScrollView, useTheme, useLocale, useStore, monitor, monitorConnections, useMonitor,
+ formatBytes, formatNumber, tOptional, useSystemInfo, wm, direction, firewall, firewallState, useLauncherApps, Lumo, Button, useAppWindow, useSettings,
+ netModel, ConfirmDialog,
} from '@lordos/sdk';
import { useEffect, useMemo, useRef, useState } from 'react';
import { C, fmt, AppGlyph, useCardStyle } from './index.jsx';
@@ -23,8 +24,15 @@ import { TrafficChart, systemBuckets } from './TrafficChart.jsx';
import { RuleSheet } from './RuleSheet.jsx';
import { HistoryControls, HistoryChart, useHistory } from './History.jsx';
import { REMOTE_KEY, RemoteDetail, remoteGroup, useRemoteDesktop } from './RemoteDesktop.jsx';
+import { TokenSearch, ViewButton, useNetView, TreeChildren, Child } from './NetTree.jsx';
-export const appKeyOf = (c) => (c.self ? 'lordos' : c.app || c.exe || c.name || '?');
+const { COMPONENTS, isSystemId, filterFlows, groupFlows, sortTree } = netModel;
+
+// (0.8.4) a socket made in an app's scope is that app's (conn.c "scope"), whoever holds it: the ones
+// Mail's connector made are Mail's, a program in the Terminal is the Terminal's
+export const appKeyOf = (c) => c.scope || (c.self ? 'lordos' : c.app || c.exe || c.name || '?');
+// The row's name: LordOS's own components by their label, LordOS itself, or the app's name.
+export const labelOf = (tr, g) => (COMPONENTS[g.key] ? tr(COMPONENTS[g.key].label) : g.key === 'lordos' ? tr('monitor.lordos') : g.name);
const countryName = (cc) => (cc ? tOptional(`countries.${cc}`) || cc : '');
// Where an address is: its country, LAN / this computer, or, for a destination known only from the
@@ -78,10 +86,12 @@ function useGroups(conns) {
const key = appKeyOf(c);
let g = apps.get(key);
if (!g) {
- g = { key, item: c, name: c.self ? null : c.appName || c.name || '?', exe: c.exe, pids: new Set(), conns: [], hosts: new Map(),
- sent: 0, recv: 0, rateTx: 0, rateRx: 0, listen: [], incoming: 0, verdict: 'allow' };
+ const comp = !!COMPONENTS[key] || key === 'lordos';
+ g = { key, item: comp ? { app: key } : c, name: comp || (c.self && !c.scope) ? null : c.appName || c.name || '?', exe: c.exe, pids: new Set(), conns: [], hosts: new Map(),
+ sent: 0, recv: 0, rateTx: 0, rateRx: 0, listen: [], incoming: 0, verdict: 'allow', programs: new Set() };
apps.set(key, g);
}
+ if (c.name && c.scope && !c.self) g.programs.add(c.name);
if (!g.exe && c.exe) g.exe = c.exe;
if (c.pid > 0) g.pids.add(c.pid);
g.conns.push(c);
@@ -134,6 +144,7 @@ function applyBytes(g, v) {
h.rateRx = f[3] || 0;
h.rateTx = f[4] || 0;
h.blocked = f[5] || 0;
+ h.portStats = Array.isArray(f[6]) ? f[6] : null; // (0.8.4) [[port, proto, dir, rx, tx, rxRate, txRate], ...]
g.hosts.set(f[0], h);
}
}
@@ -152,9 +163,11 @@ function withFirewall(groups, fw, launcher) {
for (const [key, v] of Object.entries(counts)) {
if (have.has(key) || key === 'lordos' || !Array.isArray(v) || !(v[0] || v[1] || (hasBytes(fw, v) && (v[2] || v[3])))) continue;
const la = launcher.find((a) => a.id === key || `lpk:${a.id}` === key);
- const name = la?.name || key.replace(/^(desktop|lpk):/, '');
- const g = { key, item: { app: key, appName: name, name, appIcon: la?.icon || '' }, name, exe: '', pids: new Set(), conns: [], hosts: new Map(), sent: 0, recv: 0,
- rateTx: 0, rateRx: 0, listen: [], incoming: 0, verdict: v[1] && !v[0] ? 'deny' : 'allow', rule: firewall.appRule(key), allowed: v[0] || 0, denied: v[1] || 0 };
+ const comp = !!COMPONENTS[key];
+ const name = comp ? null : la?.name || key.replace(/^(desktop|lpk):/, '');
+ const g = { key, item: comp ? { app: key } : { app: key, appName: name, name, appIcon: la?.icon || '' }, name, exe: '', pids: new Set(), conns: [], hosts: new Map(), sent: 0, recv: 0,
+ rateTx: 0, rateRx: 0, listen: [], incoming: 0, verdict: v[1] && !v[0] ? 'deny' : 'allow', rule: firewall.appRule(key), allowed: v[0] || 0, denied: v[1] || 0,
+ programs: new Set(), system: isSystemId(key) };
if (hasBytes(fw, v)) applyBytes(g, v);
out.push(g);
}
@@ -180,12 +193,18 @@ function withFirewall(groups, fw, launcher) {
// Interruptor de la columna Regla: prendido = la app puede usar la red. Escribe la regla
// { app, out, any, allow|deny } (lord.fw); ir y volver no acumula reglas. Las apps sin scope propia
// (un programa suelto, identificado por su ruta) no se pueden filtrar: el interruptor queda fijo.
-function RuleSwitch({ g, selected, tr }) {
+function RuleSwitch({ g, selected, onConfirm }) {
const on = g.rule !== 'deny';
const can = firewall.available() && firewall.enforceable(g.key);
const color = on ? '#30d158' : '#ff453a';
+ // blocking a component with a warning (Store and updates: no security updates) asks first
+ const flip = () => {
+ if (!can) return;
+ if (on && COMPONENTS[g.key]?.warn && onConfirm) onConfirm(g);
+ else firewall.setAppRule(g.key, on ? 'deny' : 'allow');
+ };
return (
- <View onClick={(e) => { e.stopPropagation(); if (can) firewall.setAppRule(g.key, on ? 'deny' : 'allow'); }}
+ <View onClick={(e) => { e.stopPropagation(); flip(); }}
style={{ width: 26, height: 14, borderRadius: 7, backgroundColor: selected ? 'rgba(255,255,255,0.35)' : on ? 'rgba(48,209,88,0.35)' : 'rgba(255,69,58,0.35)',
opacity: can ? 1 : 0.45, justifyContent: 'center', alignItems: on ? 'flex-end' : 'flex-start', paddingHorizontal: 2, direction: 'ltr' }}>
<View style={{ width: 10, height: 10, borderRadius: 5, backgroundColor: selected ? '#fff' : color }} />
@@ -210,98 +229,18 @@ function Activity({ hist, selected }) {
);
}
-// The destinations of an app, one row per name the system resolver gave (its addresses together),
-// or per address when no name is known; busiest first.
-function domainsOf(g, names) {
- const out = new Map();
- for (const h of g.hosts.values()) {
- const name = names.get(h.remote) || null, key = name || h.remote;
- const d = out.get(key) || { key, name, addrs: [], ports: new Set(), sent: 0, recv: 0, count: 0, cc: h.cc, scope: h.scope, recent: true, denied: false };
- d.addrs.push(h.remote);
- for (const p of h.ports || []) d.ports.add(p);
- d.sent += h.sent || 0;
- d.recv += h.recv || 0;
- d.count += h.count || 0;
- if (!h.recent) d.recent = false;
- if (h.denied) d.denied = true;
- if (!d.cc && h.cc) { d.cc = h.cc; d.scope = h.scope; }
- out.set(key, d);
- }
- return [...out.values()].sort((a, b) => b.sent + b.recv - (a.sent + a.recv) || b.count - a.count);
-}
-
-// The first port seen ("TCP 443") as the connection the verdict is worked out for.
-function portOf(d) {
- const p = [...d.ports][0];
- const m = p ? /^(TCP|UDP) (\d+)$/.exec(p) : null;
- return m ? { proto: m[1].toLowerCase(), port: Number(m[2]) } : { proto: 'tcp', port: 443 };
-}
-
-// One destination's own allow / deny switch (0.8.2): what the app's rules decide for it right now
-// (sdk/fwrule.js decide, the same order as the kernel), and one click writes, flips or removes the
-// rule for exactly that name (or address) with lord.fw, as Settings → Network rules by app does.
-function DomainSwitch({ d, g, rules, restricted, can, tr }) {
+function AppRow({ g, node, ctx, open, selected, onToggle, onSelect, maxBytes, tr, hist, onConfirm }) {
const t = useTheme();
- const q = { names: d.name ? [d.name] : [], addr: d.addrs[0], ...portOf(d) };
- const v = fwRule.decide(rules, q, restricted);
- const on = v ? v.action === 'allow' : true;
- const locked = !can || v?.by === 'restricted';
- const flip = (e) => {
- e.stopPropagation();
- if (locked) return;
- const op = fwRule.toggleOp(rules, { name: d.name, addr: d.addrs[0], ...portOf(d) }, restricted);
- if (!op) return;
- if (op.op === 'add') firewall.addRule({ app: g.key, ...op.rule });
- else if (op.op === 'update') firewall.updateRule(op.id, op.rule);
- else firewall.removeRule(op.id);
- };
- const color = on ? '#30d158' : '#ff453a';
- return (
- <View onClick={flip} style={{ width: 22, height: 12, borderRadius: 6, backgroundColor: on ? 'rgba(48,209,88,0.32)' : 'rgba(255,69,58,0.32)',
- opacity: locked ? 0.45 : 1, justifyContent: 'center', alignItems: on ? 'flex-end' : 'flex-start', paddingHorizontal: 2, direction: 'ltr' }}>
- <View style={{ width: 8, height: 8, borderRadius: 4, backgroundColor: color }} />
- </View>
- );
-}
-
-// Why a destination is allowed or blocked when it isn't its own rule: the rule that decides it
-// ("*.example.com", "everything") or the app's restriction.
-function ruleHint(tr, d, rules, restricted) {
- const v = fwRule.decide(rules, { names: d.name ? [d.name] : [], addr: d.addrs[0], ...portOf(d) }, restricted);
- if (!v) return '';
- if (v.by === 'restricted') return tr('monitor.net.domainRestricted');
- const own = d.name ? fwRule.normDomain(d.name) : d.addrs[0];
- if (v.rule.dst === own && !v.rule.port && !v.rule.proto) return '';
- return v.rule.dst === 'any' ? tr('monitor.net.domainByDefault') : tr('monitor.net.domainByRule', { rule: v.rule.dst });
-}
-
-const DOMAINS_SHOWN = 8;
-
-function AppRow({ g, open, selected, onToggle, onSelect, onHost, names, maxBytes, tr, hist, all, onAll, restricted }) {
- const t = useTheme();
- const label = g.key === 'lordos' ? tr('monitor.lordos') : g.name;
+ const label = labelOf(tr, g);
const total = g.sent + g.recv;
- // the order is kept while the row is open, so a switch doesn't move under the pointer when the
- // traffic changes: busiest first when it opens, newcomers below
- const order = useRef(null);
- if (!open) order.current = null;
- let domains = open ? domainsOf(g, names) : [];
- if (open) {
- const seen = order.current || new Map();
- for (const d of domains) if (!seen.has(d.key)) seen.set(d.key, seen.size);
- order.current = seen;
- domains = [...domains].sort((a, b) => seen.get(a.key) - seen.get(b.key));
- }
- const can = firewall.available() && firewall.enforceable(g.key);
- const rules = open && can ? firewall.rules(g.key) : [];
- const shownDomains = all ? domains : domains.slice(0, DOMAINS_SHOWN);
const active = g.conns.length - g.listen.length;
+ const kids = node?.children?.length || 0;
return (
<View>
<View onClick={onSelect} style={{ flexDirection: 'row', alignItems: 'center', gap: 6, minHeight: 40, paddingVertical: 4, paddingHorizontal: 8, borderRadius: 8,
backgroundColor: selected ? t.accent : 'transparent' }}>
<View onClick={(e) => { e.stopPropagation(); onToggle(); }} style={{ width: 14, alignItems: 'center' }}>
- <Text style={{ fontSize: 10, color: selected ? '#fff' : t.textDim }}>{open ? '▾' : direction() === 'rtl' ? '◂' : '▸'}</Text>
+ <Text style={{ fontSize: 10, color: selected ? '#fff' : t.textDim }}>{kids || g.listen.length ? (open ? '▾' : direction() === 'rtl' ? '◂' : '▸') : ''}</Text>
</View>
<AppGlyph item={g.item} size={20} />
<View style={{ flex: 1, minWidth: 0, gap: 3 }}>
@@ -313,9 +252,15 @@ function AppRow({ g, open, selected, onToggle, onSelect, onHost, names, maxBytes
<View style={{ width: `${(g.recv / Math.max(1, maxBytes)) * 100}%`, height: 4, backgroundColor: C.rx }} />
<View style={{ width: `${(g.sent / Math.max(1, maxBytes)) * 100}%`, height: 4, backgroundColor: C.tx }} />
</View>
- <View style={{ paddingHorizontal: 5, height: 14, borderRadius: 7, justifyContent: 'center', backgroundColor: selected ? 'rgba(255,255,255,0.25)' : t.control }}>
- <Text style={{ fontSize: 9, fontWeight: 600, color: selected ? '#fff' : t.textDim }}>{formatNumber(active, 0)}</Text>
- </View>
+ {g.system ? (
+ <View style={{ paddingHorizontal: 5, height: 14, borderRadius: 7, justifyContent: 'center', backgroundColor: selected ? 'rgba(255,255,255,0.25)' : t.control }}>
+ <Text style={{ fontSize: 9, fontWeight: 600, color: selected ? '#fff' : t.textDim }}>{tr('monitor.net.system')}</Text>
+ </View>
+ ) : (
+ <View style={{ paddingHorizontal: 5, height: 14, borderRadius: 7, justifyContent: 'center', backgroundColor: selected ? 'rgba(255,255,255,0.25)' : t.control }}>
+ <Text style={{ fontSize: 9, fontWeight: 600, color: selected ? '#fff' : t.textDim }}>{formatNumber(active, 0)}</Text>
+ </View>
+ )}
{g.denied ? (
<View style={{ paddingHorizontal: 5, height: 14, borderRadius: 7, justifyContent: 'center', backgroundColor: selected ? 'rgba(255,255,255,0.25)' : 'rgba(255,69,58,0.22)' }}>
<Text style={{ fontSize: 9, fontWeight: 600, color: selected ? '#fff' : '#ff453a' }}>{`⊘ ${formatNumber(g.denied, 0)}`}</Text>
@@ -326,34 +271,11 @@ function AppRow({ g, open, selected, onToggle, onSelect, onHost, names, maxBytes
<Activity hist={hist} selected={selected} />
<Text style={{ width: 44, fontSize: 10, color: selected ? '#fff' : t.textDim, textAlign: 'end', whiteSpace: 'nowrap' }}>{total ? formatBytes(total) : '—'}</Text>
{/* regla: permitir / denegar la red a la app (lord-netperm la aplica en el kernel) */}
- <RuleSwitch g={g} selected={selected} tr={tr} />
+ <RuleSwitch g={g} selected={selected} onConfirm={onConfirm} />
</View>
- {open && (
- <View style={{ ...(direction() === 'rtl' ? { paddingRight: 30, paddingLeft: 8 } : { paddingLeft: 30, paddingRight: 8 }), paddingBottom: 4, gap: 1 }}>
- {shownDomains.map((d) => {
- const hint = can ? ruleHint(tr, d, rules, restricted) : '';
- return (
- <View key={d.key} onClick={() => onHost(d.addrs[0])} style={{ flexDirection: 'row', alignItems: 'center', gap: 6, minHeight: 22 }}>
- <View style={{ width: 6, height: 6, borderRadius: 3, backgroundColor: d.denied ? '#ff453a' : d.scope === 'internet' || d.recent ? t.accent : t.textDim }} />
- <View style={{ flex: 1, minWidth: 0 }}>
- <Text style={{ fontSize: 11, color: t.text, whiteSpace: 'nowrap', overflow: 'hidden', fontFamily: 'monospace', direction: 'ltr', textAlign: 'start' }}>
- {d.name || d.key}{d.addrs.length > 1 ? ` (${d.addrs.length})` : ''}
- </Text>
- {hint ? <Text style={{ fontSize: 9, color: t.textDim, whiteSpace: 'nowrap', overflow: 'hidden' }}>{hint}</Text> : null}
- </View>
- <Text style={{ fontSize: 10, color: t.textDim, whiteSpace: 'nowrap' }}>{placeOf(tr, d)}</Text>
- {can ? <DomainSwitch d={d} g={g} rules={rules} restricted={restricted} can={can} tr={tr} /> : null}
- </View>
- );
- })}
- {!domains.length && <Text style={{ fontSize: 11, color: t.textDim, height: 22 }}>{tr('monitor.net.onlyListening', { ports: g.listen.map((c) => c.lport).join(', ') })}</Text>}
- {domains.length > DOMAINS_SHOWN ? (
- <View onClick={onAll} style={{ height: 20, justifyContent: 'center' }}>
- <Text style={{ fontSize: 10, color: t.accent }}>{all ? tr('monitor.net.fewer') : tr('monitor.net.moreDomains', { count: domains.length - DOMAINS_SHOWN })}</Text>
- </View>
- ) : null}
- </View>
- )}
+ {open && node ? <TreeChildren node={node} ctx={ctx} /> : null}
+ {open && !kids ? <Text style={{ fontSize: 11, color: t.textDim, height: 22, ...(direction() === 'rtl' ? { paddingRight: 40 } : { paddingLeft: 40 }) }}>
+ {g.listen.length ? tr('monitor.net.onlyListening', { ports: g.listen.map((c) => c.lport).join(', ') }) : tr('monitor.net.noDestinations')}</Text> : null}
</View>
);
}
@@ -496,7 +418,7 @@ function KV({ k, v, mono, color }) {
const upDown = (tr, g) => tr('monitor.net.downUp', { down: formatBytes(g.recv || 0), up: formatBytes(g.sent || 0) });
-function Summary({ groups, conns, last, tr, fw, names, range, sysHist, launcher }) {
+function Summary({ groups, conns, last, tr, fw, names, range, sysHist, launcher, lists }) {
const t = useTheme();
let fwAllowed = 0, fwDenied = 0;
for (const v of Object.values(fw?.counts || {})) { fwAllowed += v[0] || 0; fwDenied += v[1] || 0; }
@@ -509,6 +431,7 @@ function Summary({ groups, conns, last, tr, fw, names, range, sysHist, launcher
for (const g of groups) for (const h of g.hosts.values()) hosts.push({ ...h, app: g });
hosts.sort((a, b) => b.sent + b.recv - (a.sent + a.recv));
if (hosts.some((h) => h.sent + h.recv)) hosts.splice(0, hosts.length, ...hosts.filter((h) => h.sent + h.recv)); // with traffic, only those that moved bytes
+ const denied = (fw?.events || []).filter((e) => e.v === 'deny' && e.dir === 'out' && (!e.at || Date.now() - e.at < 10 * 60 * 1000));
return (
<>
<Section id="traffic" title={tr('monitor.net.traffic')}>
@@ -534,7 +457,7 @@ function Summary({ groups, conns, last, tr, fw, names, range, sysHist, launcher
<View key={g.key} style={{ flexDirection: 'row', alignItems: 'flex-start', gap: 6 }}>
<View style={{ paddingTop: 1 }}><AppGlyph item={g.item} size={14} /></View>
<View style={{ flex: 1, minWidth: 0, gap: 1 }}>
- <Text style={{ fontSize: 12, color: t.text, lineHeight: 1.3, textAlign: 'start' }} numberOfLines={2}>{g.key === 'lordos' ? tr('monitor.lordos') : g.name}</Text>
+ <Text style={{ fontSize: 12, color: t.text, lineHeight: 1.3, textAlign: 'start' }} numberOfLines={2}>{labelOf(tr, g)}</Text>
<Text style={{ fontSize: 10, color: t.textDim, whiteSpace: 'nowrap', textAlign: 'start' }}>{upDown(tr, g)}</Text>
</View>
</View>
@@ -559,11 +482,28 @@ function Summary({ groups, conns, last, tr, fw, names, range, sysHist, launcher
{!(sysHist?.h?.top || []).length && <Text style={{ fontSize: 12, color: t.textDim }}>{tr('monitor.net.none')}</Text>}
</Section>
) : null}
+ <Section id="denied" title={tr('monitor.net.recentlyDenied')}>
+ {denied.length ? denied.slice(-4).reverse().map((e, i) => (
+ <View key={i} style={{ gap: 1 }}>
+ <Text style={{ fontSize: 11, color: t.text, fontFamily: 'monospace', direction: 'ltr', textAlign: 'start', lineHeight: 1.3 }} numberOfLines={2}>{(e.hosts && e.hosts[0]) || e.addr || '?'}</Text>
+ <Text style={{ fontSize: 10, color: t.textDim, lineHeight: 1.3, textAlign: 'start' }} numberOfLines={2}>
+ {`${labelOf(tr, groups.find((g) => g.key === e.app) || { key: e.app, name: e.app })} · ${tr(`monitor.net.by.${e.by === 'list' || e.by === 'restricted' || e.by === 'mode' ? e.by : 'rule'}`)}`}
+ </Text>
+ </View>
+ )) : <Text style={{ fontSize: 12, color: t.textDim }}>{tr('monitor.net.noneDenied')}</Text>}
+ </Section>
+ <Section id="blocklists" title={tr('monitor.net.blocklists')}>
+ <KV k={tr('monitor.net.listsOn')} v={formatNumber((lists?.lists || []).filter((l) => l.on).length, 0)} />
+ <KV k={tr('monitor.net.listsEntries')} v={formatNumber((lists?.domains || 0) + (lists?.nets || 0), 0)} />
+ <View onClick={() => wm.open('settings', { args: { section: 'privacy', nonce: Date.now() } })} style={{ flexDirection: 'row', justifyContent: 'flex-end' }}>
+ <Text style={{ fontSize: 11, color: t.accent }}>{tr('monitor.net.listsManage')}</Text>
+ </View>
+ </Section>
<Section id="destinations" title={tr('monitor.net.topHosts')}>
{hosts.slice(0, 6).map((h) => (
<View key={`${h.app.key}${h.remote}`} style={{ gap: 1 }}>
<Text style={{ fontSize: 11, color: t.text, fontFamily: 'monospace', direction: 'ltr', textAlign: 'start', lineHeight: 1.3 }} numberOfLines={2}>{names.get(h.remote) || h.remote}</Text>
- <Text style={{ fontSize: 10, color: t.textDim, lineHeight: 1.3, textAlign: 'start' }} numberOfLines={2}>{`${upDown(tr, h)} · ${placeOf(tr, h)} · ${h.app.key === 'lordos' ? tr('monitor.lordos') : h.app.name}`}</Text>
+ <Text style={{ fontSize: 10, color: t.textDim, lineHeight: 1.3, textAlign: 'start' }} numberOfLines={2}>{`${upDown(tr, h)} · ${placeOf(tr, h)} · ${labelOf(tr, h.app)}`}</Text>
</View>
))}
{!hosts.length && <Text style={{ fontSize: 12, color: t.textDim }}>{tr('monitor.net.none')}</Text>}
@@ -599,6 +539,9 @@ function HostRow({ h, name, selected, onSelect, can, onRule, tr }) {
function Detail({ g, tr, user, names, host, onHost, onRule, hist, range, end }) {
const t = useTheme();
const can = firewall.available() && firewall.enforceable(g.key);
+ const comp = COMPONENTS[g.key];
+ let dns = [];
+ if (g.key === 'system:dns') { try { dns = (lord.net?.dns?.()?.servers || []).slice(0, 4); } catch (e) { dns = []; } }
const ports = new Set(), local = new Set();
for (const c of g.conns) {
if (c.dir === 'listen') local.add(`${c.proto.toUpperCase()} ${c.lport}`);
@@ -610,17 +553,21 @@ function Detail({ g, tr, user, names, host, onHost, onRule, hist, range, end })
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 10 }}>
<AppGlyph item={g.item} size={32} />
<View style={{ flex: 1, minWidth: 0 }}>
- <Text style={{ fontSize: 15, fontWeight: 600, color: t.text, lineHeight: 1.25, textAlign: 'start' }} numberOfLines={2}>{g.key === 'lordos' ? tr('monitor.lordos') : g.name}</Text>
- <Text style={{ fontSize: 11, color: t.textDim }}>{tr('monitor.net.connCount', { count: g.conns.length - g.listen.length })}</Text>
+ <Text style={{ fontSize: 15, fontWeight: 600, color: t.text, lineHeight: 1.25, textAlign: 'start' }} numberOfLines={2}>{labelOf(tr, g)}</Text>
+ <Text style={{ fontSize: 11, color: t.textDim }}>{g.system ? tr('monitor.net.systemService') : tr('monitor.net.connCount', { count: g.conns.length - g.listen.length })}</Text>
</View>
</View>
- <Section id="process" title={tr('monitor.net.process')}>
+ {comp ? <Text style={{ fontSize: 11, color: t.textDim, lineHeight: 1.4, textAlign: 'start' }}>{tr(comp.hint)}</Text> : null}
+ {g.key === 'lordos:terminal' && g.programs?.size ? <KV k={tr('monitor.net.programs')} v={[...g.programs].join(', ')} /> : null}
+ {g.key === 'system:dns' && dns.length ? <KV k={tr('monitor.net.dnsServers')} v={dns.join(', ')} mono /> : null}
+ {g.tunnels ? g.tunnels.map((v) => <KV key={v.name} k={v.name} v={`↓ ${formatBytes(v.rx)} · ↑ ${formatBytes(v.tx)}`} mono />) : null}
+ {g.system ? null : <Section id="process" title={tr('monitor.net.process')}>
<Text style={{ fontSize: 12, color: t.textDim }}>{tr('monitor.net.path')}</Text>
<Text style={{ fontSize: 11, color: t.text, fontFamily: 'monospace', lineHeight: 1.35, direction: 'ltr', textAlign: 'start' }}>{g.exe || '—'}</Text>
<KV k={tr('monitor.user')} v={user || '—'} />
<KV k={tr('monitor.pid')} v={[...g.pids].join(', ') || '—'} />
- </Section>
- <Section id="rule" title={tr('monitor.net.rule')}>
+ </Section>}
+ {g.system ? null : <Section id="rule" title={tr('monitor.net.rule')}>
<KV k={tr('monitor.net.rule')} v={tr(g.rule === 'deny' ? 'firewall.rule.deny' : g.rule === 'allow' ? 'firewall.rule.allow' : 'firewall.rule.none')}
color={g.rule === 'deny' ? '#ff453a' : '#30d158'} />
{g.allowed || g.denied ? <KV k={tr('firewall.counts')} v={tr('firewall.countsValue', { allowed: g.allowed || 0, denied: g.denied || 0 })} /> : null}
@@ -630,7 +577,7 @@ function Detail({ g, tr, user, names, host, onHost, onRule, hist, range, end })
<Text style={{ fontSize: 11, color: t.accent }}>{tr('fwrules.appRulesLink', { count: firewall.rules(g.key).length })}</Text>
</View>
) : null}
- </Section>
+ </Section>}
<Section id="appConnections" title={tr('monitor.net.connections')}>
<KV k={tr('monitor.net.active')} v={formatNumber(g.conns.length - g.listen.length, 0)} />
<KV k={tr('monitor.net.incoming')} v={formatNumber(g.conns.filter((c) => c.dir === 'in').length, 0)} />
@@ -707,6 +654,93 @@ function PlaceDetail({ p, tr }) {
);
}
+// ---- the list's flows (0.8.4) ----
+
+// When each destination last moved bytes (ms), for "Most recent".
+const lastSeen = new Map();
+function seen(key, active) {
+ if (active) { if (lastSeen.size > 8192 && !lastSeen.has(key)) lastSeen.delete(lastSeen.keys().next().value); lastSeen.set(key, Date.now()); }
+ return lastSeen.get(key) || 0;
+}
+
+// One flow per (app, address, port) for sdk/netmodel.js: the kernel's per-port counters when
+// lord-netperm sends them (COUNTS), the open sockets' ports otherwise. Apps with no destination yet
+// (only listening, or a component that hasn't connected) keep a flow with no address, so their row stays.
+function flowsOf(apps, names, tr) {
+ const out = [];
+ const listedCache = new Map();
+ const listed = (name, addr) => {
+ const k = `${name || ''}|${addr}`;
+ if (!listedCache.has(k)) listedCache.set(k, firewall.listMatch(name ? [name] : [], addr));
+ return listedCache.get(k);
+ };
+ for (const g of apps) {
+ const base = { app: g.key, appName: labelOf(tr, g), system: !!g.system };
+ let any = false;
+ for (const h of g.hosts.values()) {
+ if (!h.remote) continue;
+ any = true;
+ const name = names.get(h.remote) || null;
+ const common = { ...base, name, addr: h.remote, cc: h.cc || '', scope: h.scope || '', denied: h.denied ? 1 : 0, blocked: h.blocked || 0, listed: listed(name, h.remote) };
+ const ps = (h.portStats || []).filter((p) => Array.isArray(p) && p.length >= 7);
+ if (ps.length) {
+ const share = Math.max(1, ps.length);
+ for (const p of ps) {
+ const active = (p[5] || 0) + (p[6] || 0) > 0;
+ out.push({ ...common, port: Number(p[0]) || 0, proto: p[1] === 'udp' ? 'udp' : p[1] === 'tcp' ? 'tcp' : 'other', dir: p[2] === 'in' ? 'in' : 'out',
+ rx: p[3] || 0, tx: p[4] || 0, rateRx: p[5] || 0, rateTx: p[6] || 0, conns: Math.ceil((h.count || 0) / share), last: seen(`${g.key}|${h.remote}|${p[0]}`, active) });
+ }
+ continue;
+ }
+ const ports = [...(h.ports || [])].map((x) => /^(TCP|UDP) (\d+)$/.exec(x)).filter(Boolean);
+ const active = (h.rateRx || 0) + (h.rateTx || 0) > 0;
+ const dir = g.conns.some((c) => c.remote === h.remote && c.dir === 'in') ? 'in' : 'out';
+ if (!ports.length) ports.push([null, 'TCP', '0']);
+ ports.forEach((m, i) => out.push({ ...common, port: Number(m[2]) || 0, proto: m[1] === 'UDP' ? 'udp' : 'tcp', dir,
+ rx: i ? 0 : h.recv || 0, tx: i ? 0 : h.sent || 0, rateRx: i ? 0 : h.rateRx || 0, rateTx: i ? 0 : h.rateTx || 0, conns: i ? 0 : h.count || 0,
+ last: seen(`${g.key}|${h.remote}`, active) }));
+ }
+ if (!any) out.push({ ...base, name: null, addr: '', port: 0, proto: 'other', dir: g.listen.length ? 'in' : 'out', rx: g.recv || 0, tx: g.sent || 0,
+ rateRx: g.rateRx || 0, rateTx: g.rateTx || 0, conns: 0, denied: g.denied || 0, cc: '', scope: '', last: 0, listed: null, empty: true });
+ }
+ return out;
+}
+
+// The VPN tunnels as one row (0.8.4): LordOS's own VPN interfaces (Settings → Network), their
+// interface counters and rates. Shown, not blockable: the tunnel is the system's network.
+function useVpnGroup(tr) {
+ const [st, setSt] = useState({ at: 0, list: [] });
+ useEffect(() => {
+ const prev = new Map();
+ const read = () => {
+ let ifs = [];
+ try { ifs = typeof lord !== 'undefined' && lord.net ? lord.net.interfaces() || [] : []; } catch (e) { ifs = []; }
+ const now = Date.now();
+ const list = ifs.filter((i) => i.managed === 'lordos' && (i.type === 'wireguard' || i.type === 'tun' || /^(wg|ovpn|ips|ppp|oc|fvpn)-/.test(i.name)) && i.up)
+ .map((i) => {
+ const p = prev.get(i.name);
+ const dt = p ? Math.max(0.5, (now - p.t) / 1000) : 0;
+ const r = { name: i.name, rx: i.rxBytes || 0, tx: i.txBytes || 0, rateRx: dt ? Math.max(0, (i.rxBytes - p.rx) / dt) : 0, rateTx: dt ? Math.max(0, (i.txBytes - p.tx) / dt) : 0 };
+ prev.set(i.name, { t: now, rx: i.rxBytes || 0, tx: i.txBytes || 0 });
+ return r;
+ });
+ setSt({ at: now, list });
+ };
+ read();
+ const id = setInterval(read, 2000);
+ return () => clearInterval(id);
+ }, []);
+ if (!st.list.length) return null;
+ const g = { key: 'lordos:vpn', item: { app: 'lordos:vpn' }, name: null, exe: '', pids: new Set(), conns: [], hosts: new Map(), listen: [], incoming: 0,
+ sent: 0, recv: 0, rateTx: 0, rateRx: 0, rule: null, allowed: 0, denied: 0, programs: new Set(), system: true, tunnels: st.list };
+ for (const v of st.list) {
+ g.recv += v.rx; g.sent += v.tx; g.rateRx += v.rateRx; g.rateTx += v.rateTx;
+ g.hosts.set(v.name, { remote: v.name, cc: '', scope: 'local', ports: new Set(), recv: v.rx, sent: v.tx, rateRx: v.rateRx, rateTx: v.rateTx, count: 1 });
+ }
+ void tr;
+ return g;
+}
+
// ---- pestaña ----
export function NetworkTab({ last, prefs }) {
@@ -720,44 +754,108 @@ export function NetworkTab({ last, prefs }) {
const { apps: connApps } = useGroups(conns);
const launcher = useLauncherApps();
const fwApps = useMemo(() => withFirewall(connApps, fw, launcher), [connApps, fw, launcher]);
- // the remote desktop (lord-sessiond, root) as one more app while it's on (RemoteDesktop.jsx)
+ // the remote desktop (lord-sessiond, root) as one more app while it's on (RemoteDesktop.jsx), and
+ // the VPN tunnels (0.8.4)
const rd = useRemoteDesktop();
const rdg = remoteGroup(rd, tr);
- const apps = rdg ? [...fwApps, rdg].sort((a, b) => b.sent + b.recv - (a.sent + a.recv) || b.conns.length - a.conns.length) : fwApps;
- const [q, setQ] = useState('');
+ const vpn = useVpnGroup(tr);
+ const apps = [...fwApps, ...(rdg ? [rdg] : []), ...(vpn ? [vpn] : [])].sort((a, b) => b.sent + b.recv - (a.sent + a.recv) || b.conns.length - a.conns.length);
+ const [view, setView, mprefs, setPrefs] = useNetView();
+ const [chips, setChips] = useState([]);
+ const [text, setText] = useState('');
const [open, setOpen] = useState(() => new Set());
const [selected, setSelected] = useState(null); // app elegida (clave)
const [place, setPlace] = useState(null); // país elegido en el mapa
const [host, setHost] = useState(null); // the selected app's address with the actions open
const [sheet, setSheet] = useState(null); // { app, label, dst, action, suggestions, note }
- const [allDomains, setAllDomains] = useState(() => new Set()); // apps whose every destination is listed
+ const [all, setAll] = useState(() => new Set()); // tree rows whose every child is listed
+ const [confirm, setConfirm] = useState(null); // a component whose blocking needs a warning (Store)
const [range, setRange] = useState('live'); // the traffic chart's zoom: 'live' or a history window
const [end, setEnd] = useState(null); // the history window's end (Unix s), null = now
const sysHist = useHistory(range === 'live' ? null : range, end, null);
const restrictedOf = useMemo(() => firewall.state().restricted || {}, [fw.rev]);
+ const mode = useMemo(() => firewall.state().mode || 'silent', [fw.rev]);
const names = useMemo(() => namesOf(fw.events), [fw.events]);
const hist = useRateHistory(apps);
+ const lists = useMemo(() => firewall.lists(), [fw.rev, fw.counts]);
+ const listName = (id) => {
+ const l = lists?.lists?.find((x) => x.id === id);
+ return l ? (l.custom ? l.url.replace(/^https:\/\//, '').split('/')[0] : tOptional(`firewall.lists.name.${id}`) || id) : id;
+ };
const ruleFor = (g, addr, action) => {
const name = names.get(addr);
- setSheet({ app: g.key, label: g.key === 'lordos' ? tr('monitor.lordos') : g.name, dst: name || addr, action,
+ setSheet({ app: g.key, label: labelOf(tr, g), dst: name || addr, action,
suggestions: name ? nameChoices(name) : [], note: name ? tr('fwrules.sheet.nameNote') : tr('fwrules.sheet.noName') });
};
const enabled = prefs.connections !== false;
- const needle = q.trim().toLowerCase();
- const shown = apps.filter((g) => !needle || `${g.name || tr('monitor.lordos')} ${g.exe || ''} ${[...g.hosts.keys()].join(' ')} ${[...g.hosts.values()].map((h) => countryName(h.cc)).join(' ')}`.toLowerCase().includes(needle));
- const maxBytes = Math.max(1, ...apps.map((g) => g.sent + g.recv));
- const sel = apps.find((g) => g.key === selected) || null;
+ const byKey = new Map(apps.map((g) => [g.key, g]));
+
+ // the list: flows → filters and chips → the tree (sdk/netmodel.js); in a history window, the
+ // apps of that window from the history file (it never keeps addresses or names)
+ const live = range === 'live';
+ const flows = live ? flowsOf(apps, names, tr) : [];
+ const hasRule = (f) => firewall.enforceable(f.app) && firewall.rules(f.app).some((r) => r.dst === (f.name || f.addr) || r.dst === f.addr);
+ const shownFlows = filterFlows(flows, view, { chips, rest: text.trim() }, { hasRule, countryName });
+ const tree = sortTree(groupFlows(shownFlows, view.group), view.sort);
+ const filtered = chips.length > 0 || !!text.trim() || view.dir !== 'all' || view.proto !== 'all' || view.status !== 'all';
+ const histRoots = !live ? (sysHist?.h?.top || []).map(([id, rx, tx]) => {
+ const la = launcher.find((a) => a.id === id || `lpk:${a.id}` === id || `desktop:${a.id}` === id);
+ const g = byKey.get(id) || { key: id, item: COMPONENTS[id] ? { app: id } : { app: id, appName: la?.name, name: la?.name || id, appIcon: la?.icon || '', self: id === 'lordos' },
+ name: COMPONENTS[id] || id === 'lordos' ? null : la?.name || id.replace(/^(desktop|lpk):/, ''), conns: [], listen: [], hosts: new Map(), rule: firewall.appRule(id), denied: 0, programs: new Set() };
+ return { ...g, recv: rx, sent: tx, rateRx: 0, rateTx: 0, histOnly: true };
+ }).filter((g) => {
+ const f = { app: g.key, appName: labelOf(tr, g), name: null, addr: '', port: 0, proto: 'other', dir: 'out', cc: '' };
+ return netModel.matchesSearch(f, { chips: chips.filter((c) => c.type === 'app'), rest: text.trim() }, countryName);
+ }) : [];
+
+ const maxBytes = Math.max(1, ...apps.map((g) => g.sent + g.recv), ...histRoots.map((g) => g.sent + g.recv));
+ const sel = apps.find((g) => g.key === selected) || histRoots.find((g) => g.key === selected) || null;
const places = placesOf(apps, sel ? sel.key : null);
const selPlace = places.find((p) => p.cc === place) || null;
- const toggle = (key) => setOpen((s) => { const n = new Set(s); if (n.has(key)) n.delete(key); else n.add(key); return n; });
- const column = { borderRadius: 12, backgroundColor: card.bg, border: `1px solid ${t.separator}`, padding: 12 };
+ const toggle = (key) => setOpen((s0) => { const n = new Set(s0); if (n.has(key)) n.delete(key); else n.add(key); return n; });
+ const ctx = {
+ tr, open, all, mode, listName,
+ toggle,
+ toggleAll: (key) => setAll((s0) => { const n = new Set(s0); if (n.has(key)) n.delete(key); else n.add(key); return n; }),
+ selected, selectedHost: host,
+ isSystem: (id) => isSystemId(id) || id === REMOTE_KEY,
+ restrictedOf: (id) => restrictedOf[id] || [],
+ appLabel: (n) => labelOf(tr, byKey.get(n.app) || { key: n.app, name: n.label }),
+ itemOf: (n) => byKey.get(n.app)?.item || { app: n.app, appName: n.label },
+ appOf: (n, path) => {
+ if (n.kind === 'app') return n.app;
+ const seg = String(path || '').split('\u0001').find((k) => k.startsWith('a:'));
+ if (seg) return seg.slice(2);
+ const ids = new Set(n.flows.map((f) => f.app));
+ return ids.size === 1 ? [...ids][0] : null;
+ },
+ onPick: (n, appOf) => {
+ if (n.kind === 'country' && n.cc) { setSelected(null); setHost(null); setPlace(n.cc); return; }
+ if (!appOf) return;
+ setPlace(null);
+ setSelected(appOf);
+ setHost(n.addr || n.flows.find((f) => f.addr)?.addr || null);
+ },
+ };
+ const column = { borderRadius: 12, backgroundColor: card.bg, border: `1px solid ${t.separator}`, padding: 10 };
+ const roots = live ? tree : histRoots;
+ const extra = [
+ { label: tr('monitor.net.view.menuItem'), checked: mprefs.menuItem === true, onClick: () => setPrefs({ menuItem: mprefs.menuItem !== true }) },
+ { label: tr('monitor.net.view.blocklists'), onClick: () => wm.open('settings', { args: { section: 'privacy', nonce: Date.now() } }) },
+ ];
return (
<View style={{ flex: 1, flexDirection: 'row', gap: 12, paddingHorizontal: 20, paddingVertical: 16 }}>
{/* left */}
- <View style={{ ...column, width: 336, gap: 8, padding: 10 }}>
- <SearchField value={q} onChange={setQ} placeholder={tr('monitor.net.search')} />
+ <View style={{ ...column, width: 336, gap: 8 }}>
+ <TokenSearch chips={chips} setChips={setChips} text={text} setText={setText} tr={tr} />
+ <View style={{ flexDirection: 'row', alignItems: 'center', gap: 8 }}>
+ <ViewButton view={view} setView={setView} extra={extra} tr={tr} />
+ <Text style={{ flex: 1, fontSize: 10, color: t.textDim, textAlign: 'end', whiteSpace: 'nowrap', overflow: 'hidden' }}>
+ {live ? tr(`monitor.net.count.${view.group}`, { count: roots.length }) : tr('monitor.net.count.app', { count: roots.length })}
+ </Text>
+ </View>
<View style={{ flexDirection: 'row', paddingHorizontal: 8 }}>
- <Text style={{ flex: 1, fontSize: 10, fontWeight: 600, color: t.textDim }}>{tr('monitor.net.apps', { count: apps.length })}</Text>
+ <Text style={{ flex: 1, fontSize: 10, fontWeight: 600, color: t.textDim }}>{tr(`monitor.net.view.group.${live ? view.group : 'app'}`)}</Text>
<Text style={{ width: 75, fontSize: 10, fontWeight: 600, color: t.textDim, textAlign: 'end' }}>{tr('monitor.net.dataCol')}</Text>
<Text style={{ width: 38, fontSize: 10, fontWeight: 600, color: t.textDim, textAlign: 'end' }}>{tr('monitor.net.ruleCol')}</Text>
</View>
@@ -765,24 +863,32 @@ export function NetworkTab({ last, prefs }) {
{!enabled && <Text style={{ fontSize: 12, color: t.textDim, padding: 8, lineHeight: 1.4 }}>{tr('monitor.net.disabled')}</Text>}
{enabled && !conns && <Text style={{ fontSize: 12, color: t.textDim, padding: 8 }}>{tr('monitor.loading')}</Text>}
{enabled && conns && !conns.ok && <Text style={{ fontSize: 12, color: '#ff9f0a', padding: 8 }}>{tr('monitor.net.noDiag')}</Text>}
- {shown.map((g) => (
- <AppRow key={g.key} g={g} tr={tr} open={open.has(g.key)} selected={selected === g.key} maxBytes={maxBytes} names={names} hist={hist.get(g.key)}
- all={allDomains.has(g.key)} restricted={restrictedOf[g.key] || []}
- onAll={() => setAllDomains((s0) => { const n = new Set(s0); if (n.has(g.key)) n.delete(g.key); else n.add(g.key); return n; })}
- onToggle={() => toggle(g.key)} onSelect={() => { setPlace(null); setHost(null); setSelected(selected === g.key ? null : g.key); }}
- onHost={(addr) => { setPlace(null); setSelected(g.key); setHost(addr); }} />
- ))}
- {enabled && conns && !shown.length && <Text style={{ fontSize: 12, color: t.textDim, padding: 8 }}>{tr('monitor.net.none')}</Text>}
+ {!live ? <Text style={{ fontSize: 10, color: t.textDim, paddingHorizontal: 8, paddingBottom: 4, lineHeight: 1.35 }}>{tr('monitor.net.rangeNote', { range: tr(`monitor.hist.${range}`) })}</Text> : null}
+ {roots.map((n) => {
+ if (!live) return <AppRow key={n.key} g={n} tr={tr} open={false} selected={selected === n.key} maxBytes={maxBytes} hist={null}
+ onToggle={() => {}} onSelect={() => { setPlace(null); setHost(null); setSelected(selected === n.key ? null : n.key); }} />;
+ if (view.group === 'app') {
+ const g = byKey.get(n.app);
+ if (!g) return null;
+ // filtered, the row adds up what matched; otherwise the app's own totals (the kernel's)
+ const shownG = filtered ? { ...g, recv: n.rx, sent: n.tx, rateRx: n.rateRx, rateTx: n.rateTx } : g;
+ return <AppRow key={n.key} g={shownG} node={n} ctx={ctx} tr={tr} open={open.has(n.key)} selected={selected === g.key} maxBytes={maxBytes} hist={hist.get(g.key)}
+ onConfirm={(x) => setConfirm(x)} onToggle={() => toggle(n.key)}
+ onSelect={() => { setPlace(null); setHost(null); setSelected(selected === g.key ? null : g.key); }} />;
+ }
+ return <Child key={n.key} node={n} depth={0} path="" ctx={ctx} />;
+ })}
+ {enabled && conns && !roots.length && <Text style={{ fontSize: 12, color: t.textDim, padding: 8 }}>{chips.length || text ? tr('monitor.net.noMatch') : tr('monitor.net.none')}</Text>}
</ScrollView>
<View style={{ height: 1, backgroundColor: t.separator }} />
<SystemTraffic tr={tr} range={range} setRange={setRange} end={end} setEnd={setEnd} sysHist={sysHist} />
</View>
{/* centro: el mapa ocupa toda la altura */}
- <View style={{ ...column, flex: 1, minWidth: 0, gap: 8, padding: 10 }}>
+ <View style={{ ...column, flex: 1, minWidth: 0, gap: 8 }}>
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 8, paddingHorizontal: 2 }}>
<Glyph name="globe" color={t.accent} />
<Text style={{ flex: 1, fontSize: 12, fontWeight: 600, color: t.textDim, whiteSpace: 'nowrap', overflow: 'hidden' }}>
- {(sel ? tr('monitor.net.mapOf', { app: sel.key === 'lordos' ? tr('monitor.lordos') : sel.name }) : tr('monitor.net.map')) + ' · ' +
+ {(sel ? tr('monitor.net.mapOf', { app: labelOf(tr, sel) }) : tr('monitor.net.map')) + ' · ' +
tr('monitor.net.mapLegend', { countries: places.length, count: places.reduce((a, p) => a + p.count, 0) })}
</Text>
{(sel || selPlace) && <View onClick={() => { setSelected(null); setPlace(null); }}><Text style={{ fontSize: 11, color: t.accent }}>{tr('monitor.net.showAll')}</Text></View>}
@@ -794,12 +900,12 @@ export function NetworkTab({ last, prefs }) {
</View>
</View>
{/* derecha */}
- <View style={{ ...column, width: 270 }}>
+ <View style={{ ...column, width: 270, padding: 12 }}>
<ScrollView style={{ flex: 1, marginHorizontal: -12 }} contentStyle={{ paddingHorizontal: 12 }}>
<View style={{ gap: 16 }}>
{selPlace ? <PlaceDetail p={selPlace} tr={tr} /> : sel?.key === REMOTE_KEY ? <RemoteDetail rd={rd} Section={Section} KV={KV} tr={tr} /> : sel ? (
<Detail g={sel} tr={tr} user={sys.user} names={names} host={host} onHost={setHost} hist={hist.get(sel.key)} range={range} end={end} onRule={(addr, action) => ruleFor(sel, addr, action)} />
- ) : <Summary groups={apps} conns={conns} last={last} tr={tr} fw={fw} names={names} range={range} sysHist={sysHist} launcher={launcher} />}
+ ) : <Summary groups={apps} conns={conns} last={last} tr={tr} fw={fw} names={names} range={range} sysHist={sysHist} launcher={launcher} lists={lists} />}
</View>
</ScrollView>
</View>
@@ -807,6 +913,11 @@ export function NetworkTab({ last, prefs }) {
<RuleSheet overlay app={sheet.app} appLabel={sheet.label} initial={{ dst: sheet.dst, action: sheet.action }} suggestions={sheet.suggestions} note={sheet.note}
onDone={() => setSheet(null)} />
) : null}
+ {confirm ? (
+ <ConfirmDialog title={tr('monitor.comp.blockTitle', { app: labelOf(tr, confirm) })} detail={tr(COMPONENTS[confirm.key]?.warn || 'monitor.comp.storeWarn')}
+ okLabel={tr('monitor.comp.blockAnyway')} cancelLabel={tr('monitor.comp.keep')} destructive
+ onOk={() => { firewall.setAppRule(confirm.key, 'deny'); setConfirm(null); }} onCancel={() => setConfirm(null)} />
+ ) : null}
</View>
);
}
diff --git a/apps/monitor/Privacy.jsx b/apps/monitor/Privacy.jsx
index 4dfdaea..e24262a 100644
--- a/apps/monitor/Privacy.jsx
+++ b/apps/monitor/Privacy.jsx
@@ -43,6 +43,9 @@ export function MonitorPrivacy() {
<Row label={tr('monitor.privacy.history')} hint={tr('monitor.privacy.historyHint')}>
<Toggle small on={m.history !== false} onChange={(on) => put({ history: on })} />
</Row>
+ <Row label={tr('monitor.privacy.menuItem')} hint={tr('monitor.privacy.menuItemHint')}>
+ <Toggle small on={m.menuItem === true} onChange={(on) => put({ menuItem: on })} />
+ </Row>
<View style={{ flexDirection: 'row', justifyContent: 'flex-end', paddingVertical: 6 }}>
<Button small label={cleared ? tr('monitor.privacy.cleared') : tr('monitor.privacy.clear')} disabled={cleared}
onClick={() => { if (monitor.clearHistory()) setCleared(true); }} />
diff --git a/apps/monitor/icons.jsx b/apps/monitor/icons.jsx
index a6e9486..8fa965d 100644
--- a/apps/monitor/icons.jsx
+++ b/apps/monitor/icons.jsx
@@ -122,6 +122,52 @@ export function Glyph({ name, color, size = 13 }) {
<View style={{ position: 'absolute', left: s * 0.06, right: s * 0.06, top: s * 0.48, height: b, backgroundColor: color }} />
</View>
);
+ // (0.8.4) LordOS's own components and the system services (Monitor → Network rows)
+ case 'printer':
+ return (
+ <View style={box}>
+ <View style={{ width: s * 0.56, height: s * 0.26, borderTopLeftRadius: 1, borderTopRightRadius: 1, border: `${b}px solid ${color}`, borderBottomWidth: 0 }} />
+ <View style={{ width: s * 0.92, height: s * 0.38, borderRadius: 2, backgroundColor: color }} />
+ <View style={{ width: s * 0.56, height: s * 0.24, border: `${b}px solid ${color}`, borderTopWidth: 0 }} />
+ </View>
+ );
+ case 'shield':
+ return (
+ <View style={box}>
+ <View style={{ width: s * 0.72, height: s * 0.86, borderTopLeftRadius: s * 0.12, borderTopRightRadius: s * 0.12, borderBottomLeftRadius: s * 0.36,
+ borderBottomRightRadius: s * 0.36, border: `${b}px solid ${color}`, alignItems: 'center', justifyContent: 'center' }}>
+ <View style={{ width: s * 0.3, height: b * 1.2, backgroundColor: color }} />
+ </View>
+ </View>
+ );
+ case 'tunnel':
+ return (
+ <View style={box}>
+ <View style={{ width: s * 0.86, height: s * 0.62, borderTopLeftRadius: s * 0.43, borderTopRightRadius: s * 0.43, border: `${b}px solid ${color}`, borderBottomWidth: 0,
+ alignItems: 'center', justifyContent: 'flex-end' }}>
+ <View style={{ width: s * 0.4, height: s * 0.36, borderTopLeftRadius: s * 0.2, borderTopRightRadius: s * 0.2, backgroundColor: color }} />
+ </View>
+ <View style={{ width: s, height: b, backgroundColor: color }} />
+ </View>
+ );
+ case 'dns':
+ return (
+ <View style={box}>
+ {[0, 1, 2].map((i) => (
+ <View key={i} style={{ width: s * 0.86, height: s * 0.24, marginTop: i ? s * 0.06 : 0, borderRadius: 1.5, border: `${b}px solid ${color}`, justifyContent: 'center' }}>
+ <View style={{ width: s * 0.1, height: s * 0.1, marginLeft: s * 0.08, borderRadius: s * 0.05, backgroundColor: color }} />
+ </View>
+ ))}
+ </View>
+ );
+ case 'clock':
+ return (
+ <View style={box}>
+ <View style={{ width: s * 0.92, height: s * 0.92, borderRadius: s * 0.46, border: `${b}px solid ${color}` }} />
+ <View style={{ position: 'absolute', left: s * 0.47, top: s * 0.2, width: b, height: s * 0.32, backgroundColor: color }} />
+ <View style={{ position: 'absolute', left: s * 0.47, top: s * 0.5, width: s * 0.24, height: b, backgroundColor: color }} />
+ </View>
+ );
default:
return <View style={box} />;
}
diff --git a/apps/monitor/index.jsx b/apps/monitor/index.jsx
index 6a6bcef..4009bc0 100644
--- a/apps/monitor/index.jsx
+++ b/apps/monitor/index.jsx
@@ -15,6 +15,7 @@ import { Glyph, MonitorIcon } from './icons.jsx';
import { NetworkTab } from './Network.jsx';
import { RemoteGlyph } from './RemoteDesktop.jsx';
import { MonitorPrivacy } from './Privacy.jsx';
+import { BlocklistsPrivacy } from './Blocklists.jsx';
import { FirewallPrivacy } from './Firewall.jsx';
import { FirewallRulesPrivacy } from './FwRules.jsx';
import { CoolingTab } from './Cooling.jsx';
@@ -32,6 +33,8 @@ if (typeof sdk.registerPrivacySection === 'function') sdk.registerPrivacySection
if (typeof sdk.registerPrivacySection === 'function') sdk.registerPrivacySection({ id: 'firewall', order: 11, Component: FirewallPrivacy });
// … and the rules of each app: domains, addresses and networks, with the app's default
if (typeof sdk.registerPrivacySection === 'function') sdk.registerPrivacySection({ id: 'fwrules', order: 12, Component: FirewallRulesPrivacy });
+// … and (0.8.4) the subscribed blocklists (docs/FIREWALL.md, "Blocklists")
+if (typeof sdk.registerPrivacySection === 'function') sdk.registerPrivacySection({ id: 'blocklists', order: 13, Component: BlocklistsPrivacy });
// ---- formats ----
export const fmt = {
@@ -327,8 +330,22 @@ export function Cell({ col, children, color, bold }) {
// as Mail or Passwords; the process is shown with the app's name and icon.
export const isolatedAppOf = (item) => (typeof item?.app === 'string' && item.app.startsWith('lpk:') ? getApp(item.app.slice(4)) : null);
+// (0.8.4) LordOS's own components: the built-in app's icon (Mail, Store, Terminal) or a glyph
+function ComponentGlyph({ comp, size }) {
+ const t = useTheme();
+ const a = comp.icon ? getApp(comp.icon) : null;
+ if (a?.Icon) return <a.Icon size={size} />;
+ return (
+ <View style={{ width: size, height: size, borderRadius: size * 0.24, backgroundColor: comp.system ? '#8e8e93' : t.accent, alignItems: 'center', justifyContent: 'center' }}>
+ <Glyph name={comp.glyph || 'network'} color="#fff" size={Math.round(size * 0.62)} />
+ </View>
+ );
+}
+
export function AppGlyph({ item, size = 16 }) {
if (item.app === 'lordos') return <LordOSLogo size={size} />;
+ const comp = sdk.netModel?.COMPONENTS?.[item.app];
+ if (comp) return <ComponentGlyph comp={comp} size={size} />;
if (item.app === 'remote-desktop') return <RemoteGlyph size={size} />;
const iso = isolatedAppOf(item);
if (iso?.Icon) return <iso.Icon size={size} />;
diff --git a/assets/locales/en/errors.json b/assets/locales/en/errors.json
index f6df753..91e640d 100644
--- a/assets/locales/en/errors.json
+++ b/assets/locales/en/errors.json
@@ -566,5 +566,11 @@
"hw.noKernelLog": "The kernel log could not be read",
"app.codeRefused": "This app's code was modified and was not loaded",
"remote.badAddress": "Not a valid address or network",
- "remote.listFull": "The list is full (64 entries)"
+ "remote.listFull": "The list is full (64 entries)",
+ "fw.list.unknown": "Unknown blocklist",
+ "fw.list.badUrl": "Not a valid https address",
+ "fw.list.badFormat": "Unknown list format",
+ "fw.list.tooMany": "There are already 16 lists of your own",
+ "fw.list.exists": "That list is already there",
+ "fw.list.unavailable": "Blocklists are not available in this session"
}
diff --git a/assets/locales/en/firewall.json b/assets/locales/en/firewall.json
index b1b3f62..a560bea 100644
--- a/assets/locales/en/firewall.json
+++ b/assets/locales/en/firewall.json
@@ -7,7 +7,7 @@
"dns.packet": "from the answers of the system DNS servers",
"dns.none": "no source (domain rules do not apply)",
"mode": "Mode",
- "mode.silent": "Silent",
+ "mode.silent": "Allow silently",
"mode.off": "Off",
"mode.silentHint": "Everything without a rule is allowed and each new connection is recorded in Monitor.",
"mode.offHint": "Only explicit deny rules and restricted apps apply.",
@@ -55,5 +55,52 @@
"help.no-bluetooth": "no Bluetooth sockets of its own.",
"help.no-files": "only its own settings folders and the file you open it with.",
"help.no-notifications": "its notifications aren't shown.",
- "help.no-clipboard": "it can't read what you copied (LordOS apps)."
+ "help.no-clipboard": "it can't read what you copied (LordOS apps).",
+ "mode.deny": "Deny silently",
+ "mode.denyHint": "Only what a rule allows can connect, and every denied connection is recorded in Monitor. This computer's own services (loopback) stay allowed.",
+ "lists.title": "Blocklists",
+ "lists.update": "Update Now",
+ "lists.working": "Working…",
+ "lists.summary": "{lists} lists on, {entries} entries. LordOS downloads the lists you turn on once a day.",
+ "lists.topic.ads": "Advertising",
+ "lists.topic.trackers": "Trackers",
+ "lists.topic.malware": "Malware and attacks",
+ "lists.topic.custom": "Your own lists",
+ "lists.source": "{source} · licence: {license}",
+ "lists.updated": "{count} entries · updated {when}",
+ "lists.pending": "Downloading…",
+ "lists.about": "About {count} entries",
+ "lists.failed": "Not updated: {error}",
+ "lists.truncated": "only the first entries fit",
+ "lists.format.hosts": "Hosts file",
+ "lists.format.domains": "Domains",
+ "lists.format.ips": "Addresses",
+ "lists.urlPlaceholder": "https://example.org/list.txt",
+ "lists.add": "Add List",
+ "lists.customHint": "A list you add is downloaded over HTTPS, checked line by line and used like the others. Only https addresses are accepted.",
+ "lists.footer": "A list never overrides a rule you wrote for a domain or an address: allow it in Monitor → Network and it stays allowed. Names come from the system resolver: an app with its own encrypted DNS is checked by address only. An address that a listed name shares with a name that isn't listed stays allowed.",
+ "lists.err.tls": "secure connection failed",
+ "lists.err.cert": "the server's certificate is not valid",
+ "lists.err.dns": "server not found",
+ "lists.err.connect": "could not connect",
+ "lists.err.status": "the server refused it",
+ "lists.err.big": "the list is too large",
+ "lists.err.format": "not in the expected format",
+ "lists.err.empty": "the list is empty",
+ "lists.err.nul": "not a text list",
+ "lists.err.line": "a line is too long",
+ "lists.err.helper": "the downloader stopped",
+ "lists.err.redirect": "too many redirects",
+ "lists.err.invalid": "invalid content",
+ "lists.err.badUrl": "invalid address",
+ "lists.err.write": "could not be saved",
+ "lists.err.http": "the server's answer was not valid",
+ "lists.name.ads": "Advertising (domains)",
+ "lists.name.tracking": "Trackers and analytics",
+ "lists.name.unified-hosts": "Advertising and malware (unified hosts)",
+ "lists.name.phishing": "Phishing sites",
+ "lists.name.scam": "Scam sites",
+ "lists.name.ransomware": "Ransomware",
+ "lists.name.cryptomining": "Hidden crypto mining",
+ "lists.name.attackers": "Attacking addresses"
}
diff --git a/assets/locales/en/monitor.json b/assets/locales/en/monitor.json
index d0e3c8a..10d692f 100644
--- a/assets/locales/en/monitor.json
+++ b/assets/locales/en/monitor.json
@@ -296,5 +296,114 @@
"net.remoteNoFailures": "No failed sign-ins in the last 24 hours.",
"net.remoteAdminOnly": "Only administrators see failed sign-ins and can block addresses.",
"net.remoteLists": "Address lists",
- "net.remoteBlockedTotal": "Blocked in all"
+ "net.remoteBlockedTotal": "Blocked in all",
+ "net.searchTokens": "Search: app:, domain:, ip:, port:, proto:, country:",
+ "net.clearChips": "Clear",
+ "net.chip.app": "App",
+ "net.chip.domain": "Domain",
+ "net.chip.ip": "IP",
+ "net.chip.port": "Port",
+ "net.chip.proto": "Protocol",
+ "net.chip.country": "Country",
+ "net.view.button": "{group}",
+ "net.view.group": "Group by",
+ "net.view.dir": "Direction",
+ "net.view.proto": "Protocol",
+ "net.view.status": "Status",
+ "net.view.sort": "Sort by",
+ "net.view.group.app": "Apps",
+ "net.view.group.domain": "Domains",
+ "net.view.group.ip": "Addresses",
+ "net.view.group.port": "Ports",
+ "net.view.group.country": "Countries",
+ "net.view.dir.all": "All directions",
+ "net.view.dir.out": "Outgoing",
+ "net.view.dir.in": "Incoming",
+ "net.view.proto.all": "All protocols",
+ "net.view.proto.tcp": "TCP",
+ "net.view.proto.udp": "UDP and QUIC",
+ "net.view.status.all": "Everything",
+ "net.view.status.allowed": "Allowed",
+ "net.view.status.denied": "Denied",
+ "net.view.status.rules": "With rules",
+ "net.view.sort.name": "Name",
+ "net.view.sort.most": "Most traffic",
+ "net.view.sort.least": "Least traffic",
+ "net.view.sort.recent": "Most recent",
+ "net.view.sort.conns": "Most connections",
+ "net.view.menuItem": "Show network activity in the menu bar",
+ "net.view.blocklists": "Blocklists…",
+ "net.count.app": {
+ "one": "{count} app",
+ "other": "{count} apps"
+ },
+ "net.count.domain": {
+ "one": "{count} destination",
+ "other": "{count} destinations"
+ },
+ "net.count.ip": {
+ "one": "{count} address",
+ "other": "{count} addresses"
+ },
+ "net.count.port": {
+ "one": "{count} port",
+ "other": "{count} ports"
+ },
+ "net.count.country": {
+ "one": "{count} place",
+ "other": "{count} places"
+ },
+ "net.onList": "On the list {list}",
+ "net.blockedByList": "Blocked by the list {list}",
+ "net.deniedByMode": "Denied: no rule allows it",
+ "net.system": "System",
+ "net.systemService": "Essential system service: shown, never blocked",
+ "net.noDestinations": "No destinations yet",
+ "net.noMatch": "Nothing matches the search and the filters",
+ "net.recentlyDenied": "Recently denied",
+ "net.noneDenied": "Nothing denied in the last ten minutes",
+ "net.by.rule": "by a rule",
+ "net.by.list": "by a blocklist",
+ "net.by.restricted": "by a restriction",
+ "net.by.mode": "no rule allows it",
+ "net.blocklists": "Blocklists",
+ "net.listsOn": "Lists on",
+ "net.listsEntries": "Entries",
+ "net.listsManage": "Manage blocklists…",
+ "net.programs": "Programs",
+ "net.dnsServers": "Servers",
+ "net.rangeNote": "Traffic of each app in the {range} window. The history keeps only how much each app moved, never where.",
+ "comp.mail": "Mail and calendars",
+ "comp.mailHint": "Mail, Calendar, Contacts and Reminders: their servers, from their own process and scope.",
+ "comp.store": "Store and updates",
+ "comp.storeHint": "The package engine: catalogs, apps and system updates.",
+ "comp.storeWarn": "While the Store and updates are blocked, LordOS gets no security updates and no app can be installed.",
+ "comp.print": "Printers and scanners",
+ "comp.printHint": "Network printers and scanners, and their discovery on the local network.",
+ "comp.terminal": "Terminal",
+ "comp.terminalHint": "Every program started in the Terminal, with its own name in the list.",
+ "comp.lists": "Blocklist updates",
+ "comp.listsHint": "The daily download of the blocklists you turned on.",
+ "comp.vpn": "VPN",
+ "comp.vpnHint": "The traffic of your VPN tunnels. Manage them in Settings → Network.",
+ "comp.dns": "Name resolution (DNS)",
+ "comp.dnsHint": "The system resolver, which turns names into addresses for every app.",
+ "comp.time": "Time synchronization",
+ "comp.timeHint": "Keeps the clock right with time servers.",
+ "comp.network": "Network service",
+ "comp.networkHint": "Addresses from the network (DHCP), Wi-Fi and VPN connections.",
+ "comp.blockTitle": "Block {app}?",
+ "comp.blockAnyway": "Block",
+ "comp.keep": "Keep allowed",
+ "privacy.menuItem": "Network activity in the menu bar",
+ "privacy.menuItemHint": "Upload and download rates in the menu bar, with recent activity and quick controls.",
+ "status.title": "Network",
+ "status.lastMinutes": "Last five minutes: ↓ {down} · ↑ {up}",
+ "status.activity": "Activity now",
+ "status.quiet": "No app is moving data",
+ "status.denied": "Recently denied",
+ "status.mode": "Firewall",
+ "status.lists": "Blocklists",
+ "status.listsValue": "{lists} on · {entries} entries",
+ "status.open": "Open Monitor…"
}
diff --git a/assets/locales/es/errors.json b/assets/locales/es/errors.json
index dbe9f7e..9a92746 100644
--- a/assets/locales/es/errors.json
+++ b/assets/locales/es/errors.json
@@ -566,5 +566,11 @@
"hw.noKernelLog": "No se pudo leer el registro del kernel",
"app.codeRefused": "El código de esta app fue modificado y no se cargó",
"remote.badAddress": "No es una dirección o red válida",
- "remote.listFull": "La lista está llena (64 entradas)"
+ "remote.listFull": "La lista está llena (64 entradas)",
+ "fw.list.unknown": "Lista de bloqueo desconocida",
+ "fw.list.badUrl": "No es una dirección https válida",
+ "fw.list.badFormat": "Formato de lista desconocido",
+ "fw.list.tooMany": "Ya hay 16 listas propias",
+ "fw.list.exists": "Esa lista ya está",
+ "fw.list.unavailable": "Las listas de bloqueo no están disponibles en esta sesión"
}
diff --git a/assets/locales/es/firewall.json b/assets/locales/es/firewall.json
index f480a94..42560d9 100644
--- a/assets/locales/es/firewall.json
+++ b/assets/locales/es/firewall.json
@@ -7,7 +7,7 @@
"dns.packet": "de las respuestas de los servidores DNS del sistema",
"dns.none": "sin fuente (las reglas de dominio no aplican)",
"mode": "Modo",
- "mode.silent": "Silencioso",
+ "mode.silent": "Permitir en silencio",
"mode.off": "Apagado",
"mode.silentHint": "Se permite todo lo que no tenga una regla y cada conexión nueva queda anotada en el Monitor.",
"mode.offHint": "Solo valen las denegaciones explícitas y las apps restringidas.",
@@ -55,5 +55,52 @@
"help.no-bluetooth": "sin sockets Bluetooth propios.",
"help.no-files": "solo sus propias carpetas de ajustes y el archivo con el que la abrís.",
"help.no-notifications": "sus notificaciones no se muestran.",
- "help.no-clipboard": "no puede leer lo que copiaste (apps de LordOS)."
+ "help.no-clipboard": "no puede leer lo que copiaste (apps de LordOS).",
+ "mode.deny": "Denegar en silencio",
+ "mode.denyHint": "Solo puede conectarse lo que una regla permite, y cada conexión denegada queda anotada en el Monitor. Los servicios propios de este equipo (loopback) siguen permitidos.",
+ "lists.title": "Listas de bloqueo",
+ "lists.update": "Actualizar ahora",
+ "lists.working": "Trabajando…",
+ "lists.summary": "{lists} listas activas, {entries} entradas. LordOS descarga las listas que actives una vez por día.",
+ "lists.topic.ads": "Publicidad",
+ "lists.topic.trackers": "Rastreadores",
+ "lists.topic.malware": "Malware y ataques",
+ "lists.topic.custom": "Tus propias listas",
+ "lists.source": "{source} · licencia: {license}",
+ "lists.updated": "{count} entradas · actualizada {when}",
+ "lists.pending": "Descargando…",
+ "lists.about": "Unas {count} entradas",
+ "lists.failed": "Sin actualizar: {error}",
+ "lists.truncated": "solo entraron las primeras entradas",
+ "lists.format.hosts": "Archivo hosts",
+ "lists.format.domains": "Dominios",
+ "lists.format.ips": "Direcciones",
+ "lists.urlPlaceholder": "https://example.org/lista.txt",
+ "lists.add": "Agregar lista",
+ "lists.customHint": "Una lista que agregues se descarga por HTTPS, se revisa línea por línea y se usa como las demás. Solo se aceptan direcciones https.",
+ "lists.footer": "Una lista nunca pasa por encima de una regla que escribiste para un dominio o una dirección: permitilo en Monitor → Red y queda permitido. Los nombres salen del resolvedor del sistema: una app con su propio DNS cifrado se revisa solo por dirección. Una dirección que un nombre de la lista comparte con un nombre que no está en ella sigue permitida.",
+ "lists.err.tls": "falló la conexión segura",
+ "lists.err.cert": "el certificado del servidor no es válido",
+ "lists.err.dns": "no se encontró el servidor",
+ "lists.err.connect": "no se pudo conectar",
+ "lists.err.status": "el servidor la rechazó",
+ "lists.err.big": "la lista es demasiado grande",
+ "lists.err.format": "no tiene el formato esperado",
+ "lists.err.empty": "la lista está vacía",
+ "lists.err.nul": "no es una lista de texto",
+ "lists.err.line": "una línea es demasiado larga",
+ "lists.err.helper": "el descargador se detuvo",
+ "lists.err.redirect": "demasiadas redirecciones",
+ "lists.err.invalid": "contenido no válido",
+ "lists.err.badUrl": "dirección no válida",
+ "lists.err.write": "no se pudo guardar",
+ "lists.err.http": "la respuesta del servidor no era válida",
+ "lists.name.ads": "Publicidad (dominios)",
+ "lists.name.tracking": "Rastreadores y analítica",
+ "lists.name.unified-hosts": "Publicidad y malware (hosts unificado)",
+ "lists.name.phishing": "Sitios de phishing",
+ "lists.name.scam": "Sitios de estafa",
+ "lists.name.ransomware": "Ransomware",
+ "lists.name.cryptomining": "Minería de criptomonedas oculta",
+ "lists.name.attackers": "Direcciones atacantes"
}
diff --git a/assets/locales/es/monitor.json b/assets/locales/es/monitor.json
index 4212db9..942d1a1 100644
--- a/assets/locales/es/monitor.json
+++ b/assets/locales/es/monitor.json
@@ -296,5 +296,114 @@
"net.remoteNoFailures": "No hubo ingresos fallidos en las últimas 24 horas.",
"net.remoteAdminOnly": "Solo los administradores ven los ingresos fallidos y pueden bloquear direcciones.",
"net.remoteLists": "Listas de direcciones",
- "net.remoteBlockedTotal": "Bloqueadas en total"
+ "net.remoteBlockedTotal": "Bloqueadas en total",
+ "net.searchTokens": "Buscar: app:, domain:, ip:, port:, proto:, country:",
+ "net.clearChips": "Borrar",
+ "net.chip.app": "App",
+ "net.chip.domain": "Dominio",
+ "net.chip.ip": "IP",
+ "net.chip.port": "Puerto",
+ "net.chip.proto": "Protocolo",
+ "net.chip.country": "País",
+ "net.view.button": "{group}",
+ "net.view.group": "Agrupar por",
+ "net.view.dir": "Dirección",
+ "net.view.proto": "Protocolo",
+ "net.view.status": "Estado",
+ "net.view.sort": "Ordenar por",
+ "net.view.group.app": "Apps",
+ "net.view.group.domain": "Dominios",
+ "net.view.group.ip": "Direcciones",
+ "net.view.group.port": "Puertos",
+ "net.view.group.country": "Países",
+ "net.view.dir.all": "Todas las direcciones",
+ "net.view.dir.out": "Salientes",
+ "net.view.dir.in": "Entrantes",
+ "net.view.proto.all": "Todos los protocolos",
+ "net.view.proto.tcp": "TCP",
+ "net.view.proto.udp": "UDP y QUIC",
+ "net.view.status.all": "Todo",
+ "net.view.status.allowed": "Permitidas",
+ "net.view.status.denied": "Denegadas",
+ "net.view.status.rules": "Con reglas",
+ "net.view.sort.name": "Nombre",
+ "net.view.sort.most": "Más tráfico",
+ "net.view.sort.least": "Menos tráfico",
+ "net.view.sort.recent": "Más recientes",
+ "net.view.sort.conns": "Más conexiones",
+ "net.view.menuItem": "Mostrar la actividad de red en la barra de menús",
+ "net.view.blocklists": "Listas de bloqueo…",
+ "net.count.app": {
+ "one": "{count} app",
+ "other": "{count} apps"
+ },
+ "net.count.domain": {
+ "one": "{count} destino",
+ "other": "{count} destinos"
+ },
+ "net.count.ip": {
+ "one": "{count} dirección",
+ "other": "{count} direcciones"
+ },
+ "net.count.port": {
+ "one": "{count} puerto",
+ "other": "{count} puertos"
+ },
+ "net.count.country": {
+ "one": "{count} lugar",
+ "other": "{count} lugares"
+ },
+ "net.onList": "En la lista {list}",
+ "net.blockedByList": "Bloqueado por la lista {list}",
+ "net.deniedByMode": "Denegado: ninguna regla lo permite",
+ "net.system": "Sistema",
+ "net.systemService": "Servicio esencial del sistema: se muestra, nunca se bloquea",
+ "net.noDestinations": "Todavía sin destinos",
+ "net.noMatch": "Nada coincide con la búsqueda y los filtros",
+ "net.recentlyDenied": "Denegado hace poco",
+ "net.noneDenied": "Nada denegado en los últimos diez minutos",
+ "net.by.rule": "por una regla",
+ "net.by.list": "por una lista de bloqueo",
+ "net.by.restricted": "por una restricción",
+ "net.by.mode": "ninguna regla lo permite",
+ "net.blocklists": "Listas de bloqueo",
+ "net.listsOn": "Listas activas",
+ "net.listsEntries": "Entradas",
+ "net.listsManage": "Administrar listas de bloqueo…",
+ "net.programs": "Programas",
+ "net.dnsServers": "Servidores",
+ "net.rangeNote": "Tráfico de cada app en la ventana de {range}. El historial solo guarda cuánto movió cada app, nunca adónde.",
+ "comp.mail": "Correo y calendarios",
+ "comp.mailHint": "Correo, Calendario, Contactos y Recordatorios: sus servidores, desde su propio proceso y su propio scope.",
+ "comp.store": "Tienda y actualizaciones",
+ "comp.storeHint": "El motor de paquetes: catálogos, apps y actualizaciones del sistema.",
+ "comp.storeWarn": "Mientras la Tienda y las actualizaciones estén bloqueadas, LordOS no recibe actualizaciones de seguridad y no se puede instalar ninguna app.",
+ "comp.print": "Impresoras y escáneres",
+ "comp.printHint": "Impresoras y escáneres de red, y su búsqueda en la red local.",
+ "comp.terminal": "Terminal",
+ "comp.terminalHint": "Cada programa abierto en la Terminal, con su propio nombre en la lista.",
+ "comp.lists": "Actualización de listas de bloqueo",
+ "comp.listsHint": "La descarga diaria de las listas de bloqueo que activaste.",
+ "comp.vpn": "VPN",
+ "comp.vpnHint": "El tráfico de tus túneles VPN. Se administran en Ajustes → Red.",
+ "comp.dns": "Resolución de nombres (DNS)",
+ "comp.dnsHint": "El resolvedor del sistema, que convierte nombres en direcciones para todas las apps.",
+ "comp.time": "Sincronización de la hora",
+ "comp.timeHint": "Mantiene el reloj en hora con servidores de tiempo.",
+ "comp.network": "Servicio de red",
+ "comp.networkHint": "Direcciones de la red (DHCP), Wi‑Fi y conexiones VPN.",
+ "comp.blockTitle": "¿Bloquear {app}?",
+ "comp.blockAnyway": "Bloquear",
+ "comp.keep": "Mantener permitido",
+ "privacy.menuItem": "Actividad de red en la barra de menús",
+ "privacy.menuItemHint": "Velocidad de subida y bajada en la barra de menús, con la actividad reciente y controles rápidos.",
+ "status.title": "Red",
+ "status.lastMinutes": "Últimos cinco minutos: ↓ {down} · ↑ {up}",
+ "status.activity": "Actividad ahora",
+ "status.quiet": "Ninguna app está moviendo datos",
+ "status.denied": "Denegado hace poco",
+ "status.mode": "Cortafuegos",
+ "status.lists": "Listas de bloqueo",
+ "status.listsValue": "{lists} activas · {entries} entradas",
+ "status.open": "Abrir el Monitor…"
}
diff --git a/assets/locales/pt/errors.json b/assets/locales/pt/errors.json
index 4c53558..3f55d3e 100644
--- a/assets/locales/pt/errors.json
+++ b/assets/locales/pt/errors.json
@@ -566,5 +566,11 @@
"hw.noKernelLog": "Não foi possível ler o registro do kernel",
"app.codeRefused": "O código deste app foi modificado e não foi carregado",
"remote.badAddress": "Não é um endereço ou rede válida",
- "remote.listFull": "A lista está cheia (64 entradas)"
+ "remote.listFull": "A lista está cheia (64 entradas)",
+ "fw.list.unknown": "Lista de bloqueio desconhecida",
+ "fw.list.badUrl": "Não é um endereço https válido",
+ "fw.list.badFormat": "Formato de lista desconhecido",
+ "fw.list.tooMany": "Já existem 16 listas suas",
+ "fw.list.exists": "Essa lista já está aí",
+ "fw.list.unavailable": "As listas de bloqueio não estão disponíveis nesta sessão"
}
diff --git a/assets/locales/pt/firewall.json b/assets/locales/pt/firewall.json
index 0bd3430..d4ce78b 100644
--- a/assets/locales/pt/firewall.json
+++ b/assets/locales/pt/firewall.json
@@ -7,7 +7,7 @@
"dns.packet": "das respostas dos servidores DNS do sistema",
"dns.none": "sem fonte (as regras de domínio não valem)",
"mode": "Modo",
- "mode.silent": "Silencioso",
+ "mode.silent": "Permitir em silêncio",
"mode.off": "Desligado",
"mode.silentHint": "Tudo o que não tem regra é permitido e cada conexão nova fica anotada no Monitor.",
"mode.offHint": "Só valem as negações explícitas e os apps restritos.",
@@ -55,5 +55,52 @@
"help.no-bluetooth": "sem sockets Bluetooth próprios.",
"help.no-files": "só as próprias pastas de configuração e o arquivo com que você o abre.",
"help.no-notifications": "as notificações dele não aparecem.",
- "help.no-clipboard": "não pode ler o que você copiou (apps do LordOS)."
+ "help.no-clipboard": "não pode ler o que você copiou (apps do LordOS).",
+ "mode.deny": "Negar em silêncio",
+ "mode.denyHint": "Só pode se conectar o que uma regra permite, e cada conexão negada fica anotada no Monitor. Os serviços deste computador (loopback) continuam permitidos.",
+ "lists.title": "Listas de bloqueio",
+ "lists.update": "Atualizar agora",
+ "lists.working": "Trabalhando…",
+ "lists.summary": "{lists} listas ativas, {entries} entradas. O LordOS baixa as listas que você ativar uma vez por dia.",
+ "lists.topic.ads": "Publicidade",
+ "lists.topic.trackers": "Rastreadores",
+ "lists.topic.malware": "Malware e ataques",
+ "lists.topic.custom": "Suas próprias listas",
+ "lists.source": "{source} · licença: {license}",
+ "lists.updated": "{count} entradas · atualizada {when}",
+ "lists.pending": "Baixando…",
+ "lists.about": "Cerca de {count} entradas",
+ "lists.failed": "Sem atualizar: {error}",
+ "lists.truncated": "só couberam as primeiras entradas",
+ "lists.format.hosts": "Arquivo hosts",
+ "lists.format.domains": "Domínios",
+ "lists.format.ips": "Endereços",
+ "lists.urlPlaceholder": "https://example.org/lista.txt",
+ "lists.add": "Adicionar lista",
+ "lists.customHint": "Uma lista que você adicionar é baixada por HTTPS, conferida linha por linha e usada como as outras. Só endereços https são aceitos.",
+ "lists.footer": "Uma lista nunca passa por cima de uma regra que você escreveu para um domínio ou um endereço: permita-o em Monitor → Rede e ele continua permitido. Os nomes vêm do resolvedor do sistema: um app com o seu próprio DNS criptografado é conferido só pelo endereço. Um endereço que um nome da lista compartilha com um nome que não está nela continua permitido.",
+ "lists.err.tls": "a conexão segura falhou",
+ "lists.err.cert": "o certificado do servidor não é válido",
+ "lists.err.dns": "servidor não encontrado",
+ "lists.err.connect": "não foi possível conectar",
+ "lists.err.status": "o servidor a recusou",
+ "lists.err.big": "a lista é grande demais",
+ "lists.err.format": "não tem o formato esperado",
+ "lists.err.empty": "a lista está vazia",
+ "lists.err.nul": "não é uma lista de texto",
+ "lists.err.line": "uma linha é longa demais",
+ "lists.err.helper": "o baixador parou",
+ "lists.err.redirect": "redirecionamentos demais",
+ "lists.err.invalid": "conteúdo inválido",
+ "lists.err.badUrl": "endereço inválido",
+ "lists.err.write": "não foi possível salvar",
+ "lists.err.http": "a resposta do servidor não era válida",
+ "lists.name.ads": "Publicidade (domínios)",
+ "lists.name.tracking": "Rastreadores e análise",
+ "lists.name.unified-hosts": "Publicidade e malware (hosts unificado)",
+ "lists.name.phishing": "Sites de phishing",
+ "lists.name.scam": "Sites de golpe",
+ "lists.name.ransomware": "Ransomware",
+ "lists.name.cryptomining": "Mineração de criptomoedas oculta",
+ "lists.name.attackers": "Endereços atacantes"
}
diff --git a/assets/locales/pt/monitor.json b/assets/locales/pt/monitor.json
index c22ffc4..36d0518 100644
--- a/assets/locales/pt/monitor.json
+++ b/assets/locales/pt/monitor.json
@@ -296,5 +296,114 @@
"net.remoteNoFailures": "Nenhuma entrada com erro nas últimas 24 horas.",
"net.remoteAdminOnly": "Só administradores veem as entradas com erro e podem bloquear endereços.",
"net.remoteLists": "Listas de endereços",
- "net.remoteBlockedTotal": "Bloqueados no total"
+ "net.remoteBlockedTotal": "Bloqueados no total",
+ "net.searchTokens": "Buscar: app:, domain:, ip:, port:, proto:, country:",
+ "net.clearChips": "Limpar",
+ "net.chip.app": "App",
+ "net.chip.domain": "Domínio",
+ "net.chip.ip": "IP",
+ "net.chip.port": "Porta",
+ "net.chip.proto": "Protocolo",
+ "net.chip.country": "País",
+ "net.view.button": "{group}",
+ "net.view.group": "Agrupar por",
+ "net.view.dir": "Direção",
+ "net.view.proto": "Protocolo",
+ "net.view.status": "Estado",
+ "net.view.sort": "Ordenar por",
+ "net.view.group.app": "Apps",
+ "net.view.group.domain": "Domínios",
+ "net.view.group.ip": "Endereços",
+ "net.view.group.port": "Portas",
+ "net.view.group.country": "Países",
+ "net.view.dir.all": "Todas as direções",
+ "net.view.dir.out": "De saída",
+ "net.view.dir.in": "De entrada",
+ "net.view.proto.all": "Todos os protocolos",
+ "net.view.proto.tcp": "TCP",
+ "net.view.proto.udp": "UDP e QUIC",
+ "net.view.status.all": "Tudo",
+ "net.view.status.allowed": "Permitidas",
+ "net.view.status.denied": "Negadas",
+ "net.view.status.rules": "Com regras",
+ "net.view.sort.name": "Nome",
+ "net.view.sort.most": "Mais tráfego",
+ "net.view.sort.least": "Menos tráfego",
+ "net.view.sort.recent": "Mais recentes",
+ "net.view.sort.conns": "Mais conexões",
+ "net.view.menuItem": "Mostrar a atividade de rede na barra de menus",
+ "net.view.blocklists": "Listas de bloqueio…",
+ "net.count.app": {
+ "one": "{count} app",
+ "other": "{count} apps"
+ },
+ "net.count.domain": {
+ "one": "{count} destino",
+ "other": "{count} destinos"
+ },
+ "net.count.ip": {
+ "one": "{count} endereço",
+ "other": "{count} endereços"
+ },
+ "net.count.port": {
+ "one": "{count} porta",
+ "other": "{count} portas"
+ },
+ "net.count.country": {
+ "one": "{count} lugar",
+ "other": "{count} lugares"
+ },
+ "net.onList": "Na lista {list}",
+ "net.blockedByList": "Bloqueado pela lista {list}",
+ "net.deniedByMode": "Negado: nenhuma regra o permite",
+ "net.system": "Sistema",
+ "net.systemService": "Serviço essencial do sistema: aparece, nunca é bloqueado",
+ "net.noDestinations": "Ainda sem destinos",
+ "net.noMatch": "Nada corresponde à busca e aos filtros",
+ "net.recentlyDenied": "Negado há pouco",
+ "net.noneDenied": "Nada negado nos últimos dez minutos",
+ "net.by.rule": "por uma regra",
+ "net.by.list": "por uma lista de bloqueio",
+ "net.by.restricted": "por uma restrição",
+ "net.by.mode": "nenhuma regra o permite",
+ "net.blocklists": "Listas de bloqueio",
+ "net.listsOn": "Listas ativas",
+ "net.listsEntries": "Entradas",
+ "net.listsManage": "Gerenciar listas de bloqueio…",
+ "net.programs": "Programas",
+ "net.dnsServers": "Servidores",
+ "net.rangeNote": "Tráfego de cada app na janela de {range}. O histórico guarda só quanto cada app transferiu, nunca para onde.",
+ "comp.mail": "E-mail e calendários",
+ "comp.mailHint": "E-mail, Calendário, Contatos e Lembretes: os seus servidores, a partir do seu próprio processo e scope.",
+ "comp.store": "Loja e atualizações",
+ "comp.storeHint": "O motor de pacotes: catálogos, apps e atualizações do sistema.",
+ "comp.storeWarn": "Enquanto a Loja e as atualizações estiverem bloqueadas, o LordOS não recebe atualizações de segurança e nenhum app pode ser instalado.",
+ "comp.print": "Impressoras e scanners",
+ "comp.printHint": "Impressoras e scanners de rede, e a sua descoberta na rede local.",
+ "comp.terminal": "Terminal",
+ "comp.terminalHint": "Cada programa aberto no Terminal, com o seu próprio nome na lista.",
+ "comp.lists": "Atualização das listas de bloqueio",
+ "comp.listsHint": "O download diário das listas de bloqueio que você ativou.",
+ "comp.vpn": "VPN",
+ "comp.vpnHint": "O tráfego dos seus túneis VPN. São gerenciados em Ajustes → Rede.",
+ "comp.dns": "Resolução de nomes (DNS)",
+ "comp.dnsHint": "O resolvedor do sistema, que converte nomes em endereços para todos os apps.",
+ "comp.time": "Sincronização da hora",
+ "comp.timeHint": "Mantém o relógio certo com servidores de hora.",
+ "comp.network": "Serviço de rede",
+ "comp.networkHint": "Endereços da rede (DHCP), Wi‑Fi e conexões VPN.",
+ "comp.blockTitle": "Bloquear {app}?",
+ "comp.blockAnyway": "Bloquear",
+ "comp.keep": "Manter permitido",
+ "privacy.menuItem": "Atividade de rede na barra de menus",
+ "privacy.menuItemHint": "Velocidade de envio e recebimento na barra de menus, com a atividade recente e controles rápidos.",
+ "status.title": "Rede",
+ "status.lastMinutes": "Últimos cinco minutos: ↓ {down} · ↑ {up}",
+ "status.activity": "Atividade agora",
+ "status.quiet": "Nenhum app está transferindo dados",
+ "status.denied": "Negado há pouco",
+ "status.mode": "Firewall",
+ "status.lists": "Listas de bloqueio",
+ "status.listsValue": "{lists} ativas · {entries} entradas",
+ "status.open": "Abrir o Monitor…"
}
diff --git a/sdk/index.js b/sdk/index.js
index caa4380..ce4b370 100644
--- a/sdk/index.js
+++ b/sdk/index.js
@@ -38,6 +38,7 @@ import { EmojiPanel } from './emoji.jsx';
export { admin } from './admin.js';
export { videoPrefs, setVideoPrefs, videoHardware, videoError, videoOptimizing, VIDEO_MODES, VIDEO_DEFAULTS } from './video.js'; // docs/VIDEO.md
import { startVideo } from './video.js';
+import { startNetStatus } from './netstatus.jsx';
export { errorText, statusText, codeError, parseCode } from './errors.js';
export { logs } from './logs.js';
export { LordOSLogo, LordOSGlyph, LordOSWordmark } from './logo.js';
@@ -194,6 +195,7 @@ export function startShell(element) {
startHardware(); // Night Light, idle timers, battery in the menu bar (hardware.jsx)
startDiskWatch(); // notices when a disk gets too hot or its health gets worse
startVideo(); // browser video without hardware decoding (video.js, docs/VIDEO.md)
+ startNetStatus(); // (0.8.4) the menu bar's network item and the blocklists' daily update
setTimeout(reportRefusedCode, 800); // "This LordOS component was modified and was not loaded" (docs/SIGNING.md)
}
diff --git a/sdk/monitor.js b/sdk/monitor.js
index 7c388f6..3a2552c 100644
--- a/sdk/monitor.js
+++ b/sdk/monitor.js
@@ -158,7 +158,8 @@ function fwPoll(force) {
try {
const p = api.poll();
const status = api.status();
- firewallState.set((s) => ({ ...s, status, counts: p.counts || {}, events: p.events.length ? [...s.events, ...p.events].slice(-200) : s.events }));
+ const at = Date.now();
+ firewallState.set((s) => ({ ...s, status, counts: p.counts || {}, events: p.events.length ? [...s.events, ...p.events.map((e) => ({ ...e, at }))].slice(-200) : s.events }));
} catch (e) { /* no lord.fw */ }
}
const fwBump = (r) => { firewallState.set((s) => ({ ...s, rev: s.rev + 1 })); fwPoll(true); return r; };
diff --git a/sdk/netstatus.jsx b/sdk/netstatus.jsx
new file mode 100644
index 0000000..a63580e
--- /dev/null
+++ b/sdk/netstatus.jsx
@@ -0,0 +1,223 @@
+// netstatus.jsx — the network item of the menu bar and the blocklists' daily update (0.8.4,
+// docs/MONITOR.md "The menu bar network item", docs/FIREWALL.md "Blocklists").
+//
+// The item is optional and off by default (settings.monitor.menuItem; Settings → Privacy → Monitor
+// or the Monitor's view menu). While it is shown, once per second: the machine's byte counters
+// (lord.monitor.netTotals(), one small file read) and lord-netperm's notices (firewall.refresh()).
+// Hidden, it costs nothing. Its panel shows the sent/received graph of the last five minutes, the
+// apps moving bytes now, what was denied in the last ten minutes, the firewall mode, the
+// blocklists and a link to the Monitor.
+//
+// startNetStatus() (startShell) also asks lord-server, once an hour, to download the enabled
+// blocklists that are a day old (lord.fw.updateLists; lord-server does nothing when they are fresh).
+import { useEffect, useRef, useState } from 'react';
+import { View, Text, addListener } from '@lordos/runtime';
+import { createStore, useStore } from './store.js';
+import { settings } from './settings.js';
+import { useTheme, popupBg } from './theme.js';
+import { t, formatNumber } from './i18n.js';
+import { formatBytes } from './system.js';
+import { registerStatusItem } from './statusitems.js';
+import { Overlay } from './layers.js';
+import { Segmented } from './components.jsx';
+import { firewall, firewallState } from './monitor.js';
+import { wm } from './windows.js';
+import { useLauncherApps } from './apps.js';
+import { COMPONENTS } from './netmodel.js';
+
+const SAMPLES = 300; // one per second: the last five minutes
+export const netStatus = createStore({ rx: 0, tx: 0, hist: [] }); // hist: [[rxRate, txRate], …]
+let timer = null, prev = null;
+
+const shown = () => settings.get()?.monitor?.menuItem === true;
+
+function tick() {
+ let s = null;
+ try { s = typeof lord !== 'undefined' && lord.monitor?.netTotals ? lord.monitor.netTotals() : null; } catch (e) { s = null; }
+ if (s && prev) {
+ const dt = Math.max(0.2, (s.t - prev.t) / 1000);
+ const rx = Math.max(0, (s.rx - prev.rx) / dt), tx = Math.max(0, (s.tx - prev.tx) / dt);
+ netStatus.set((o) => ({ rx, tx, hist: [...o.hist.slice(o.hist.length >= SAMPLES ? 1 : 0), [rx, tx]] }));
+ }
+ if (s) prev = s;
+ firewall.refresh();
+}
+
+function sync() {
+ const on = shown();
+ if (on && !timer) { prev = null; tick(); timer = setInterval(tick, 1000); }
+ else if (!on && timer) { clearInterval(timer); timer = null; prev = null; netStatus.set({ rx: 0, tx: 0, hist: [] }); }
+}
+
+const rate = (n) => t('monitor.rate', { v: formatBytes(Math.max(0, n || 0)) });
+
+// a compact rate for the bar: "1.2M", "340K", "12"
+function short(n) {
+ const v = Math.max(0, n || 0);
+ if (v >= 1e9) return `${(v / 1e9).toFixed(1)}G`;
+ if (v >= 1e6) return `${(v / 1e6).toFixed(v >= 1e7 ? 0 : 1)}M`;
+ if (v >= 1e3) return `${Math.round(v / 1e3)}K`;
+ return `${Math.round(v)}`;
+}
+
+// ---- the panel ----
+
+function Graph({ hist }) {
+ const th = useTheme();
+ // 60 bars of 5 s each (the newest on the right), sent above the line and received below
+ const bars = Array.from({ length: 60 }, (_, i) => {
+ const end = hist.length - (59 - i) * 5, part = hist.slice(Math.max(0, end - 5), Math.max(0, end));
+ const n = part.length || 1;
+ return [part.reduce((a, p) => a + p[0], 0) / n, part.reduce((a, p) => a + p[1], 0) / n];
+ });
+ const peak = Math.max(1, ...bars.map((b) => Math.max(b[0], b[1])));
+ const H = 28;
+ return (
+ <View style={{ height: H * 2 + 1, flexDirection: 'row', alignItems: 'center', gap: 1, direction: 'ltr' }}>
+ {bars.map((b, i) => (
+ <View key={i} style={{ flex: 1, height: H * 2 + 1 }}>
+ <View style={{ height: H, justifyContent: 'flex-end' }}>
+ <View style={{ height: b[1] ? Math.max(1, (b[1] / peak) * H) : 0, backgroundColor: '#f97316', borderRadius: 1 }} />
+ </View>
+ <View style={{ height: 1, backgroundColor: th.separator }} />
+ <View style={{ height: H }}>
+ <View style={{ height: b[0] ? Math.max(1, (b[0] / peak) * H) : 0, backgroundColor: '#22c55e', borderRadius: 1 }} />
+ </View>
+ </View>
+ ))}
+ </View>
+ );
+}
+
+function appLabel(id, launcher) {
+ if (id === 'lordos') return t('monitor.lordos');
+ if (COMPONENTS[id]) return t(COMPONENTS[id].label);
+ const a = launcher.find((x) => x.id === id || `lpk:${x.id}` === id || `desktop:${x.id}` === id);
+ return a?.name || String(id).replace(/^(desktop|lpk):/, '');
+}
+
+function Panel({ onClose }) {
+ const th = useTheme();
+ const st = useStore(netStatus);
+ const fw = useStore(firewallState);
+ const launcher = useLauncherApps();
+ const mode = firewall.state().mode || 'silent';
+ const lists = firewall.lists();
+ const sum = st.hist.reduce((a, p) => [a[0] + p[0], a[1] + p[1]], [0, 0]);
+ const active = Object.entries(fw.counts || {}).filter(([, v]) => Array.isArray(v) && (v[4] || v[5]))
+ .sort((a, b) => b[1][4] + b[1][5] - (a[1][4] + a[1][5])).slice(0, 5);
+ const now = Date.now();
+ const denied = (fw.events || []).filter((e) => e.v === 'deny' && e.at && now - e.at < 10 * 60 * 1000);
+ const label = (k) => <Text style={{ fontSize: 11, fontWeight: 600, color: th.textDim, textAlign: 'start' }}>{k}</Text>;
+ const row = (k, v, color) => (
+ <View style={{ flexDirection: 'row', gap: 8 }}>
+ <Text style={{ flex: 1, minWidth: 0, fontSize: 12, color: th.text, whiteSpace: 'nowrap', overflow: 'hidden', textAlign: 'start' }}>{k}</Text>
+ <Text style={{ fontSize: 12, color: color || th.textDim, whiteSpace: 'nowrap' }}>{v}</Text>
+ </View>
+ );
+ return (
+ <View style={{ width: 320, padding: 14, gap: 10 }}>
+ <View style={{ flexDirection: 'row', alignItems: 'center', gap: 8 }}>
+ <Text style={{ flex: 1, fontSize: 13, fontWeight: 600, color: th.text, textAlign: 'start' }}>{t('monitor.status.title')}</Text>
+ <Text style={{ fontSize: 11, color: '#22c55e' }}>{`↓ ${rate(st.rx)}`}</Text>
+ <Text style={{ fontSize: 11, color: '#f97316' }}>{`↑ ${rate(st.tx)}`}</Text>
+ </View>
+ <Graph hist={st.hist} />
+ <Text style={{ fontSize: 10, color: th.textDim, textAlign: 'start' }}>
+ {t('monitor.status.lastMinutes', { down: formatBytes(sum[0]), up: formatBytes(sum[1]) })}
+ </Text>
+ <View style={{ height: 1, backgroundColor: th.separator }} />
+ {label(t('monitor.status.activity'))}
+ {active.length ? active.map(([id, v]) => row(appLabel(id, launcher), `↓ ${rate(v[4])} · ↑ ${rate(v[5])}`))
+ : <Text style={{ fontSize: 12, color: th.textDim, textAlign: 'start' }}>{t('monitor.status.quiet')}</Text>}
+ <View style={{ height: 1, backgroundColor: th.separator }} />
+ <View style={{ flexDirection: 'row', alignItems: 'center' }}>
+ <View style={{ flex: 1 }}>{label(t('monitor.status.denied'))}</View>
+ <View style={{ minWidth: 18, height: 16, borderRadius: 8, paddingHorizontal: 5, alignItems: 'center', justifyContent: 'center',
+ backgroundColor: denied.length ? 'rgba(255,69,58,0.2)' : th.control }}>
+ <Text style={{ fontSize: 10, fontWeight: 700, color: denied.length ? '#ff453a' : th.textDim }}>{formatNumber(denied.length, 0)}</Text>
+ </View>
+ </View>
+ {denied.slice(-3).reverse().map((e, i) => (
+ <View key={i}>{row((e.hosts && e.hosts[0]) || e.addr || '?', appLabel(e.app, launcher))}</View>
+ ))}
+ <View style={{ height: 1, backgroundColor: th.separator }} />
+ {label(t('monitor.status.mode'))}
+ <Segmented small fill value={mode === 'ask' ? 'silent' : mode} onChange={(m) => firewall.setMode(m)}
+ options={[['silent', t('firewall.mode.silent')], ['deny', t('firewall.mode.deny')], ['off', t('firewall.mode.off')]]} />
+ <Text style={{ fontSize: 10, color: th.textDim, lineHeight: 1.35, textAlign: 'start' }}>
+ {t(mode === 'deny' ? 'firewall.mode.denyHint' : mode === 'off' ? 'firewall.mode.offHint' : 'firewall.mode.silentHint')}
+ </Text>
+ {lists ? (
+ <View onClick={() => { onClose(); wm.open('settings', { args: { section: 'privacy', nonce: Date.now() } }); }}>
+ {row(t('monitor.status.lists'), t('monitor.status.listsValue', { lists: formatNumber(lists.lists.filter((l) => l.on).length, 0),
+ entries: formatNumber((lists.domains || 0) + (lists.nets || 0), 0) }))}
+ </View>
+ ) : null}
+ <View style={{ height: 1, backgroundColor: th.separator }} />
+ <View onClick={() => { onClose(); wm.open('monitor', { args: { tab: 'network', nonce: Date.now() } }); }}>
+ <Text style={{ fontSize: 12, color: th.accent, textAlign: 'start' }}>{t('monitor.status.open')}</Text>
+ </View>
+ </View>
+ );
+}
+
+function NetStatusItem({ color, height }) {
+ const th = useTheme();
+ const s = useStore(settings);
+ const st = useStore(netStatus);
+ const [open, setOpen] = useState(false);
+ const btn = useRef(null), panel = useRef(null);
+ useEffect(() => {
+ if (!open) return undefined;
+ return addListener('pointerdown', (e) => {
+ const inside = (n) => { if (!n) return false; const [x, y, w, hh] = lord.getLayout(n.id); return e.x >= x && e.x <= x + w && e.y >= y && e.y <= y + hh; };
+ if (!inside(panel.current) && !inside(btn.current)) setOpen(false);
+ });
+ }, [open]);
+ if (s?.monitor?.menuItem !== true) return null;
+ return (
+ <View ref={btn} onClick={() => setOpen((o) => !o)} style={{ height, paddingHorizontal: 6, justifyContent: 'center', direction: 'ltr' }}>
+ <View style={{ width: 44 }}>
+ <Text style={{ fontSize: 9, lineHeight: 1.05, color, fontFamily: 'monospace', textAlign: 'end' }}>{`↑${short(st.tx)}`}</Text>
+ <Text style={{ fontSize: 9, lineHeight: 1.05, color, fontFamily: 'monospace', textAlign: 'end' }}>{`↓${short(st.rx)}`}</Text>
+ </View>
+ {open && (
+ <Overlay anchor={btn}>
+ <View ref={panel} style={{ position: 'absolute', top: height + 4, right: 0, borderRadius: th.menuRadius || 10, backgroundColor: popupBg(th),
+ border: `1px solid ${th.separator}`, boxShadow: '0 10px 30px rgba(0,0,0,0.35)' }}>
+ <Panel onClose={() => setOpen(false)} />
+ </View>
+ </Overlay>
+ )}
+ </View>
+ );
+}
+
+// ---- start ----
+
+let started = false;
+
+function updateLists() {
+ if (!firewall.available()) return;
+ firewall.updateLists(false);
+ // lord-server swaps the new set in and tells lord-netperm when the job ends; reading the state
+ // is what lets it notice, so keep reading while it works
+ let n = 0;
+ const poll = () => {
+ const st = firewall.lists();
+ if (st?.busy && n++ < 400) setTimeout(poll, 3000);
+ };
+ setTimeout(poll, 3000);
+}
+
+export function startNetStatus() {
+ if (started) return;
+ started = true;
+ registerStatusItem('network', NetStatusItem, 3);
+ sync();
+ settings.subscribe(sync);
+ setTimeout(updateLists, 20 * 1000);
+ setInterval(updateLists, 60 * 60 * 1000);
+}
+
diff --git a/server/src/fw/fwsub.c b/server/src/fw/fwsub.c
index b191bd0..dccee1d 100644
--- a/server/src/fw/fwsub.c
+++ b/server/src/fw/fwsub.c
@@ -32,6 +32,8 @@ typedef struct {
long domains, nets;
int truncated;
char error[64]; /* the last attempt's error code ("" if it went well) */
+ char topic[16], source[96], license[96], homepage[160]; /* the catalog's, for Settings */
+ long approx;
} List;
static List L[FWS_MAX_LISTS];
@@ -148,8 +150,17 @@ static void load_catalog(void) {
size_t i = 0;
for (const JVal *o = lists && lists->type == J_ARR ? lists->kid : NULL; o; o = o->next, i++) {
if (add_list(json_str(o, "id") ? json_str(o, "id") : "", json_str(o, "url") ? json_str(o, "url") : "",
- json_str(o, "format") ? json_str(o, "format") : "", json_num(o, "sub", 0) == 1, 0))
+ json_str(o, "format") ? json_str(o, "format") : "", json_num(o, "sub", 0) == 1, 0)) {
fprintf(stderr, "lord.fw: blocklist catalog entry %zu is invalid\n", i);
+ continue;
+ }
+ List *l = &L[nl - 1];
+ const char *tp = json_str(o, "topic"), *src = json_str(o, "source"), *lic = json_str(o, "license"), *hp = json_str(o, "homepage");
+ snprintf(l->topic, sizeof l->topic, "%s", tp && (!strcmp(tp, "ads") || !strcmp(tp, "trackers") || !strcmp(tp, "malware")) ? tp : "other");
+ snprintf(l->source, sizeof l->source, "%s", src ? src : "");
+ snprintf(l->license, sizeof l->license, "%s", lic ? lic : "");
+ snprintf(l->homepage, sizeof l->homepage, "%s", hp && !strncmp(hp, "https://", 8) ? hp : "");
+ l->approx = (long)json_num(o, "approx", 0);
}
json_free(&d);
free(t);
@@ -606,6 +617,15 @@ char *fws_json(void) {
jb_str(&b, l->format);
jb_raw(&b, ",\"error\":");
jb_str(&b, l->error);
+ jb_raw(&b, ",\"topic\":");
+ jb_str(&b, l->custom ? "custom" : l->topic);
+ jb_raw(&b, ",\"source\":");
+ jb_str(&b, l->source);
+ jb_raw(&b, ",\"license\":");
+ jb_str(&b, l->license);
+ jb_raw(&b, ",\"homepage\":");
+ jb_str(&b, l->homepage);
+ jb_printf(&b, ",\"approx\":%ld", l->approx);
jb_printf(&b, ",\"custom\":%s,\"on\":%s,\"updated\":%lld,\"tried\":%lld,\"domains\":%ld,\"nets\":%ld,\"truncated\":%s}",
l->custom ? "true" : "false", l->on ? "true" : "false", l->updated, l->tried, l->domains, l->nets,
l->truncated ? "true" : "false");