From 57ced2c28448dfd703d8fdb52d4aa256b0e87e0a Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Sat, 13 Feb 2021 10:50:36 -0600 Subject: [PATCH] constrain websockets to frigate topics --- frigate/http.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frigate/http.py b/frigate/http.py index c34292b2a..4232fa3eb 100644 --- a/frigate/http.py +++ b/frigate/http.py @@ -40,14 +40,14 @@ class MqttBackend(): def publish(self, message): json_message = json.loads(message) - self.mqtt_client.publish(json_message['topic'], json_message['payload'], retain=json_message['retain']) + self.mqtt_client.publish(f"{self.topic_prefix}/{json_message['topic']}", json_message['payload'], retain=json_message['retain']) def run(self): def send(client, userdata, message): """Sends mqtt messages to clients.""" try: ws_message = json.dumps({ - 'topic': message.topic, + 'topic': message.topic.replace(f"{self.topic_prefix}/",""), 'payload': message.payload.decode() }) except: