feat(desktop): bake local Laptop relay into default relay list for testing
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) <noreply@anthropic.com>
This commit is contained in:
@@ -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 {}
|
||||
|
||||
Reference in New Issue
Block a user