diff --git a/frigate/api/app.py b/frigate/api/app.py index 0b2bd92bba..9ff24ed7e8 100644 --- a/frigate/api/app.py +++ b/frigate/api/app.py @@ -101,6 +101,11 @@ def stats( allowed_cameras: List[str] = Depends(get_allowed_cameras_for_filter), ): stats_data = request.app.stats_emitter.get_latest_stats() + + # Admins see the full snapshot + if request.headers.get("remote-role") == "admin": + return JSONResponse(content=stats_data) + allowed_set = set(allowed_cameras) # Shallow-copy so we don't mutate the cached stats history entry. @@ -118,15 +123,14 @@ def stats( name: data for name, data in bandwidth.items() if name in allowed_set } - # cmdline can leak camera URLs/paths; strip for non-admin but keep - # cpu/mem so client-side problem heuristics still work. - if request.headers.get("remote-role") != "admin": - cpu_usages = stats_data.get("cpu_usages") - if cpu_usages is not None: - filtered["cpu_usages"] = { - pid: {k: v for k, v in usage.items() if k != "cmdline"} - for pid, usage in cpu_usages.items() - } + # cmdline can leak camera URLs/paths; strip but keep cpu/mem so + # client-side problem heuristics still work. + cpu_usages = stats_data.get("cpu_usages") + if cpu_usages is not None: + filtered["cpu_usages"] = { + pid: {k: v for k, v in usage.items() if k != "cmdline"} + for pid, usage in cpu_usages.items() + } return JSONResponse(content=filtered)