mirror of
https://github.com/farcasclaudiu/openclaw.git
synced 2026-06-29 01:02:03 +03:00
Gateway: fix node invoke receive loop
This commit is contained in:
committed by
Mariano Belinky
parent
78f7e5147b
commit
84e115834f
@@ -11,6 +11,7 @@ enum GatewaySettingsStore {
|
||||
private static let manualHostDefaultsKey = "gateway.manual.host"
|
||||
private static let manualPortDefaultsKey = "gateway.manual.port"
|
||||
private static let manualTlsDefaultsKey = "gateway.manual.tls"
|
||||
private static let manualPasswordDefaultsKey = "gateway.manual.password"
|
||||
private static let discoveryDebugLogsDefaultsKey = "gateway.discovery.debugLogs"
|
||||
|
||||
private static let instanceIdAccount = "instanceId"
|
||||
@@ -21,6 +22,7 @@ enum GatewaySettingsStore {
|
||||
self.ensureStableInstanceID()
|
||||
self.ensurePreferredGatewayStableID()
|
||||
self.ensureLastDiscoveredGatewayStableID()
|
||||
self.ensureManualGatewayPassword()
|
||||
}
|
||||
|
||||
static func loadStableInstanceID() -> String? {
|
||||
@@ -174,4 +176,23 @@ enum GatewaySettingsStore {
|
||||
}
|
||||
}
|
||||
|
||||
private static func ensureManualGatewayPassword() {
|
||||
let defaults = UserDefaults.standard
|
||||
let instanceId = defaults.string(forKey: self.instanceIdDefaultsKey)?
|
||||
.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
|
||||
guard !instanceId.isEmpty else { return }
|
||||
|
||||
let manualPassword = defaults.string(forKey: self.manualPasswordDefaultsKey)?
|
||||
.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
|
||||
guard !manualPassword.isEmpty else { return }
|
||||
|
||||
if self.loadGatewayPassword(instanceId: instanceId) == nil {
|
||||
self.saveGatewayPassword(manualPassword, instanceId: instanceId)
|
||||
}
|
||||
|
||||
if self.loadGatewayPassword(instanceId: instanceId) == manualPassword {
|
||||
defaults.removeObject(forKey: self.manualPasswordDefaultsKey)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user