desktop mobile QR fixes (#6069)

This commit is contained in:
Anthony Stirling
2026-04-15 13:21:45 +01:00
committed by GitHub
parent 2bf5f0b18e
commit 07b7c991f0
2 changed files with 32 additions and 1 deletions

View File

@@ -1183,4 +1183,25 @@ public class GeneralUtils {
}
}
}
public String getLocalNetworkIp() {
try {
Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
if (interfaces == null) return null;
while (interfaces.hasMoreElements()) {
NetworkInterface iface = interfaces.nextElement();
if (!iface.isUp() || iface.isLoopback() || iface.isVirtual()) continue;
Enumeration<InetAddress> addresses = iface.getInetAddresses();
while (addresses.hasMoreElements()) {
InetAddress addr = addresses.nextElement();
if (addr instanceof Inet4Address && addr.isSiteLocalAddress()) {
return addr.getHostAddress();
}
}
}
} catch (Exception e) {
log.warn("Failed to detect local network IP", e);
}
return null;
}
}