From 815af45b2d93bdc0c3f47f0ae554bfe655b4cd66 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Tue, 11 Feb 2025 07:40:02 -0800 Subject: [PATCH] Disable TLS for the client proxy --- .../xcshareddata/xcschemes/Meshtastic.xcscheme | 4 ++-- Meshtastic/Helpers/Mqtt/MqttClientProxyManager.swift | 9 ++++----- .../Views/Settings/Config/Module/MQTTConfig.swift | 12 ++++++++---- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Meshtastic.xcodeproj/xcshareddata/xcschemes/Meshtastic.xcscheme b/Meshtastic.xcodeproj/xcshareddata/xcschemes/Meshtastic.xcscheme index 424b2cb7..508a6cab 100644 --- a/Meshtastic.xcodeproj/xcshareddata/xcschemes/Meshtastic.xcscheme +++ b/Meshtastic.xcodeproj/xcshareddata/xcschemes/Meshtastic.xcscheme @@ -79,12 +79,12 @@ diff --git a/Meshtastic/Helpers/Mqtt/MqttClientProxyManager.swift b/Meshtastic/Helpers/Mqtt/MqttClientProxyManager.swift index 56d146c2..3df11e4b 100644 --- a/Meshtastic/Helpers/Mqtt/MqttClientProxyManager.swift +++ b/Meshtastic/Helpers/Mqtt/MqttClientProxyManager.swift @@ -42,11 +42,10 @@ class MqttClientProxyManager { let port = defaultServerPort var username = node.mqttConfig?.username var password = node.mqttConfig?.password - if host == defaultServerAddress { - username = ProcessInfo.processInfo.environment["PUBLIC_MQTT_USERNAME"] - password = ProcessInfo.processInfo.environment["PUBLIC_MQTT_PASSWORD"] - useSsl = false - } + // if host == defaultServerAddress { + //username = ProcessInfo.processInfo.environment["PUBLIC_MQTT_USERNAME"] + //password = ProcessInfo.processInfo.environment["PUBLIC_MQTT_PASSWORD"] + // } let root = node.mqttConfig?.root?.count ?? 0 > 0 ? node.mqttConfig?.root : "msh" let prefix = root! topic = prefix + "/2/e" + "/#" diff --git a/Meshtastic/Views/Settings/Config/Module/MQTTConfig.swift b/Meshtastic/Views/Settings/Config/Module/MQTTConfig.swift index fd64c17d..796a7ce0 100644 --- a/Meshtastic/Views/Settings/Config/Module/MQTTConfig.swift +++ b/Meshtastic/Views/Settings/Config/Module/MQTTConfig.swift @@ -194,6 +194,7 @@ struct MQTTConfig: View { } .keyboardType(.default) .scrollDismissesKeyboard(.interactively) + HStack { Label("password", systemImage: "wallet.pass") TextField("password", text: $password) @@ -214,11 +215,13 @@ struct MQTTConfig: View { .keyboardType(.default) .scrollDismissesKeyboard(.interactively) .listRowSeparator(/*@START_MENU_TOKEN@*/.visible/*@END_MENU_TOKEN@*/) - Toggle(isOn: $tlsEnabled) { - Label("TLS Enabled", systemImage: "checkmark.shield.fill") - Text("Your MQTT Server must support TLS.") + if !proxyToClientEnabled { + Toggle(isOn: $tlsEnabled) { + Label("TLS Enabled", systemImage: "checkmark.shield.fill") + Text("Your MQTT Server must support TLS.") + } + .toggleStyle(SwitchToggleStyle(tint: .accentColor)) } - .toggleStyle(SwitchToggleStyle(tint: .accentColor)) } } Text("For all Mqtt functionality other than the map report you must also set uplink and downlink for each channel you want to bridge over Mqtt.") @@ -269,6 +272,7 @@ struct MQTTConfig: View { .onChange(of: proxyToClientEnabled) { _, newProxyToClientEnabled in if newProxyToClientEnabled { jsonEnabled = false + tlsEnabled = false } if newProxyToClientEnabled != node?.mqttConfig?.proxyToClientEnabled { hasChanges = true } }