fixed webpage access
This commit is contained in:
parent
c637c0f999
commit
26bca745e6
@ -52,6 +52,14 @@ function safeFile(requestUrl) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tailscale and similar VPN tunnels show up as extra "LAN" interfaces but are not
|
||||||
|
// useful for an in-room demo, so keep them out of the printed URL list.
|
||||||
|
function isTunnelInterface(interfaceName, address) {
|
||||||
|
if (/^(utun|tailscale|tun|ppp|ipsec)/i.test(interfaceName)) return true;
|
||||||
|
const [first, second] = address.split(".").map(Number);
|
||||||
|
return first === 100 && second >= 64 && second <= 127; // 100.64.0.0/10 (CGNAT/tailnet)
|
||||||
|
}
|
||||||
|
|
||||||
function displayUrls(host, port) {
|
function displayUrls(host, port) {
|
||||||
if (host !== "0.0.0.0") {
|
if (host !== "0.0.0.0") {
|
||||||
const displayHost = host === "::" ? "::1" : host;
|
const displayHost = host === "::" ? "::1" : host;
|
||||||
@ -64,6 +72,7 @@ function displayUrls(host, port) {
|
|||||||
for (const [interfaceName, addresses] of Object.entries(networkInterfaces())) {
|
for (const [interfaceName, addresses] of Object.entries(networkInterfaces())) {
|
||||||
for (const address of addresses || []) {
|
for (const address of addresses || []) {
|
||||||
if (address.family !== "IPv4" || address.internal || seen.has(address.address)) continue;
|
if (address.family !== "IPv4" || address.internal || seen.has(address.address)) continue;
|
||||||
|
if (isTunnelInterface(interfaceName, address.address)) continue;
|
||||||
seen.add(address.address);
|
seen.add(address.address);
|
||||||
entries.push({
|
entries.push({
|
||||||
label: `Other devices (${interfaceName})`,
|
label: `Other devices (${interfaceName})`,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user