From 530dc9c2aa7b58b63c77d6da13a4bc96be5056ec Mon Sep 17 00:00:00 2001 From: liamcottle Date: Fri, 29 Mar 2024 19:59:16 +1300 Subject: [PATCH] add command line arg to collect all text messages --- src/mqtt.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/mqtt.js b/src/mqtt.js index 8be9308..eabbd40 100644 --- a/src/mqtt.js +++ b/src/mqtt.js @@ -36,6 +36,11 @@ const optionsList = [ type: Boolean, description: "This option will save all received service envelopes to the database.", }, + { + name: "collect-text-messages", + type: Boolean, + description: "This option will save all received text messages to the database.", + }, { name: "decryption-keys", type: String, @@ -79,6 +84,7 @@ const mqttBrokerUrl = options["mqtt-broker-url"] ?? "mqtt://mqtt.meshtastic.org" const mqttUsername = options["mqtt-username"] ?? "meshdev"; const mqttPassword = options["mqtt-password"] ?? "large4cats"; const collectServiceEnvelopes = options["collect-service-envelopes"] ?? false; +const collectTextMessages = options["collect-text-messages"] ?? false; const decryptionKeys = options["decryption-keys"] ?? [ "1PG7OiApB1nwvP+rz05pAQ==", // add default "AQ==" decryption key ]; @@ -240,7 +246,7 @@ client.on("message", async (topic, message) => { const logUnknownPacketTypes = false; const portnum = envelope.packet?.decoded?.portnum; - if(portnum === 1) { + if(portnum === 1 && collectTextMessages) { if(logKnownPacketTypes) { console.log("TEXT_MESSAGE_APP", {