( host: string, port: number, token: string | undefined, networkAddresses?: NetworkAddress[], )
| 60 | * - specific host: a single `URL:` line. |
| 61 | */ |
| 62 | export function accessUrlLines( |
| 63 | host: string, |
| 64 | port: number, |
| 65 | token: string | undefined, |
| 66 | networkAddresses?: NetworkAddress[], |
| 67 | ): AccessUrlLine[] { |
| 68 | if (isWildcard(host)) { |
| 69 | const lines: AccessUrlLine[] = [ |
| 70 | { label: 'Local: ', url: buildOpenableUrl(`http://localhost:${port}`, token) }, |
| 71 | ]; |
| 72 | const addrs = networkAddresses ?? listNetworkAddresses(); |
| 73 | for (const addr of addrs) { |
| 74 | lines.push({ |
| 75 | label: 'Network: ', |
| 76 | url: buildOpenableUrl(`http://${formatHostForUrl(addr.address, addr.family)}:${port}`, token), |
| 77 | }); |
| 78 | } |
| 79 | return lines; |
| 80 | } |
| 81 | if (isLoopbackHost(host)) { |
| 82 | return [{ label: 'Local: ', url: buildOpenableUrl(hostOrigin(host, port), token) }]; |
| 83 | } |
| 84 | return [{ label: 'URL: ', url: buildOpenableUrl(hostOrigin(host, port), token) }]; |
| 85 | } |
no test coverage detected