Show inventory for all reporting clients
build / build-linux-amd64 (push) Successful in 1m49s

This commit is contained in:
2026-05-21 16:24:00 +02:00
parent c2d320b782
commit cd461a4507
2 changed files with 15 additions and 30 deletions
-7
View File
@@ -865,13 +865,6 @@ pub fn t(lang: Lang, key: &str) -> &'static str {
"Datele de inventar nu au fost încă raportate. Agentul le colectează la pornire și le încarcă la următorul ciclu sysinfo (≤120 s).",
"Aún no se han reportado datos de inventario. El agente los recopila al iniciar y los envía en el próximo ciclo sysinfo (≤120 s).",
),
"devices.inventory_unsupported" => (
"Inventory data is only reported by HelloAgent. This device is running {0}; the standard RustDesk client does not collect hardware or BitLocker inventory.",
"Inventardaten werden nur von HelloAgent gemeldet. Auf diesem Gerät läuft {0}; der Standard-RustDesk-Client erfasst keine Hardware- oder BitLocker-Inventardaten.",
"Les données d'inventaire ne sont rapportées que par HelloAgent. Cet appareil exécute {0} ; le client RustDesk standard ne collecte pas l'inventaire matériel ou BitLocker.",
"Datele de inventar sunt raportate doar de HelloAgent. Acest dispozitiv rulează {0}; clientul RustDesk standard nu colectează inventar hardware sau BitLocker.",
"Los datos de inventario solo los reporta HelloAgent. Este dispositivo está ejecutando {0}; el cliente RustDesk estándar no recopila inventario de hardware ni BitLocker.",
),
"devices.serial_number" => (
"Serial number",
"Seriennummer",
+15 -23
View File
@@ -521,32 +521,24 @@ fn render_detail(lang: Lang, d: &DashboardDeviceRow) -> String {
mem_rt = html_escape(if mem_runtime.is_empty() { "" } else { &mem_runtime }),
);
// Inventory section — only present when the agent reports it. We key
// gating off `agent_name == "HelloAgent"` because the regular RustDesk
// client doesn't ship the inventory collector and would never populate
// this. `agent_name` is the explicit rebrand identity stamped by
// hello-agent's main.rs; absence means vanilla rustdesk.
let inventory_section = if agent_name == "HelloAgent" {
match parsed.get("inventory") {
Some(inv) if inv.is_object() => render_inventory_table(lang, inv),
_ => format!(
r##"<div class="rounded-md border border-amber-700/50 bg-amber-900/20 p-3 text-sm text-amber-300">
{msg}
</div>"##,
msg = t(lang, "devices.inventory_pending"),
),
}
} else {
format!(
// Inventory section — rendered whenever the device's sysinfo payload
// contains a populated `inventory` object, regardless of which client
// sent it. We used to gate this on `agent_name == "HelloAgent"` (the
// explicit rebrand identity stamped by hello-agent), but that filter
// (a) broke silently when hello-agent's APP_NAME changed casing, and
// (b) hid any inventory data shipped by a future client variant that
// didn't carry the exact same agent_name string. Rendering on presence
// (`inv.is_object()`) instead of identity makes the page robust to both.
// The "pending" message covers the only remaining absence case: an
// agent that doesn't (or doesn't yet) report inventory.
let inventory_section = match parsed.get("inventory") {
Some(inv) if inv.is_object() => render_inventory_table(lang, inv),
_ => format!(
r##"<div class="rounded-md border border-slate-700 bg-slate-900 p-3 text-sm text-slate-400">
{msg}
</div>"##,
msg = tf1(
lang,
"devices.inventory_unsupported",
&format!("<span class=\"text-slate-200\">{}</span>", html_escape(&identity_label))
),
)
msg = t(lang, "devices.inventory_pending"),
),
};
format!(