Unify remote address resolution so startup logging, primary remote URL selection, and /api/meta all consume the same server-side policy. Keep all external addresses user-visible, preserve stable interface ordering, and only de-prioritize link-local addresses when choosing the primary recommended remote URL. On the UI side, introduce a shared helper that keeps the first remote address visible by default and collapses the remaining addresses behind a reveal action, with i18n coverage and targeted tests for the new selection behavior.
15 lines
450 B
TypeScript
15 lines
450 B
TypeScript
import type { NetworkAddress } from "../../../server/src/api-types"
|
|
|
|
export interface RemoteAddressGroups {
|
|
recommended: NetworkAddress | null
|
|
hidden: NetworkAddress[]
|
|
}
|
|
|
|
export function splitRemoteAddresses(addresses: NetworkAddress[]): RemoteAddressGroups {
|
|
const remoteAddresses = addresses.filter((address) => address.scope !== "loopback")
|
|
return {
|
|
recommended: remoteAddresses[0] ?? null,
|
|
hidden: remoteAddresses.slice(1),
|
|
}
|
|
}
|