mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Ignore published server url for local access
This commit is contained in:
parent
be9663ae89
commit
153e920239
@ -1135,12 +1135,6 @@ namespace Emby.Server.Implementations
|
|||||||
}
|
}
|
||||||
|
|
||||||
string smart = NetManager.GetBindInterface(remoteAddr, out port);
|
string smart = NetManager.GetBindInterface(remoteAddr, out port);
|
||||||
// If the smartAPI doesn't start with http then treat it as a host or ip.
|
|
||||||
if (smart.StartsWith("http", StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return smart.Trim('/');
|
|
||||||
}
|
|
||||||
|
|
||||||
return GetLocalApiUrl(smart.Trim('/'), null, port);
|
return GetLocalApiUrl(smart.Trim('/'), null, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1155,12 +1149,6 @@ namespace Emby.Server.Implementations
|
|||||||
}
|
}
|
||||||
|
|
||||||
string smart = NetManager.GetBindInterface(request, out port);
|
string smart = NetManager.GetBindInterface(request, out port);
|
||||||
// If the smartAPI doesn't start with http then treat it as a host or ip.
|
|
||||||
if (smart.StartsWith("http", StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return smart.Trim('/');
|
|
||||||
}
|
|
||||||
|
|
||||||
return GetLocalApiUrl(smart.Trim('/'), request.Scheme, port);
|
return GetLocalApiUrl(smart.Trim('/'), request.Scheme, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1175,22 +1163,25 @@ namespace Emby.Server.Implementations
|
|||||||
}
|
}
|
||||||
|
|
||||||
string smart = NetManager.GetBindInterface(hostname, out port);
|
string smart = NetManager.GetBindInterface(hostname, out port);
|
||||||
|
|
||||||
// If the smartAPI doesn't start with http then treat it as a host or ip.
|
|
||||||
if (smart.StartsWith("http", StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return smart.Trim('/');
|
|
||||||
}
|
|
||||||
|
|
||||||
return GetLocalApiUrl(smart.Trim('/'), null, port);
|
return GetLocalApiUrl(smart.Trim('/'), null, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string GetUrlForUseByHttpApi() => GetSmartApiUrl(string.Empty);
|
public string GetApiUrlForLocalAccess()
|
||||||
|
{
|
||||||
|
string smart = NetManager.GetBindInterface(string.Empty, out var port);
|
||||||
|
return GetLocalApiUrl(smart.Trim('/'), null, port);
|
||||||
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string GetLocalApiUrl(string hostname, string scheme = null, int? port = null)
|
public string GetLocalApiUrl(string hostname, string scheme = null, int? port = null)
|
||||||
{
|
{
|
||||||
|
// If the smartAPI doesn't start with http then treat it as a host or ip.
|
||||||
|
if (hostname.StartsWith("http", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return hostname.TrimEnd('/');
|
||||||
|
}
|
||||||
|
|
||||||
// NOTE: If no BaseUrl is set then UriBuilder appends a trailing slash, but if there is no BaseUrl it does
|
// NOTE: If no BaseUrl is set then UriBuilder appends a trailing slash, but if there is no BaseUrl it does
|
||||||
// not. For consistency, always trim the trailing slash.
|
// not. For consistency, always trim the trailing slash.
|
||||||
return new UriBuilder
|
return new UriBuilder
|
||||||
|
@ -1027,7 +1027,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||||||
{
|
{
|
||||||
var stream = new MediaSourceInfo
|
var stream = new MediaSourceInfo
|
||||||
{
|
{
|
||||||
EncoderPath = _appHost.GetUrlForUseByHttpApi() + "/LiveTv/LiveRecordings/" + info.Id + "/stream",
|
EncoderPath = _appHost.GetApiUrlForLocalAccess() + "/LiveTv/LiveRecordings/" + info.Id + "/stream",
|
||||||
EncoderProtocol = MediaProtocol.Http,
|
EncoderProtocol = MediaProtocol.Http,
|
||||||
Path = info.Path,
|
Path = info.Path,
|
||||||
Protocol = MediaProtocol.File,
|
Protocol = MediaProtocol.File,
|
||||||
|
@ -104,7 +104,7 @@ namespace Emby.Server.Implementations.LiveTv
|
|||||||
// Dummy this up so that direct play checks can still run
|
// Dummy this up so that direct play checks can still run
|
||||||
if (string.IsNullOrEmpty(source.Path) && source.Protocol == MediaProtocol.Http)
|
if (string.IsNullOrEmpty(source.Path) && source.Protocol == MediaProtocol.Http)
|
||||||
{
|
{
|
||||||
source.Path = _appHost.GetUrlForUseByHttpApi();
|
source.Path = _appHost.GetApiUrlForLocalAccess();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
|||||||
// OpenedMediaSource.Path = tempFile;
|
// OpenedMediaSource.Path = tempFile;
|
||||||
// OpenedMediaSource.ReadAtNativeFramerate = true;
|
// OpenedMediaSource.ReadAtNativeFramerate = true;
|
||||||
|
|
||||||
MediaSource.Path = _appHost.GetUrlForUseByHttpApi() + "/LiveTv/LiveStreamFiles/" + UniqueId + "/stream.ts";
|
MediaSource.Path = _appHost.GetApiUrlForLocalAccess() + "/LiveTv/LiveStreamFiles/" + UniqueId + "/stream.ts";
|
||||||
MediaSource.Protocol = MediaProtocol.Http;
|
MediaSource.Protocol = MediaProtocol.Http;
|
||||||
// OpenedMediaSource.SupportsDirectPlay = false;
|
// OpenedMediaSource.SupportsDirectPlay = false;
|
||||||
// OpenedMediaSource.SupportsDirectStream = true;
|
// OpenedMediaSource.SupportsDirectStream = true;
|
||||||
|
@ -97,7 +97,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
|||||||
// OpenedMediaSource.Path = tempFile;
|
// OpenedMediaSource.Path = tempFile;
|
||||||
// OpenedMediaSource.ReadAtNativeFramerate = true;
|
// OpenedMediaSource.ReadAtNativeFramerate = true;
|
||||||
|
|
||||||
MediaSource.Path = _appHost.GetUrlForUseByHttpApi() + "/LiveTv/LiveStreamFiles/" + UniqueId + "/stream.ts";
|
MediaSource.Path = _appHost.GetApiUrlForLocalAccess() + "/LiveTv/LiveStreamFiles/" + UniqueId + "/stream.ts";
|
||||||
MediaSource.Protocol = MediaProtocol.Http;
|
MediaSource.Protocol = MediaProtocol.Http;
|
||||||
|
|
||||||
// OpenedMediaSource.Path = TempFilePath;
|
// OpenedMediaSource.Path = TempFilePath;
|
||||||
|
@ -85,7 +85,7 @@ namespace MediaBrowser.Controller
|
|||||||
/// Gets an URL that can be used to access the API over HTTP (not HTTPS).
|
/// Gets an URL that can be used to access the API over HTTP (not HTTPS).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>The API URL.</returns>
|
/// <returns>The API URL.</returns>
|
||||||
string GetUrlForUseByHttpApi();
|
string GetApiUrlForLocalAccess();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a local (LAN) URL that can be used to access the API.
|
/// Gets a local (LAN) URL that can be used to access the API.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user