Ensure that go2rtc streams are cleaned (#15524)

* Ensure that go2rtc streams are cleaned

* Formatting

* Handle go2rtc config correctly

* Set type
This commit is contained in:
Nicolas Mowen 2024-12-15 16:56:24 -06:00 committed by GitHub
parent 17f8939f97
commit 33ee32865f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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