mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-30 01:38:38 +00:00
refactor(macos): dedupe UI, pairing, and runtime helpers
This commit is contained in:
@@ -23,17 +23,17 @@ struct WizardCliOptions {
|
||||
case "--json":
|
||||
opts.json = true
|
||||
case "--url":
|
||||
opts.url = self.nextValue(args, index: &i)
|
||||
opts.url = CLIArgParsingSupport.nextValue(args, index: &i)
|
||||
case "--token":
|
||||
opts.token = self.nextValue(args, index: &i)
|
||||
opts.token = CLIArgParsingSupport.nextValue(args, index: &i)
|
||||
case "--password":
|
||||
opts.password = self.nextValue(args, index: &i)
|
||||
opts.password = CLIArgParsingSupport.nextValue(args, index: &i)
|
||||
case "--mode":
|
||||
if let value = nextValue(args, index: &i) {
|
||||
if let value = CLIArgParsingSupport.nextValue(args, index: &i) {
|
||||
opts.mode = value
|
||||
}
|
||||
case "--workspace":
|
||||
opts.workspace = self.nextValue(args, index: &i)
|
||||
opts.workspace = CLIArgParsingSupport.nextValue(args, index: &i)
|
||||
default:
|
||||
break
|
||||
}
|
||||
@@ -41,12 +41,6 @@ struct WizardCliOptions {
|
||||
}
|
||||
return opts
|
||||
}
|
||||
|
||||
private static func nextValue(_ args: [String], index: inout Int) -> String? {
|
||||
guard index + 1 < args.count else { return nil }
|
||||
index += 1
|
||||
return args[index].trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
}
|
||||
}
|
||||
|
||||
enum WizardCliError: Error, CustomStringConvertible {
|
||||
@@ -338,8 +332,7 @@ actor GatewayWizardClient {
|
||||
let frame = try await self.decodeFrame(message)
|
||||
if case let .event(evt) = frame, evt.event == "connect.challenge",
|
||||
let payload = evt.payload?.value as? [String: ProtoAnyCodable],
|
||||
let nonce = payload["nonce"]?.value as? String,
|
||||
nonce.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty == false
|
||||
let nonce = GatewayConnectChallengeSupport.nonce(from: payload)
|
||||
{
|
||||
return nonce
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user