From 74a07f6d1c52533aa648da27cb3924d6bb41bb19 Mon Sep 17 00:00:00 2001 From: Patrick Barron Date: Fri, 13 Jan 2023 21:37:37 -0500 Subject: Move Middleware to Jellyfin.Api --- .../Middleware/LanFilteringMiddleware.cs | 45 ---------------------- 1 file changed, 45 deletions(-) delete mode 100644 Jellyfin.Server/Middleware/LanFilteringMiddleware.cs (limited to 'Jellyfin.Server/Middleware/LanFilteringMiddleware.cs') diff --git a/Jellyfin.Server/Middleware/LanFilteringMiddleware.cs b/Jellyfin.Server/Middleware/LanFilteringMiddleware.cs deleted file mode 100644 index 67bf24d2a5..0000000000 --- a/Jellyfin.Server/Middleware/LanFilteringMiddleware.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System.Net; -using System.Threading.Tasks; -using Jellyfin.Networking.Configuration; -using MediaBrowser.Common.Net; -using MediaBrowser.Controller.Configuration; -using Microsoft.AspNetCore.Http; - -namespace Jellyfin.Server.Middleware -{ - /// - /// Validates the LAN host IP based on application configuration. - /// - public class LanFilteringMiddleware - { - private readonly RequestDelegate _next; - - /// - /// Initializes a new instance of the class. - /// - /// The next delegate in the pipeline. - public LanFilteringMiddleware(RequestDelegate next) - { - _next = next; - } - - /// - /// Executes the middleware action. - /// - /// The current HTTP context. - /// The network manager. - /// The server configuration manager. - /// The async task. - public async Task Invoke(HttpContext httpContext, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager) - { - var host = httpContext.Connection.RemoteIpAddress ?? IPAddress.Loopback; - - if (!networkManager.IsInLocalNetwork(host) && !serverConfigurationManager.GetNetworkConfiguration().EnableRemoteAccess) - { - return; - } - - await _next(httpContext).ConfigureAwait(false); - } - } -} -- cgit v1.2.3