mirror of
https://github.com/tbnobody/OpenDTU.git
synced 2025-12-10 16:59:52 +01:00
Fix: Dont allow HA base topic without trailing slash
This commit is contained in:
@@ -63,6 +63,7 @@ enum WebApiError {
|
||||
MqttHassTopicCharacter,
|
||||
MqttLwtQos,
|
||||
MqttClientIdLength,
|
||||
MqttHassTopicTrailingSlash,
|
||||
|
||||
NetworkBase = 8000,
|
||||
NetworkIpInvalid,
|
||||
|
||||
@@ -113,6 +113,7 @@
|
||||
"7015": "Το θέμα Hass δεν πρέπει να περιέχει χαρακτήρες διαστήματος!",
|
||||
"7016": "Το LWT QOS δεν πρέπει να είναι μεγαλύτερο από το {max}!",
|
||||
"7017": "Το αναγνωριστικό πελάτη δεν πρέπει να υπερβαίνει τους {max} χαρακτήρες!",
|
||||
"7018": "Hass topic must end with slash (/)!",
|
||||
"8001": "Η διεύθυνση IP δεν είναι έγκυρη!",
|
||||
"8002": "Η μάσκα δικτύου δεν είναι έγκυρη!",
|
||||
"8003": "Η πύλη δεν είναι έγκυρη!",
|
||||
|
||||
@@ -113,6 +113,7 @@
|
||||
"7015": "¡El tema Hass no debe contener caracteres de espacio!",
|
||||
"7016": "¡La QoS LWT no debe ser mayor que {max}!",
|
||||
"7017": "Client ID must not longer then {max} characters!",
|
||||
"7018": "Hass topic must end with slash (/)!",
|
||||
"8001": "¡La dirección IP no es válida!",
|
||||
"8002": "¡La máscara de red no es válida!",
|
||||
"8003": "¡El gateway no es válido!",
|
||||
|
||||
@@ -113,6 +113,7 @@
|
||||
"7015": "Hass topic must not contain space characters!",
|
||||
"7016": "LWT QOS must not greater then {max}!",
|
||||
"7017": "Client ID must not longer then {max} characters!",
|
||||
"7018": "Hass topic must end with slash (/)!",
|
||||
"8001": "IP address is invalid!",
|
||||
"8002": "Netmask is invalid!",
|
||||
"8003": "Gateway is invalid!",
|
||||
|
||||
@@ -113,6 +113,7 @@
|
||||
"7015": "Temat Hass nie może zawierać spacji!",
|
||||
"7016": "LWT QOS nie może być większy niż {max}!",
|
||||
"7017": "Identyfikator klienta nie może być dłuższy niż {max} znaków!",
|
||||
"7018": "Hass topic must end with slash (/)!",
|
||||
"8001": "Adres IP jest nieprawidłowy!!",
|
||||
"8002": "Maska sieci jest nieprawidłowa!",
|
||||
"8003": "Brama jest nieprawidłowa!",
|
||||
|
||||
@@ -268,6 +268,13 @@ void WebApiMqttClass::onMqttAdminPost(AsyncWebServerRequest* request)
|
||||
WebApi.sendJsonResponse(request, response, __FUNCTION__, __LINE__);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!root["mqtt_hass_topic"].as<String>().endsWith("/")) {
|
||||
retMsg["message"] = "Hass topic must end with a slash (/)!";
|
||||
retMsg["code"] = WebApiError::MqttHassTopicTrailingSlash;
|
||||
WebApi.sendJsonResponse(request, response, __FUNCTION__, __LINE__);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -98,6 +98,7 @@
|
||||
"7015": "Hass-Topic darf keine Leerzeichen enthalten!",
|
||||
"7016": "LWT QoS darf nicht größer als {max} sein!",
|
||||
"7017": "Client ID darf nicht länger als {max} Zeichen sein!",
|
||||
"7018": "Hass-Topic muss mit einem Slash (/) enden!",
|
||||
"8001": "IP-Adresse ist ungültig!",
|
||||
"8002": "Netzmaske ist ungültig!",
|
||||
"8003": "Standardgateway ist ungültig!",
|
||||
|
||||
@@ -98,6 +98,7 @@
|
||||
"7015": "Hass topic must not contain space characters!",
|
||||
"7016": "LWT QOS must not greater then {max}!",
|
||||
"7017": "Client ID must not longer then {max} characters!",
|
||||
"7018": "Hass topic must end with slash (/)!",
|
||||
"8001": "IP address is invalid!",
|
||||
"8002": "Netmask is invalid!",
|
||||
"8003": "Gateway is invalid!",
|
||||
|
||||
@@ -98,6 +98,7 @@
|
||||
"7015": "Le sujet Hass ne doit pas contenir d'espace !",
|
||||
"7016": "LWT QOS ne doit pas être supérieur à {max}!",
|
||||
"7017": "Client ID must not longer then {max} characters!",
|
||||
"7018": "Hass topic must end with slash (/)!",
|
||||
"8001": "L'adresse IP n'est pas valide !",
|
||||
"8002": "Le masque de réseau n'est pas valide !",
|
||||
"8003": "La passerelle n'est pas valide !",
|
||||
|
||||
Reference in New Issue
Block a user