diff options
| author | Jim Cartlidge <jimcartlidge@yahoo.co.uk> | 2020-09-12 17:21:03 +0100 |
|---|---|---|
| committer | Jim Cartlidge <jimcartlidge@yahoo.co.uk> | 2020-09-12 17:21:03 +0100 |
| commit | 288d89493e76b8881c719fe549859b2c0b5f7e29 (patch) | |
| tree | b5cbb9d5216f805acbe8f167b8dbefd77982a5d2 | |
| parent | 9ef79d190b2490a03c566bfaaf963fbba7d124a9 (diff) | |
Fixed testing units.
| -rw-r--r-- | Jellyfin.Server/Middleware/IpBasedAccessValidationMiddleware.cs | 3 | ||||
| -rw-r--r-- | Jellyfin.Server/Middleware/LanFilteringMiddleware.cs | 5 |
2 files changed, 6 insertions, 2 deletions
diff --git a/Jellyfin.Server/Middleware/IpBasedAccessValidationMiddleware.cs b/Jellyfin.Server/Middleware/IpBasedAccessValidationMiddleware.cs index 110290027..ff82fe6cc 100644 --- a/Jellyfin.Server/Middleware/IpBasedAccessValidationMiddleware.cs +++ b/Jellyfin.Server/Middleware/IpBasedAccessValidationMiddleware.cs @@ -34,8 +34,9 @@ namespace Jellyfin.Server.Middleware /// <returns>The async task.</returns> public async Task Invoke(HttpContext httpContext, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager) { - if (httpContext.IsLocal()) + if (httpContext.Connection.RemoteIpAddress == null) { + // Running locally. await _next(httpContext).ConfigureAwait(false); return; } diff --git a/Jellyfin.Server/Middleware/LanFilteringMiddleware.cs b/Jellyfin.Server/Middleware/LanFilteringMiddleware.cs index 2ff6f8a76..87c82bf58 100644 --- a/Jellyfin.Server/Middleware/LanFilteringMiddleware.cs +++ b/Jellyfin.Server/Middleware/LanFilteringMiddleware.cs @@ -1,10 +1,13 @@ using System; using System.Linq; +using System.Net; using System.Threading.Tasks; using Jellyfin.Networking.Manager; +using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using Microsoft.AspNetCore.Http; +using NetworkCollection; namespace Jellyfin.Server.Middleware { @@ -33,7 +36,7 @@ namespace Jellyfin.Server.Middleware /// <returns>The async task.</returns> public async Task Invoke(HttpContext httpContext, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager) { - var host = httpContext.Connection.RemoteIpAddress; + var host = httpContext.Connection.RemoteIpAddress ?? IPAddress.Loopback; if (!networkManager.IsInLocalNetwork(host) && !serverConfigurationManager.Configuration.EnableRemoteAccess) { |
