refactor(server): centralize remote address selection
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.
This commit is contained in:
14
packages/ui/src/lib/remote-access-addresses.ts
Normal file
14
packages/ui/src/lib/remote-access-addresses.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
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),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user