|
|
@ -1962,6 +1962,7 @@ namespace Emby.Server.Implementations
|
|
|
|
public async Task<SystemInfo> GetSystemInfo(CancellationToken cancellationToken)
|
|
|
|
public async Task<SystemInfo> GetSystemInfo(CancellationToken cancellationToken)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var localAddress = await GetLocalApiUrl(cancellationToken).ConfigureAwait(false);
|
|
|
|
var localAddress = await GetLocalApiUrl(cancellationToken).ConfigureAwait(false);
|
|
|
|
|
|
|
|
var wanAddress = await GetWanApiUrl(cancellationToken).ConfigureAwait(false);
|
|
|
|
|
|
|
|
|
|
|
|
return new SystemInfo
|
|
|
|
return new SystemInfo
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1984,8 +1985,7 @@ namespace Emby.Server.Implementations
|
|
|
|
CanSelfRestart = CanSelfRestart,
|
|
|
|
CanSelfRestart = CanSelfRestart,
|
|
|
|
CanSelfUpdate = CanSelfUpdate,
|
|
|
|
CanSelfUpdate = CanSelfUpdate,
|
|
|
|
CanLaunchWebBrowser = CanLaunchWebBrowser,
|
|
|
|
CanLaunchWebBrowser = CanLaunchWebBrowser,
|
|
|
|
// TODO - remove WanAddress
|
|
|
|
WanAddress = wanAddress,
|
|
|
|
WanAddress = "0.0.0.0",
|
|
|
|
|
|
|
|
HasUpdateAvailable = HasUpdateAvailable,
|
|
|
|
HasUpdateAvailable = HasUpdateAvailable,
|
|
|
|
SupportsAutoRunAtStartup = SupportsAutoRunAtStartup,
|
|
|
|
SupportsAutoRunAtStartup = SupportsAutoRunAtStartup,
|
|
|
|
TranscodingTempPath = ApplicationPaths.TranscodingTempPath,
|
|
|
|
TranscodingTempPath = ApplicationPaths.TranscodingTempPath,
|
|
|
@ -2012,14 +2012,13 @@ namespace Emby.Server.Implementations
|
|
|
|
public async Task<PublicSystemInfo> GetPublicSystemInfo(CancellationToken cancellationToken)
|
|
|
|
public async Task<PublicSystemInfo> GetPublicSystemInfo(CancellationToken cancellationToken)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var localAddress = await GetLocalApiUrl(cancellationToken).ConfigureAwait(false);
|
|
|
|
var localAddress = await GetLocalApiUrl(cancellationToken).ConfigureAwait(false);
|
|
|
|
|
|
|
|
var wanAddress = await GetWanApiUrl(cancellationToken).ConfigureAwait(false);
|
|
|
|
return new PublicSystemInfo
|
|
|
|
return new PublicSystemInfo
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Version = ApplicationVersion.ToString(),
|
|
|
|
Version = ApplicationVersion.ToString(),
|
|
|
|
Id = SystemId,
|
|
|
|
Id = SystemId,
|
|
|
|
OperatingSystem = EnvironmentInfo.OperatingSystem.ToString(),
|
|
|
|
OperatingSystem = EnvironmentInfo.OperatingSystem.ToString(),
|
|
|
|
// TODO - remove WanAddress
|
|
|
|
WanAddress = wanAddress,
|
|
|
|
WanAddress = "0.0.0.0",
|
|
|
|
|
|
|
|
ServerName = FriendlyName,
|
|
|
|
ServerName = FriendlyName,
|
|
|
|
LocalAddress = localAddress
|
|
|
|
LocalAddress = localAddress
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -2060,6 +2059,32 @@ namespace Emby.Server.Implementations
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public async Task<string> GetWanApiUrl(CancellationToken cancellationToken)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var url = "http://ipv4.icanhazip.com";
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
using (var response = await HttpClient.Get(new HttpRequestOptions
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Url = url,
|
|
|
|
|
|
|
|
LogErrorResponseBody = false,
|
|
|
|
|
|
|
|
LogErrors = false,
|
|
|
|
|
|
|
|
LogRequest = false,
|
|
|
|
|
|
|
|
TimeoutMs = 10000,
|
|
|
|
|
|
|
|
BufferContent = false,
|
|
|
|
|
|
|
|
CancellationToken = cancellationToken
|
|
|
|
|
|
|
|
}))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return GetLocalApiUrl(response.ReadToEnd().Trim());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch(Exception ex)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Logger.ErrorException("Error getting WAN Ip address information", ex);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public string GetLocalApiUrl(IpAddressInfo ipAddress)
|
|
|
|
public string GetLocalApiUrl(IpAddressInfo ipAddress)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (ipAddress.AddressFamily == IpAddressFamily.InterNetworkV6)
|
|
|
|
if (ipAddress.AddressFamily == IpAddressFamily.InterNetworkV6)
|
|
|
|