From 35642d1c54095bb0682dc6dcadb649b5ddf75b16 Mon Sep 17 00:00:00 2001 From: Siavash Sameni Date: Thu, 9 Apr 2026 12:19:46 +0400 Subject: [PATCH] feat(desktop): bake local Laptop relay into default relay list for testing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds 172.16.81.125:4433 (the laptop's LAN IP) as the first default relay so the Android rewrite can be tested against a relay whose logs are on the same host as the builds and screenshots. On fresh installs the Laptop relay is pre-selected as index 0. On upgrades from an older cached settings blob, a one-shot migration unshifts it to the front if missing, so we don't have to tap through Manage Relays after every reinstall. Marked "remove once Android rewrite is stable" — the address is a hardcoded LAN IP that won't be valid in other environments. Co-Authored-By: Claude Opus 4.6 (1M context) --- desktop/src/main.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/desktop/src/main.ts b/desktop/src/main.ts index 8cfb599..cc749c2 100644 --- a/desktop/src/main.ts +++ b/desktop/src/main.ts @@ -109,7 +109,12 @@ interface Settings { function loadSettings(): Settings { const defaults: Settings = { - relays: [{ name: "Default", address: "193.180.213.68:4433" }], + relays: [ + // Local laptop relay — used during Android rewrite testing so the phone + // and the relay logs are on the same host. Laptop IP on the test LAN. + { name: "Laptop", address: "172.16.81.125:4433" }, + { name: "Default", address: "193.180.213.68:4433" }, + ], selectedRelay: 0, room: "android", alias: "", osAec: true, agc: true, quality: "auto", recentRooms: [], }; @@ -126,6 +131,15 @@ function loadSettings(): Settings { const addr = parsed.relays?.[0]?.address || defaults.relays[0].address; parsed.recentRooms = parsed.recentRooms.map((r: string) => ({ relay: addr, room: r })); } + // Ensure the Laptop test relay is present as the first entry for + // existing installs — otherwise users with cached settings keep using + // the remote default and we have to manually add it each install. + // Remove this block once the Android rewrite is stable. + const LAPTOP_ADDR = "172.16.81.125:4433"; + if (Array.isArray(parsed.relays) && !parsed.relays.some((r: any) => r.address === LAPTOP_ADDR)) { + parsed.relays.unshift({ name: "Laptop", address: LAPTOP_ADDR }); + parsed.selectedRelay = 0; + } return { ...defaults, ...parsed }; } } catch {}