From 33ee32865f2ba5de3dded425b2caa6a2753124f9 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Sun, 15 Dec 2024 16:56:24 -0600 Subject: [PATCH] Ensure that go2rtc streams are cleaned (#15524) * Ensure that go2rtc streams are cleaned * Formatting * Handle go2rtc config correctly * Set type --- frigate/api/app.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/frigate/api/app.py b/frigate/api/app.py index a94c6415c..57efdeb15 100644 --- a/frigate/api/app.py +++ b/frigate/api/app.py @@ -134,9 +134,25 @@ def config(request: Request): for zone_name, zone in config_obj.cameras[camera_name].zones.items(): camera_dict["zones"][zone_name]["color"] = zone.color + # remove go2rtc stream passwords + go2rtc: dict[str, any] = config_obj.go2rtc.model_dump( + mode="json", warnings="none", exclude_none=True + ) + for stream_name, stream in go2rtc.get("streams", {}).items(): + if isinstance(stream, str): + cleaned = clean_camera_user_pass(stream) + else: + cleaned = [] + + for item in stream: + cleaned.append(clean_camera_user_pass(item)) + + config["go2rtc"]["streams"][stream_name] = cleaned + config["plus"] = {"enabled": request.app.frigate_config.plus_api.is_active()} config["model"]["colormap"] = config_obj.model.colormap + # use merged labelamp for detector_config in config["detectors"].values(): detector_config["model"]["labelmap"] = ( request.app.frigate_config.model.merged_labelmap