mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Merge branch 'NetworkPR2' of https://github.com/BaronGreenback/jellyfin into NetworkPR2
This commit is contained in:
commit
0bc37c981d
@ -1,4 +1,4 @@
|
|||||||
using System.Linq;
|
using System.Net;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Common.Extensions;
|
||||||
using MediaBrowser.Common.Net;
|
using MediaBrowser.Common.Net;
|
||||||
@ -33,14 +33,14 @@ namespace Jellyfin.Server.Middleware
|
|||||||
/// <returns>The async task.</returns>
|
/// <returns>The async task.</returns>
|
||||||
public async Task Invoke(HttpContext httpContext, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager)
|
public async Task Invoke(HttpContext httpContext, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager)
|
||||||
{
|
{
|
||||||
if (httpContext.Connection.RemoteIpAddress == null)
|
if (httpContext.IsLocal())
|
||||||
{
|
{
|
||||||
// Running locally.
|
// Running locally.
|
||||||
await _next(httpContext).ConfigureAwait(false);
|
await _next(httpContext).ConfigureAwait(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var remoteIp = httpContext.Connection.RemoteIpAddress;
|
var remoteIp = httpContext.Connection.RemoteIpAddress ?? IPAddress.Loopback;
|
||||||
|
|
||||||
if (serverConfigurationManager.Configuration.EnableRemoteAccess)
|
if (serverConfigurationManager.Configuration.EnableRemoteAccess)
|
||||||
{
|
{
|
||||||
|
@ -43,18 +43,6 @@ namespace Jellyfin.Server.Middleware
|
|||||||
}
|
}
|
||||||
|
|
||||||
await _next(httpContext).ConfigureAwait(false);
|
await _next(httpContext).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string NormalizeConfiguredLocalAddress(string address)
|
|
||||||
{
|
|
||||||
var add = address.AsSpan().Trim('/');
|
|
||||||
int index = add.IndexOf('/');
|
|
||||||
if (index != -1)
|
|
||||||
{
|
|
||||||
add = add.Slice(index + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return add.TrimStart('/').ToString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user