Let the person choose and keep the LAN address friends connect to

Sharing on the local network used to take whatever address the Manager found
first, which is often a virtual adapter. The Friends page now lists the usable
IPv4 addresses of the computer (the automatic one marked) and accepts a custom
one. The choice is kept independently of the sharing mode, so it survives
restarts and switching to other modes. A chosen address that is not available
is reported instead of silently switching to another adapter.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ДмитрийandClaude Sonnet 5.5 committed 2026-10-07 06:44:34 +05:00
1 parent 3f700ee8f4
commit 8490dc9983
14 files changed
+292 -17

No files matched your search

+10 -3
View File
@@ -348,9 +348,16 @@ export interface ClientDownloadCheck {
export type FriendsMode = "local" | "lan" | "direct" | "private";
export interface LanAddress {
interface: string;
address: string;
is_default: boolean;
}
export interface FriendsStatus {
settings: { mode: FriendsMode; host: string | null };
settings: { mode: FriendsMode; host: string | null; lan_address_override: string | null };
lan_ip: string | null;
lan_addresses: LanAddress[];
exposure: { port: number; what: string; reachable_from_network: boolean; listening: boolean }[];
servers_open: boolean;
firewall: { auth: boolean; world: boolean };
@@ -456,8 +463,8 @@ export const api = {
play: (id: string) => invoke<DriverOutcome>("play", { id }),
friendsStatus: (id: string) => invoke<FriendsStatus>("friends_status", { id }),
friendsCheckInternet: () => invoke<InternetCheck>("friends_check_internet"),
friendsEnable: (id: string, mode: FriendsMode, host?: string, useUpnp = false) =>
invoke<{ host: string; restart_required: boolean; note: string | null }>("friends_enable", { id, mode, host: host ?? null, useUpnp }),
friendsEnable: (id: string, mode: FriendsMode, host?: string, useUpnp = false, lanAddressOverride: string | null = null) =>
invoke<{ host: string; restart_required: boolean; note: string | null }>("friends_enable", { id, mode, host: host ?? null, useUpnp, lanAddressOverride }),
friendsPackage: (id: string) => invoke<string>("friends_package", { id }),
runDiagnostics: (id: string) => invoke<{ checks: DiagCheck[]; problems: number }>("run_diagnostics", { id }),
verifyFiles: (id: string) => invoke<{ path: string; kind: "missing" | "changed" }[]>("verify_files", { id }),