Skip to content

Commit 2ef92d0

Browse files
authored
feat: cookie sync from Mac to a remote Gateway browser profile (#123494)
* feat(browser): sync system cookies to a remote gateway profile Add `openclaw browser cookie-sync`: decrypt allowlisted macOS Chrome-family cookies locally and push them into a managed profile on a possibly-remote Gateway over the existing operator channel. --watch re-syncs on cookie-DB changes with a single Keychain prompt per session. - New POST /cookies/set-many batch route (mirrors /cookies/set) - Extract one canonical readSystemProfileCookies reused by import + sync - Mandatory domain allowlist (never syncs an unrestricted cookie jar) - Decryption stays host-local (macOS); no cookie values are logged * feat(macos): cookie sync checkbox and configuration UI Add an off-by-default 'Cookie sync' section (Settings > General): a toggle, an editable domain allowlist editor, and a target-profile field, actionable only in remote-gateway mode. CookieSyncManager supervises `openclaw browser cookie-sync --watch` against the connected Gateway when enabled, resolving a LOCAL CLI (never the SSH-redirect path, since decryption is host-local) and injecting gateway URL + token/password via environment, never argv. A status row surfaces running/stopped/error and the last sync summary. * fix(macos): satisfy cookie sync lint gates * chore(i18n): register cookie sync native source strings Regenerate apps/.i18n/native-source.json baseline for the new macOS Cookie sync settings strings (additive only). Satisfies the native:i18n:verify gate; generated locale artifacts are refreshed separately by the locale-refresh job.
1 parent f8e6c6b commit 2ef92d0

17 files changed

Lines changed: 1605 additions & 100 deletions

‎apps/.i18n/native-source.json‎

Lines changed: 152 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import Foundation
2+
3+
extension AppState {
4+
static var preview: AppState {
5+
let state = AppState(preview: true)
6+
state.isPaused = false
7+
state.launchAtLogin = true
8+
state.onboardingSeen = true
9+
state.debugPaneEnabled = true
10+
state.nativeSettingsPanesEnabled = true
11+
state.swabbleEnabled = true
12+
state.swabbleTriggerWords = ["Claude", "Computer", "Jarvis"]
13+
state.voiceWakeTriggerChime = .system(name: "Glass")
14+
state.voiceWakeSendChime = .system(name: "Ping")
15+
state.iconAnimationsEnabled = true
16+
state.showDockIcon = true
17+
state.voiceWakeMicID = "BuiltInMic"
18+
state.voiceWakeMicName = "Built-in Microphone"
19+
state.voiceWakeLocaleID = Locale.current.identifier
20+
state.voiceWakeAdditionalLocaleIDs = ["en-US", "de-DE"]
21+
state.voicePushToTalkEnabled = false
22+
state.talkEnabled = false
23+
state.talkPhaseSoundsEnabled = true
24+
state.talkShiftToStopEnabled = true
25+
state.iconOverride = .system
26+
state.heartbeatsEnabled = true
27+
state.connectionMode = .local
28+
state.remoteTransport = .ssh
29+
state.canvasEnabled = true
30+
state.quickChatEnabled = true
31+
state.cookieSyncEnabled = false
32+
state.cookieSyncIntoProfile = "imported"
33+
state.cookieSyncDomains = []
34+
state.remoteTarget = "[email protected]"
35+
state.remoteUrl = "wss://gateway.example.ts.net"
36+
state.remoteToken = "example-token"
37+
state.remoteIdentity = "~/.ssh/id_ed25519"
38+
state.remoteProjectRoot = "~/Projects/openclaw"
39+
state.remoteCliPath = ""
40+
return state
41+
}
42+
}

‎apps/macos/Sources/OpenClaw/AppState.swift‎

Lines changed: 27 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,26 @@ final class AppState {
328328
didSet { self.ifNotPreview { AppDefaults.standard.set(self.quickChatEnabled, forKey: quickChatEnabledKey) } }
329329
}
330330

331+
var cookieSyncEnabled: Bool {
332+
didSet {
333+
self.ifNotPreview { AppDefaults.standard.set(self.cookieSyncEnabled, forKey: cookieSyncEnabledKey) }
334+
}
335+
}
336+
337+
var cookieSyncIntoProfile: String {
338+
didSet {
339+
self.ifNotPreview {
340+
AppDefaults.standard.set(self.cookieSyncIntoProfile, forKey: cookieSyncIntoProfileKey)
341+
}
342+
}
343+
}
344+
345+
var cookieSyncDomains: [String] {
346+
didSet {
347+
self.ifNotPreview { AppDefaults.standard.set(self.cookieSyncDomains, forKey: cookieSyncDomainsKey) }
348+
}
349+
}
350+
331351
var activeComputerPresenceEnabled: Bool {
332352
didSet { self.scheduleActiveComputerPresenceUpdate() }
333353
}
@@ -557,6 +577,7 @@ final class AppState {
557577
self.remoteCliPath = AppDefaults.standard.string(forKey: remoteCliPathKey)?.nonEmpty ?? ""
558578
self.canvasEnabled = AppDefaults.standard.object(forKey: canvasEnabledKey) as? Bool ?? true
559579
self.quickChatEnabled = AppDefaults.standard.object(forKey: quickChatEnabledKey) as? Bool ?? true
580+
(self.cookieSyncEnabled, self.cookieSyncIntoProfile, self.cookieSyncDomains) = Self.loadCookieSyncDefaults()
560581
self.activeComputerPresenceEnabled = Self.resolveActiveComputerPresenceEnabled()
561582
self.execApprovalMode = .deny
562583
self.execApprovalPolicyLoadState = .loading
@@ -1521,44 +1542,14 @@ extension AppState {
15211542
}
15221543

15231544
extension AppState {
1524-
static var preview: AppState {
1525-
let state = AppState(preview: true)
1526-
state.isPaused = false
1527-
state.launchAtLogin = true
1528-
state.onboardingSeen = true
1529-
state.debugPaneEnabled = true
1530-
state.nativeSettingsPanesEnabled = true
1531-
state.swabbleEnabled = true
1532-
state.swabbleTriggerWords = ["Claude", "Computer", "Jarvis"]
1533-
state.voiceWakeTriggerChime = .system(name: "Glass")
1534-
state.voiceWakeSendChime = .system(name: "Ping")
1535-
state.iconAnimationsEnabled = true
1536-
state.showDockIcon = true
1537-
state.voiceWakeMicID = "BuiltInMic"
1538-
state.voiceWakeMicName = "Built-in Microphone"
1539-
state.voiceWakeLocaleID = Locale.current.identifier
1540-
state.voiceWakeAdditionalLocaleIDs = ["en-US", "de-DE"]
1541-
state.voicePushToTalkEnabled = false
1542-
state.talkEnabled = false
1543-
state.talkPhaseSoundsEnabled = true
1544-
state.talkShiftToStopEnabled = true
1545-
state.iconOverride = .system
1546-
state.heartbeatsEnabled = true
1547-
state.connectionMode = .local
1548-
state.remoteTransport = .ssh
1549-
state.canvasEnabled = true
1550-
state.quickChatEnabled = true
1551-
state.remoteTarget = "[email protected]"
1552-
state.remoteUrl = "wss://gateway.example.ts.net"
1553-
state.remoteToken = "example-token"
1554-
state.remoteIdentity = "~/.ssh/id_ed25519"
1555-
state.remoteProjectRoot = "~/Projects/openclaw"
1556-
state.remoteCliPath = ""
1557-
return state
1545+
private static func loadCookieSyncDefaults() -> (Bool, String, [String]) {
1546+
let defaults = AppDefaults.standard
1547+
return (
1548+
defaults.object(forKey: cookieSyncEnabledKey) as? Bool ?? false,
1549+
defaults.string(forKey: cookieSyncIntoProfileKey) ?? "imported",
1550+
defaults.stringArray(forKey: cookieSyncDomainsKey) ?? [])
15581551
}
1559-
}
15601552

1561-
extension AppState {
15621553
static func resolveActiveComputerPresenceEnabled(defaults: UserDefaults = AppDefaults.standard) -> Bool {
15631554
defaults.bool(forKey: activeComputerPresenceEnabledKey)
15641555
}

‎apps/macos/Sources/OpenClaw/Constants.swift‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ let canvasEnabledKey = "openclaw.canvasEnabled"
4343
let quickChatEnabledKey = "openclaw.quickChatEnabled"
4444
let cameraEnabledKey = "openclaw.cameraEnabled"
4545
let computerControlEnabledKey = "openclaw.computerControlEnabled"
46+
let cookieSyncEnabledKey = "openclaw.cookieSyncEnabled"
47+
let cookieSyncIntoProfileKey = "openclaw.cookieSyncIntoProfile"
48+
let cookieSyncDomainsKey = "openclaw.cookieSyncDomains"
4649

4750
func isComputerControlEnabled(defaults: UserDefaults = AppDefaults.standard) -> Bool {
4851
// object(forKey:) preserves an explicit false; bool(forKey:) would conflate it with an unset default.

0 commit comments

Comments
 (0)