Skip to content

Real-time network monitor + outbound firewall — see & block every connection. Privacy-first, local-first, Rust fleet agent, SIEM exports, 8 languages. / Moniteur réseau temps réel + pare-feu sortant, agent de flotte Rust, exports SIEM. 100 % local.

ux: local node shows the machine's real hostname

MoneyLisae29c8768a9be
diff --git a/backend/api/main.py b/backend/api/main.py
index b55bd3a..3f92efb 100644
--- a/backend/api/main.py
+++ b/backend/api/main.py
@@ -63,6 +63,7 @@ import json
import logging
import os
import queue
+import socket
import threading
import time
from contextlib import asynccontextmanager
@@ -244,6 +245,15 @@ def _ensure_lan_device(ip: str) -> dict:
_gateway_cache: dict = {"ip": None, "ts": 0.0}
+def _local_hostname() -> str:
+ """EN: This machine's display name, minus the mDNS ".local" suffix.
+ FR: Le nom d'affichage de cette machine, sans le suffixe mDNS « .local »."""
+ try:
+ return socket.gethostname().removesuffix(".local")
+ except OSError:
+ return ""
+
+
def _gateway() -> Optional[str]:
"""EN: Cached default_gateway() (5 min TTL).
FR: default_gateway() mis en cache (TTL 5 min)."""
@@ -787,13 +797,15 @@ async def _startup() -> None:
_loop = asyncio.get_running_loop()
nodes["local"] = {
- # EN: "local" node = this machine. The label is a translation key —
- # the frontend renders t("node_local") so it follows the UI
- # language instead of being hard-English in the payload.
- # FR: Le nœud « local » = cette machine. Le label est une clé de
- # traduction — le frontend affiche t("node_local") pour suivre
- # la langue de l'UI au lieu d'un anglais codé en dur.
- "id": "local", "label_key": "node_local", "ip": "local",
+ # EN: "local" node = this machine, labeled with its real hostname
+ # ("MoneyLia") — users recognize their own device name better
+ # than a generic "This Device". Falls back to the i18n key.
+ # FR: Le nœud « local » = cette machine, étiquetée avec son vrai nom
+ # d'hôte (« MoneyLia ») — l'utilisateur reconnaît mieux le nom
+ # de son appareil qu'un « Cet appareil » générique. Retombe sur
+ # la clé i18n.
+ "id": "local", "label": _local_hostname(), "label_key": "node_local",
+ "hostname": _local_hostname(), "ip": "local",
"category": "local", "color": "#3b82f6",
"bytes": 0, "packets": 0, "alerted": False,
}
diff --git a/frontend/src/components/Sidebar.jsx b/frontend/src/components/Sidebar.jsx
index 47302d5..636beb3 100644
--- a/frontend/src/components/Sidebar.jsx
+++ b/frontend/src/components/Sidebar.jsx
@@ -38,7 +38,7 @@ const CATEGORY_COLORS = {
* FR: Nom d'affichage d'un nœud — `label_key` est une clé de traduction
* résolue via t() (ex. le nœud « local »), puis label, puis l'IP.
*/
-const nodeName = (n, t) => (n.label_key ? t(n.label_key) : n.label) || n.ip
+const nodeName = (n, t) => n.label || (n.label_key ? t(n.label_key) : null) || n.ip
/**
* EN: Translate a raw backend enum value (device_type, category) through a
@@ -298,6 +298,7 @@ function NodeDetail({ node, onWhitelist }) {
FR: Indices « qu'est-ce qui se passe » — expliquer, pas alarmer.
Priorité : passerelle → LAN inactif/actif → encore anonyme →
MAC privée. */}
+ {node.id === 'local' && <Hint accent="#3b82f6">{t('hint_local')}</Hint>}
{node.is_gateway && <Hint>{t('hint_gateway')}</Hint>}
{isLan && !node.is_gateway && (
<Hint>
diff --git a/frontend/src/graph/ForceGraph.jsx b/frontend/src/graph/ForceGraph.jsx
index 486617d..0259327 100644
--- a/frontend/src/graph/ForceGraph.jsx
+++ b/frontend/src/graph/ForceGraph.jsx
@@ -62,7 +62,7 @@ export default function ForceGraph({ nodes, edges, lanDevices, alertedNodes = ne
// node shows "This Device"/"Cet appareil"), then label, then IP.
// FR: Nom d'affichage — `label_key` passe par l'i18n (ex. le nœud « local »
// affiche « This Device »/« Cet appareil »), puis label, puis l'IP.
- const displayName = d => (d.label_key ? t(d.label_key) : d.label) || d.ip
+ const displayName = d => d.label || (d.label_key ? t(d.label_key) : null) || d.ip
const displayNameRef = useRef(displayName)
displayNameRef.current = displayName
diff --git a/frontend/src/i18n.jsx b/frontend/src/i18n.jsx
index 83202fc..3ebcf17 100644
--- a/frontend/src/i18n.jsx
+++ b/frontend/src/i18n.jsx
@@ -81,6 +81,7 @@ const en = {
// EN: Node names + identification hints shown to the user.
// FR: Noms de nœuds + indices d'identification affichés à l'utilisateur.
node_local: 'This Device',
+ hint_local: 'This is THIS machine — the one running Snitch. Everything it sends or receives radiates from the center of the graph.',
unidentified: 'unidentified',
devtype_router: 'Router',
devtype_phone: 'Phone',
@@ -312,6 +313,7 @@ const fr = {
// FR: Noms de nœuds + indices d'identification affichés à l'utilisateur.
// EN: Node names + identification hints shown to the user.
node_local: 'Cet appareil',
+ hint_local: "C'est CETTE machine — celle qui fait tourner Snitch. Tout ce qu'elle envoie ou reçoit rayonne depuis le centre du graphe.",
unidentified: 'non identifié',
devtype_router: 'Routeur',
devtype_phone: 'Téléphone',
diff --git a/frontend/src/map/MapView.jsx b/frontend/src/map/MapView.jsx
index 49b83e1..18e3ac2 100644
--- a/frontend/src/map/MapView.jsx
+++ b/frontend/src/map/MapView.jsx
@@ -378,7 +378,7 @@ export default function MapView({ nodes, onNodeClick }) {
.attr('font-size', Math.max(9 / k, 5))
.attr('y', vr + 10 / k)
.text(() => {
- const lbl = (d.label_key ? t(d.label_key) : d.label) || d.ip || ''
+ const lbl = d.label || (d.label_key ? t(d.label_key) : null) || d.ip || ''
return lbl.length > 18 ? lbl.slice(0, 16) + '…' : lbl
})
})
@@ -419,7 +419,7 @@ export default function MapView({ nodes, onNodeClick }) {
boxShadow: '0 4px 20px rgba(0,0,0,0.5)',
}}>
<div style={{ fontWeight: 700, fontSize: 12, color: '#f1f5f9', marginBottom: 3 }}>
- {(tooltip.node.label_key ? t(tooltip.node.label_key) : tooltip.node.label) || tooltip.node.ip}
+ {tooltip.node.label || (tooltip.node.label_key ? t(tooltip.node.label_key) : null) || tooltip.node.ip}
</div>
{tooltip.node.country && (
<div style={{ fontSize: 10, color: '#94a3b8' }}>