Skip to content

Commit

Permalink
Disable TLS for the client proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
garthvh committed Feb 11, 2025
1 parent 1ff4522 commit 815af45
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@
</EnvironmentVariable>
<EnvironmentVariable
key = "PUBLIC_MQTT_USERNAME"
value = "meshdev1"
value = "meshdev"
isEnabled = "YES">
</EnvironmentVariable>
<EnvironmentVariable
key = "PUBLIC_MQTT_PASSWORD"
value = "large4cats1"
value = "large4cats"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
Expand Down
9 changes: 4 additions & 5 deletions Meshtastic/Helpers/Mqtt/MqttClientProxyManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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" + "/#"
Expand Down
12 changes: 8 additions & 4 deletions Meshtastic/Views/Settings/Config/Module/MQTTConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ struct MQTTConfig: View {
}
.keyboardType(.default)
.scrollDismissesKeyboard(.interactively)

HStack {
Label("password", systemImage: "wallet.pass")
TextField("password", text: $password)
Expand All @@ -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.")
Expand Down Expand Up @@ -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 }
}
Expand Down

0 comments on commit 815af45

Please sign in to comment.