From f7bc8eed4b9223fcd5afdfb3cb678edd7bbec13c Mon Sep 17 00:00:00 2001 From: Patrick Ecord Date: Sun, 21 Jun 2026 01:49:35 -0500 Subject: [PATCH] clients: prefill a shared account so our devices auto-pair ("just us") MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Default the account to a shared identity (overridable, persisted in UserDefaults/prefs; agent via --account) instead of empty. With it prefilled, every one of our devices on the same network auto-pairs over the LAN regardless of room — no setup. Swapped in for the real Sign-in-with-Apple `sub` later. Verified with the live Mac app: it and an agent in a totally different room LAN-paired purely via the shared account. Co-Authored-By: Claude Opus 4.8 --- agent/src/main.rs | 2 +- android/app/src/main/java/io/pecord/tether/TetherStore.kt | 5 +++-- ios/MacTetherApp/Sources/MacTetherStore.swift | 5 ++++- ios/TetherApp/Sources/TetherStore.swift | 6 +++++- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/agent/src/main.rs b/agent/src/main.rs index dfd9266..0352963 100644 --- a/agent/src/main.rs +++ b/agent/src/main.rs @@ -58,7 +58,7 @@ fn main() { let host = std::env::var("HOSTNAME").unwrap_or_else(|_| "tether-agent".into()); let name = arg("--name", &host); // Shared identity: same-account devices pair on the LAN regardless of room. - let account = arg("--account", ""); + let account = arg("--account", "pecord@gmail.com"); eprintln!("tether-agent → {server} room={room} source={source}"); diff --git a/android/app/src/main/java/io/pecord/tether/TetherStore.kt b/android/app/src/main/java/io/pecord/tether/TetherStore.kt index e3da599..9a97f68 100644 --- a/android/app/src/main/java/io/pecord/tether/TetherStore.kt +++ b/android/app/src/main/java/io/pecord/tether/TetherStore.kt @@ -18,6 +18,7 @@ data class FeedItem(val text: String, val source: String, val ts: Long, val id: /// changes, so we auto-send via OnPrimaryClipChangedListener. class TetherStore(private val context: Context) { val serverURL = mutableStateOf(prefs().getString("serverURL", "https://tether.pecord.io")!!) + val account = mutableStateOf(prefs().getString("account", "pecord@gmail.com")!!) val room = mutableStateOf(RoomIdentity.derive(context)) val feed = mutableStateListOf() val connected = mutableStateOf(false) @@ -30,9 +31,9 @@ class TetherStore(private val context: Context) { private var counter = 0L fun connect() { - prefs().edit().putString("serverURL", serverURL.value).apply() + prefs().edit().putString("serverURL", serverURL.value).putString("account", account.value).apply() disconnect() - val e = Engine(serverURL.value.trim(), room.value, deviceId, "android", android.os.Build.MODEL, "") + val e = Engine(serverURL.value.trim(), room.value, deviceId, "android", android.os.Build.MODEL, account.value) e.start(Bridge()) engine = e connected.value = true diff --git a/ios/MacTetherApp/Sources/MacTetherStore.swift b/ios/MacTetherApp/Sources/MacTetherStore.swift index e62660c..b337042 100644 --- a/ios/MacTetherApp/Sources/MacTetherStore.swift +++ b/ios/MacTetherApp/Sources/MacTetherStore.swift @@ -17,6 +17,8 @@ struct FeedItem: Identifiable, Equatable { @MainActor @Observable final class MacTetherStore { var serverURL: String = UserDefaults.standard.string(forKey: "serverURL") ?? "https://tether.pecord.io" + // Prefilled shared identity — for now it's just us, so all devices pair. + var account: String = UserDefaults.standard.string(forKey: "account") ?? "pecord@gmail.com" var room: String = RoomIdentity.derive() var feed: [FeedItem] = [] var nearby: [Peer] = [] // tether devices on the LAN, for the picker @@ -45,10 +47,11 @@ final class MacTetherStore { } hasAttemptedConnect = true UserDefaults.standard.set(serverURL, forKey: "serverURL") + UserDefaults.standard.set(account, forKey: "account") disconnect() let b = EngineBridge(store: self) - let e = Engine(server: url, room: room, from: deviceID, source: "macos", name: deviceID, account: "") + let e = Engine(server: url, room: room, from: deviceID, source: "macos", name: deviceID, account: account) e.start(handler: b) engine = e bridge = b diff --git a/ios/TetherApp/Sources/TetherStore.swift b/ios/TetherApp/Sources/TetherStore.swift index 53bf0be..57874df 100644 --- a/ios/TetherApp/Sources/TetherStore.swift +++ b/ios/TetherApp/Sources/TetherStore.swift @@ -20,6 +20,9 @@ struct FeedItem: Identifiable, Equatable { @MainActor @Observable final class TetherStore { var serverURL: String = UserDefaults.standard.string(forKey: "serverURL") ?? "https://tether.pecord.io" + // Prefilled shared identity — for now it's just us, so all devices pair. + // Becomes the Sign-in-with-Apple `sub` once the dev program clears. + var account: String = UserDefaults.standard.string(forKey: "account") ?? "pecord@gmail.com" var room: String = RoomIdentity.derive() var feed: [FeedItem] = [] var connected = false @@ -41,10 +44,11 @@ final class TetherStore { return } UserDefaults.standard.set(serverURL, forKey: "serverURL") + UserDefaults.standard.set(account, forKey: "account") disconnect() let b = EngineBridge(store: self) - let e = Engine(server: url, room: room, from: deviceID, source: "ios", name: UIDevice.current.name, account: "") + let e = Engine(server: url, room: room, from: deviceID, source: "ios", name: UIDevice.current.name, account: account) e.start(handler: b) engine = e bridge = b