Remove WAN IP Detection
This commit is contained in:
parent
8ba86fe272
commit
0562b4cf6f
|
@ -1403,17 +1403,6 @@ namespace Emby.Server.Implementations
|
||||||
{
|
{
|
||||||
var localAddress = await GetLocalApiUrl(cancellationToken).ConfigureAwait(false);
|
var localAddress = await GetLocalApiUrl(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
string wanAddress;
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(ServerConfigurationManager.Configuration.WanDdns))
|
|
||||||
{
|
|
||||||
wanAddress = await GetWanApiUrlFromExternal(cancellationToken).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wanAddress = GetWanApiUrl(ServerConfigurationManager.Configuration.WanDdns);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new SystemInfo
|
return new SystemInfo
|
||||||
{
|
{
|
||||||
HasPendingRestart = HasPendingRestart,
|
HasPendingRestart = HasPendingRestart,
|
||||||
|
@ -1435,7 +1424,6 @@ namespace Emby.Server.Implementations
|
||||||
OperatingSystemDisplayName = OperatingSystem.Name,
|
OperatingSystemDisplayName = OperatingSystem.Name,
|
||||||
CanSelfRestart = CanSelfRestart,
|
CanSelfRestart = CanSelfRestart,
|
||||||
CanLaunchWebBrowser = CanLaunchWebBrowser,
|
CanLaunchWebBrowser = CanLaunchWebBrowser,
|
||||||
WanAddress = wanAddress,
|
|
||||||
HasUpdateAvailable = HasUpdateAvailable,
|
HasUpdateAvailable = HasUpdateAvailable,
|
||||||
TranscodingTempPath = ApplicationPaths.TranscodingTempPath,
|
TranscodingTempPath = ApplicationPaths.TranscodingTempPath,
|
||||||
ServerName = FriendlyName,
|
ServerName = FriendlyName,
|
||||||
|
@ -1457,24 +1445,12 @@ namespace Emby.Server.Implementations
|
||||||
{
|
{
|
||||||
var localAddress = await GetLocalApiUrl(cancellationToken).ConfigureAwait(false);
|
var localAddress = await GetLocalApiUrl(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
string wanAddress;
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(ServerConfigurationManager.Configuration.WanDdns))
|
|
||||||
{
|
|
||||||
wanAddress = await GetWanApiUrlFromExternal(cancellationToken).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wanAddress = GetWanApiUrl(ServerConfigurationManager.Configuration.WanDdns);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new PublicSystemInfo
|
return new PublicSystemInfo
|
||||||
{
|
{
|
||||||
Version = ApplicationVersion,
|
Version = ApplicationVersion,
|
||||||
ProductName = ApplicationProductName,
|
ProductName = ApplicationProductName,
|
||||||
Id = SystemId,
|
Id = SystemId,
|
||||||
OperatingSystem = OperatingSystem.Id.ToString(),
|
OperatingSystem = OperatingSystem.Id.ToString(),
|
||||||
WanAddress = wanAddress,
|
|
||||||
ServerName = FriendlyName,
|
ServerName = FriendlyName,
|
||||||
LocalAddress = localAddress
|
LocalAddress = localAddress
|
||||||
};
|
};
|
||||||
|
@ -1506,31 +1482,6 @@ namespace Emby.Server.Implementations
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<string> GetWanApiUrlFromExternal(CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
const string Url = "http://ipv4.icanhazip.com";
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using (var response = await HttpClient.Get(new HttpRequestOptions
|
|
||||||
{
|
|
||||||
Url = Url,
|
|
||||||
LogErrorResponseBody = false,
|
|
||||||
BufferContent = false,
|
|
||||||
CancellationToken = cancellationToken
|
|
||||||
}).ConfigureAwait(false))
|
|
||||||
{
|
|
||||||
string res = await response.ReadToEndAsync().ConfigureAwait(false);
|
|
||||||
return GetWanApiUrl(res.Trim());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Logger.LogError(ex, "Error getting WAN Ip address information");
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Removes the scope id from IPv6 addresses.
|
/// Removes the scope id from IPv6 addresses.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -8,12 +8,6 @@ namespace MediaBrowser.Model.System
|
||||||
/// <value>The local address.</value>
|
/// <value>The local address.</value>
|
||||||
public string LocalAddress { get; set; }
|
public string LocalAddress { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the wan address.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The wan address.</value>
|
|
||||||
public string WanAddress { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the name of the server.
|
/// Gets or sets the name of the server.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -25,7 +19,7 @@ namespace MediaBrowser.Model.System
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The version.</value>
|
/// <value>The version.</value>
|
||||||
public string Version { get; set; }
|
public string Version { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The product name. This is the AssemblyProduct name.
|
/// The product name. This is the AssemblyProduct name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user