From d57e43d2a71c76c853fba0b818df3596ae715c87 Mon Sep 17 00:00:00 2001 From: tekoiv Date: Wed, 22 Nov 2023 10:35:02 +0200 Subject: [PATCH] fix: limit general topics with feed ids --- app/util/mqttClient.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/util/mqttClient.js b/app/util/mqttClient.js index 483053640d..4cc1d48415 100644 --- a/app/util/mqttClient.js +++ b/app/util/mqttClient.js @@ -135,7 +135,14 @@ export function changeTopics(settings, actionContext) { export function startMqttClient(settings, actionContext) { const options = settings.options || [{}]; - const topics = options.map(option => getTopic(option, settings)); + let topics = options.map(option => getTopic(option, settings)); + // If a general topic is returned, at least limit it to instances feed ids + if (topics[0] === '/gtfsrt/vp/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/#') { + const { feedIds } = actionContext.config; + topics = feedIds.map( + feedId => `/gtfsrt/vp/${feedId}/+/+/+/+/+/+/+/+/+/+/+/+/+/+/#`, + ); + } return import(/* webpackChunkName: "mqtt" */ 'mqtt').then(mqtt => { if (settings.gtfsrt) {