fix: use new interface in direct server

This commit is contained in:
Andrew Welker
2025-07-17 12:16:32 -05:00
parent c1eccfd790
commit 2bf0f2092b

View File

@@ -319,15 +319,19 @@ namespace PepperDash.Essentials.WebSocketServer
continue; continue;
} }
var ip = touchpanel.Touchpanel.ConnectedIps.Any(ipInfo => string ip = processorIp;
if (touchpanel.Touchpanel is IMobileControlCrestronTouchpanelController crestronTouchpanel)
{ {
if (System.Net.IPAddress.TryParse(ipInfo.DeviceIpAddress, out var parsedIp)) ip = crestronTouchpanel.ConnectedIps.Any(ipInfo =>
{ {
return csIpAddress.IsInSameSubnet(parsedIp, csSubnetMask); if (System.Net.IPAddress.TryParse(ipInfo.DeviceIpAddress, out var parsedIp))
} {
this.LogWarning("Invalid IP address: {deviceIpAddress}", ipInfo.DeviceIpAddress); return csIpAddress.IsInSameSubnet(parsedIp, csSubnetMask);
return false; }
}) ? csIpAddress.ToString() : processorIp; this.LogWarning("Invalid IP address: {deviceIpAddress}", ipInfo.DeviceIpAddress);
return false;
}) ? csIpAddress.ToString() : processorIp;
}
var appUrl = $"http://{ip}:{_parent.Config.DirectServer.Port}/mc/app?token={touchpanel.Key}"; var appUrl = $"http://{ip}:{_parent.Config.DirectServer.Port}/mc/app?token={touchpanel.Key}";