From cd38dd3f68ff3412844b242131f04be345dc599e Mon Sep 17 00:00:00 2001 From: Nelson Chan Date: Mon, 18 Apr 2022 13:04:55 +0800 Subject: [PATCH 1/2] Feat: Allow MQTT successMessage to be optional --- server/util-server.js | 6 +++--- src/pages/EditMonitor.vue | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/server/util-server.js b/server/util-server.js index a9ec89e66..7a9d3e7d1 100644 --- a/server/util-server.js +++ b/server/util-server.js @@ -135,10 +135,10 @@ exports.mqttAsync = function (hostname, topic, okMessage, options = {}) { if (messageTopic == topic) { client.end(); clearTimeout(timeoutID); - if (message.toString() === okMessage) { - resolve(`Topic: ${messageTopic}; Message: ${message.toString()}`); + if (okMessage != null && okMessage !== "" && message.toString() !== okMessage) { + reject(new Error(`Message Mismatch - Topic: ${messageTopic}; Message: ${message.toString()}`)); } else { - reject(new Error(`Error; Topic: ${messageTopic}; Message: ${message.toString()}`)); + resolve(`Topic: ${messageTopic}; Message: ${message.toString()}`); } } }); diff --git a/src/pages/EditMonitor.vue b/src/pages/EditMonitor.vue index 405ed5f85..9615ce6a4 100644 --- a/src/pages/EditMonitor.vue +++ b/src/pages/EditMonitor.vue @@ -141,7 +141,7 @@
- +
{{ $t("successMessageExplanation") }}
From addf75daa7dacc495ba65b8eb0ee69b1627a9623 Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Mon, 18 Apr 2022 19:05:14 +0800 Subject: [PATCH 2/2] Fix MQTT password do not save --- server/server.js | 1 + 1 file changed, 1 insertion(+) diff --git a/server/server.js b/server/server.js index 728e1d9b7..7d6ee42b1 100644 --- a/server/server.js +++ b/server/server.js @@ -721,6 +721,7 @@ try { bean.pushToken = monitor.pushToken; bean.proxyId = Number.isInteger(monitor.proxyId) ? monitor.proxyId : null; bean.mqttUsername = monitor.mqttUsername; + bean.mqttPassword = monitor.mqttPassword; bean.mqttTopic = monitor.mqttTopic; bean.mqttSuccessMessage = monitor.mqttSuccessMessage;