Hide MACs when hostname present

This commit is contained in:
2026-02-08 03:33:43 +03:00
parent b4a243e72f
commit 7db336f2aa

View File

@@ -242,7 +242,7 @@ def _parse_hostapd_clients(
sig = f"{signal}dBm" if isinstance(signal, (int, float)) else "?" sig = f"{signal}dBm" if isinstance(signal, (int, float)) else "?"
host = name_map.get(str(mac).lower()) host = name_map.get(str(mac).lower())
if host and host != "unknown": if host and host != "unknown":
client_label = f"{host} ({mac})" client_label = host
else: else:
client_label = str(mac) client_label = str(mac)
clients.append(f"{net_label} {client_label} {sig} rx:{rx} tx:{tx}") clients.append(f"{net_label} {client_label} {sig} rx:{rx} tx:{tx}")
@@ -365,7 +365,7 @@ async def get_openwrt_status(cfg: dict[str, Any]) -> str:
cmd_clients = ssh_cmd + ["ubus", "call", f"hostapd.{ifname}", "get_clients"] cmd_clients = ssh_cmd + ["ubus", "call", f"hostapd.{ifname}", "get_clients"]
rc2, out2 = await run_cmd_full(cmd_clients, timeout=timeout_sec + 15) rc2, out2 = await run_cmd_full(cmd_clients, timeout=timeout_sec + 15)
if rc2 == 124: if rc2 == 124:
return f"?? OpenWrt SSH error (wifi clients {ifname}): timeout" return f"⚠️ OpenWrt SSH error (wifi clients {ifname}): timeout"
if rc2 == 0: if rc2 == 0:
payload = _safe_json_load(out2) payload = _safe_json_load(out2)
if payload: if payload: