Skip to content

Commit

Permalink
v1.4.0-beta.43
Browse files Browse the repository at this point in the history
- Fixes wrong IP address (127.0.x.x) reported on local UPnP service info
  • Loading branch information
genemars committed Aug 30, 2023
1 parent d352c73 commit e63f9db
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions src/HomeGenie/Service/HomeGenieService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1466,7 +1466,7 @@ private void SetupUpnp()
host = Dns.GetHostEntry(Dns.GetHostName());
foreach (var ip in host.AddressList)
{
if (ip.AddressFamily == AddressFamily.InterNetwork)
if (ip.AddressFamily == AddressFamily.InterNetwork && !ip.ToString().StartsWith("127.") && !ip.ToString().StartsWith("::1"))
{
localIP = ip.ToString();
break;
Expand All @@ -1481,18 +1481,23 @@ private void SetupUpnp()
}
//
string presentationUrl = "http://" + address + ":" + bindport;
//string friendlyName = "HomeGenie: " + Environment.MachineName;
string manufacturer = "G-Labs";
string manufacturerUrl = "http://genielabs.github.io/HomeGenie/";
string manufacturerUrl = "https://github.com/genielabs";
string modelName = "HomeGenie";
string modelDescription = "HomeGenie Home Automation Server";
//string modelURL = "https://homegenie.it/";
string modelNumber = "HG-1";
string modelDescription = "HomeGenie Automation Server";
string friendlyName = modelName + ": " + Environment.MachineName;
string modelUrl = "https://homegenie.it/";
string version = "1";
if (updateChecker.GetCurrentRelease() != null)
{
version = updateChecker.GetCurrentRelease().Version;
}
string modelNumber = "HG-" + version;
string standardDeviceType = "HomeAutomationServer";
string uniqueDeviceName = systemConfiguration.HomeGenie.GUID;
if (String.IsNullOrEmpty(uniqueDeviceName))
{
systemConfiguration.HomeGenie.GUID = uniqueDeviceName = System.Guid.NewGuid().ToString();
systemConfiguration.HomeGenie.GUID = uniqueDeviceName = Guid.NewGuid().ToString();
systemConfiguration.Update();
}
//
Expand All @@ -1503,14 +1508,14 @@ private void SetupUpnp()
localDevice.HasPresentation = true;
localDevice.PresentationURL = presentationUrl;
}
localDevice.FriendlyName = modelName + ": " + Environment.MachineName;
localDevice.FriendlyName = friendlyName;
localDevice.Manufacturer = manufacturer;
localDevice.ManufacturerURL = manufacturerUrl;
localDevice.ModelName = modelName;
localDevice.ModelDescription = modelDescription;
if (Uri.IsWellFormedUriString(manufacturerUrl, UriKind.Absolute))
if (Uri.IsWellFormedUriString(modelUrl, UriKind.Absolute))
{
localDevice.ModelURL = new Uri(manufacturerUrl);
localDevice.ModelURL = new Uri(modelUrl);
}
localDevice.ModelNumber = modelNumber;
localDevice.StandardDeviceType = standardDeviceType;
Expand Down

0 comments on commit e63f9db

Please sign in to comment.