mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Revert broken channel key validation
Remove block range test Add notes that router role is not for mobile nodes
This commit is contained in:
parent
1bec0dae66
commit
350ec121d7
6 changed files with 19 additions and 60 deletions
|
|
@ -9,7 +9,6 @@ import Foundation
|
|||
|
||||
extension UserDefaults {
|
||||
enum Keys: String, CaseIterable {
|
||||
case enableRangeTest
|
||||
case preferredPeripheralId
|
||||
case preferredPeripheralNum
|
||||
case provideLocation
|
||||
|
|
@ -32,13 +31,6 @@ extension UserDefaults {
|
|||
func reset() {
|
||||
Keys.allCases.forEach { removeObject(forKey: $0.rawValue) }
|
||||
}
|
||||
static var blockRangeTest: Bool {
|
||||
get {
|
||||
UserDefaults.standard.bool(forKey: "blockRangeTest")
|
||||
} set {
|
||||
UserDefaults.standard.set(newValue, forKey: "blockRangeTest")
|
||||
}
|
||||
}
|
||||
static var preferredPeripheralId: String {
|
||||
get {
|
||||
UserDefaults.standard.string(forKey: "preferredPeripheralId") ?? ""
|
||||
|
|
|
|||
|
|
@ -594,7 +594,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate
|
|||
// Log any other unknownApp calls
|
||||
if !nowKnown { MeshLogger.log("🕸️ MESH PACKET received for Unknown App UNHANDLED \((try? decodedInfo.packet.jsonString()) ?? "JSON Decode Failure")") }
|
||||
case .textMessageApp, .detectionSensorApp:
|
||||
textMessageAppPacket(packet: decodedInfo.packet, blockRangeTest: UserDefaults.blockRangeTest, connectedNode: (self.connectedPeripheral != nil ? connectedPeripheral.num : 0), context: context!)
|
||||
textMessageAppPacket(packet: decodedInfo.packet, connectedNode: (self.connectedPeripheral != nil ? connectedPeripheral.num : 0), context: context!)
|
||||
case .remoteHardwareApp:
|
||||
MeshLogger.log("🕸️ MESH PACKET received for Remote Hardware App UNHANDLED \((try? decodedInfo.packet.jsonString()) ?? "JSON Decode Failure")")
|
||||
case .positionApp:
|
||||
|
|
@ -620,8 +620,8 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate
|
|||
MeshLogger.log("🕸️ MESH PACKET received for Store and Forward App - Store and Forward is disabled.")
|
||||
}
|
||||
case .rangeTestApp:
|
||||
if wantRangeTestPackets && !UserDefaults.blockRangeTest {
|
||||
textMessageAppPacket(packet: decodedInfo.packet, blockRangeTest: false, connectedNode: (self.connectedPeripheral != nil ? connectedPeripheral.num : 0), context: context!)
|
||||
if wantRangeTestPackets {
|
||||
textMessageAppPacket(packet: decodedInfo.packet, connectedNode: (self.connectedPeripheral != nil ? connectedPeripheral.num : 0), context: context!)
|
||||
}
|
||||
else {
|
||||
MeshLogger.log("🕸️ MESH PACKET received for Range Test App Range testing is disabled.")
|
||||
|
|
|
|||
|
|
@ -721,13 +721,9 @@ func telemetryPacket(packet: MeshPacket, connectedNode: Int64, context: NSManage
|
|||
}
|
||||
}
|
||||
|
||||
func textMessageAppPacket(packet: MeshPacket, blockRangeTest: Bool, connectedNode: Int64, context: NSManagedObjectContext) {
|
||||
func textMessageAppPacket(packet: MeshPacket, connectedNode: Int64, context: NSManagedObjectContext) {
|
||||
|
||||
if let messageText = String(bytes: packet.decoded.payload, encoding: .utf8) {
|
||||
|
||||
if blockRangeTest && messageText.starts(with: "seq ") {
|
||||
return
|
||||
}
|
||||
|
||||
MeshLogger.log("💬 \("mesh.log.textmessage.received".localized)")
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ struct AppSettings: View {
|
|||
@State var totalDownloadedTileSize = ""
|
||||
@StateObject var locationHelper = LocationHelper()
|
||||
@State var provideLocation: Bool = UserDefaults.provideLocation
|
||||
@State var blockRangeTest: Bool = UserDefaults.blockRangeTest
|
||||
@State var useLegacyMap: Bool = UserDefaults.mapUseLegacy
|
||||
@State var provideLocationInterval: Int = UserDefaults.provideLocationInterval
|
||||
@State private var isPresentingCoreDataResetConfirm = false
|
||||
|
|
@ -20,12 +19,6 @@ struct AppSettings: View {
|
|||
VStack {
|
||||
Form {
|
||||
Section(header: Text("options")) {
|
||||
|
||||
Toggle(isOn: $blockRangeTest) {
|
||||
Label("range.test.blocked", systemImage: "x.circle")
|
||||
}
|
||||
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
|
||||
|
||||
Toggle(isOn: $useLegacyMap) {
|
||||
Label("map.use.legacy", systemImage: "map")
|
||||
}
|
||||
|
|
@ -151,9 +144,6 @@ struct AppSettings: View {
|
|||
self.bleManager.context = context
|
||||
}
|
||||
}
|
||||
.onChange(of: blockRangeTest) { newBlockRangeTest in
|
||||
UserDefaults.blockRangeTest = newBlockRangeTest
|
||||
}
|
||||
.onChange(of: provideLocation) { newProvideLocation in
|
||||
UserDefaults.provideLocation = newProvideLocation
|
||||
if bleManager.connectedPeripheral != nil {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
//
|
||||
// ShareChannel.swift
|
||||
// MeshtasticApple
|
||||
// Channels.swift
|
||||
// Meshtastic Apple
|
||||
//
|
||||
// Copyright(c) Garth Vander Houwen 4/8/22.
|
||||
//
|
||||
|
|
@ -25,7 +25,6 @@ struct Channels: View {
|
|||
var node: NodeInfoEntity?
|
||||
|
||||
@State var hasChanges = false
|
||||
@State var hasValidKey = false
|
||||
@State private var isPresentingEditView = false
|
||||
@State private var isPresentingSaveConfirm: Bool = false
|
||||
@State private var channelIndex: Int32 = 0
|
||||
|
|
@ -168,34 +167,16 @@ struct Channels: View {
|
|||
HStack(alignment: .top) {
|
||||
Text("Key")
|
||||
Spacer()
|
||||
TextField(
|
||||
"Key",
|
||||
text: $channelKey
|
||||
)
|
||||
.padding(4)
|
||||
.disableAutocorrection(true)
|
||||
.keyboardType(.alphabet)
|
||||
.foregroundColor(Color.gray)
|
||||
.textSelection(.enabled)
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: 25.0)
|
||||
.stroke(
|
||||
hasValidKey ?
|
||||
Color.green :
|
||||
Color.red
|
||||
, lineWidth: 2.0)
|
||||
)
|
||||
.onChange(of: channelKey, perform: { _ in
|
||||
let tempKey = Data(base64Encoded: channelKey) ?? Data()
|
||||
if tempKey.count == channelKeySize || channelKeySize == -1{
|
||||
hasValidKey = true
|
||||
}
|
||||
else {
|
||||
hasValidKey = false
|
||||
}
|
||||
hasChanges = true
|
||||
})
|
||||
.disabled(channelKeySize <= 0)
|
||||
Text(channelKey)
|
||||
.foregroundColor(Color.gray)
|
||||
.textSelection(.enabled)
|
||||
// TextField(
|
||||
// "",
|
||||
// text: $channelKey,
|
||||
// axis: .vertical
|
||||
// )
|
||||
// .foregroundColor(Color.gray)
|
||||
// .disabled(true)
|
||||
}
|
||||
Picker("Channel Role", selection: $channelRole) {
|
||||
if channelRole == 1 {
|
||||
|
|
@ -275,7 +256,7 @@ struct Channels: View {
|
|||
} label: {
|
||||
Label("save", systemImage: "square.and.arrow.down")
|
||||
}
|
||||
.disabled(bleManager.connectedPeripheral == nil || !hasChanges || !hasValidKey)
|
||||
.disabled(bleManager.connectedPeripheral == nil || !hasChanges)
|
||||
.buttonStyle(.bordered)
|
||||
.buttonBorderShape(.capsule)
|
||||
.controlSize(.large)
|
||||
|
|
|
|||
|
|
@ -71,8 +71,8 @@
|
|||
"device.role.clienthidden"=" Used for nodes that \"only speak when spoken to\" Turns all of the routine broadcasts but allows for ad-hoc communication. Still rebroadcasts, but with local only rebroadcast mode (known meshes only). Can be used for private operation or to dramatically reduce airtime / power consumption.";
|
||||
"device.role.clientmute"="Client Mute - Same as a client except packets will not hop over this node, does not contribute to routing packets for mesh.";
|
||||
"device.role.lostandfound"="Used to automatically send a text message to the mesh with the current position of the device on a frequent interval: \"I'm lost! Position: lat / long\"";
|
||||
"device.role.router"="Router - Mesh packets will prefer to be routed over this node. Assumes device will operate in a standalone manner while placed in a location with a coverage advantage. WARNING: The BLE/Wi-Fi radios and the OLED screen will be put to sleep.";
|
||||
"device.role.routerclient"="Router Client - Hybrid of the Client and Router roles. Similar to Router, except the Router Client can be used as both a Router and an app connected Client. BLE/Wi-Fi and OLED screen will not be put to sleep.";
|
||||
"device.role.router"="Router - Assumes device will operate in a standalone manner while placed in a location with a coverage advantage, not for mobile nodes. WARNING: The BLE/Wi-Fi radios and the OLED screen will be put to sleep.";
|
||||
"device.role.routerclient"="Router Client - Hybrid of the Client and Router roles. Similar to Router, except the Router Client can be used as both a Router and an app connected Client. Also not for mobile nodes. BLE/Wi-Fi and OLED screen will not be put to sleep.";
|
||||
"device.role.repeater"="Repeater - Mesh packets will prefer to be routed over this node. This role eliminates all features other than mesh routing, this node will not even appear as part of the network. Please see Rebroadcast Mode for additional settings specific to this role.";
|
||||
"device.role.tracker"="Tracker - For use with devices intended as a GPS tracker. Position packets sent from this device will be higher priority, with position broadcasting every two minutes. Smart Position Broadcast will default to off.";
|
||||
"device.role.tak"="Used for nodes dedicated for connection to an ATAK EUD. Turns off many of the routine broadcasts to favor CoT packet stream from the Meshtastic ATAK plugin -> IMeshService -> Node";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue