mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
WAN Address should use public ports instead of local ports.
https://github.com/jellyfin/jellyfin/issues/601#issuecomment-475941080
This commit is contained in:
parent
0e787f4e9f
commit
414a318a0d
@ -1476,7 +1476,7 @@ namespace Emby.Server.Implementations
|
|||||||
CancellationToken = cancellationToken
|
CancellationToken = cancellationToken
|
||||||
}).ConfigureAwait(false))
|
}).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
return GetLocalApiUrl(response.ReadToEnd().Trim());
|
return GetWanApiUrl(response.ReadToEnd().Trim());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -1493,14 +1493,43 @@ namespace Emby.Server.Implementations
|
|||||||
return GetLocalApiUrl("[" + ipAddress.Address + "]");
|
return GetLocalApiUrl("[" + ipAddress.Address + "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetLocalApiUrl(ipAddress.Address);
|
return GetLocalApiUrlWithPort(ipAddress.Address);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetLocalApiUrl(string host)
|
public string GetLocalApiUrlWithPort(string host)
|
||||||
{
|
{
|
||||||
|
if (EnableHttps)
|
||||||
|
{
|
||||||
|
return string.Format("http://{0}:{1}",
|
||||||
|
host,
|
||||||
|
HttpsPort.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
return string.Format("http://{0}:{1}",
|
return string.Format("http://{0}:{1}",
|
||||||
host,
|
host,
|
||||||
HttpPort.ToString(CultureInfo.InvariantCulture));
|
HttpPort.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetWanApiUrl(IpAddressInfo ipAddress)
|
||||||
|
{
|
||||||
|
if (ipAddress.AddressFamily == IpAddressFamily.InterNetworkV6)
|
||||||
|
{
|
||||||
|
return GetLocalApiUrl("[" + ipAddress.Address + "]");
|
||||||
|
}
|
||||||
|
|
||||||
|
return GetWanApiUrlWithPort(ipAddress.Address);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetWanApiUrlWithPort(string host)
|
||||||
|
{
|
||||||
|
if (EnableHttps)
|
||||||
|
{
|
||||||
|
return string.Format("http://{0}:{1}",
|
||||||
|
host,
|
||||||
|
ServerConfiguration.PublicHttpsPort.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
return string.Format("http://{0}:{1}",
|
||||||
|
host,
|
||||||
|
ServerConfiguration.PublicPort.ToString(CultureInfo.InvariantCulture));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<List<IpAddressInfo>> GetLocalIpAddresses(CancellationToken cancellationToken)
|
public Task<List<IpAddressInfo>> GetLocalIpAddresses(CancellationToken cancellationToken)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user