Merge pull request #4043 from cvium/remove_shit_and_shit_adjacent_shit

Split HttpListenerHost into middlewares
This commit is contained in:
Anthony Lavado
2020-09-03 09:45:17 -04:00
committed by GitHub
18 changed files with 550 additions and 645 deletions

View File

@@ -8,6 +8,12 @@ namespace MediaBrowser.Controller.Extensions
/// </summary>
public static class ConfigurationExtensions
{
/// <summary>
/// The key for a setting that specifies the default redirect path
/// to use for requests where the URL base prefix is invalid or missing..
/// </summary>
public const string DefaultRedirectKey = "DefaultRedirectPath";
/// <summary>
/// The key for a setting that indicates whether the application should host web client content.
/// </summary>

View File

@@ -20,6 +20,8 @@ namespace MediaBrowser.Controller
IServiceProvider ServiceProvider { get; }
bool CoreStartupHasCompleted { get; }
bool CanLaunchWebBrowser { get; }
/// <summary>
@@ -117,8 +119,7 @@ namespace MediaBrowser.Controller
IEnumerable<WakeOnLanInfo> GetWakeOnLanInfo();
string ExpandVirtualPath(string path);
string ReverseVirtualPath(string path);
Task ExecuteHttpHandlerAsync(HttpContext context, Func<Task> next);
string ReverseVirtualPath(string path);
}
}

View File

@@ -1,49 +0,0 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Jellyfin.Data.Events;
using Microsoft.AspNetCore.Http;
namespace MediaBrowser.Controller.Net
{
/// <summary>
/// Interface IHttpServer.
/// </summary>
public interface IHttpServer
{
/// <summary>
/// Gets the URL prefix.
/// </summary>
/// <value>The URL prefix.</value>
string[] UrlPrefixes { get; }
/// <summary>
/// Occurs when [web socket connected].
/// </summary>
event EventHandler<GenericEventArgs<IWebSocketConnection>> WebSocketConnected;
/// <summary>
/// Inits this instance.
/// </summary>
void Init(IEnumerable<IWebSocketListener> listener, IEnumerable<string> urlPrefixes);
/// <summary>
/// If set, all requests will respond with this message.
/// </summary>
string GlobalResponse { get; set; }
/// <summary>
/// The HTTP request handler.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
Task RequestHandler(HttpContext context);
/// <summary>
/// Get the default CORS headers.
/// </summary>
/// <param name="httpContext">The HTTP context of the current request.</param>
/// <returns>The default CORS headers for the context.</returns>
IDictionary<string, string> GetDefaultCorsHeaders(HttpContext httpContext);
}
}

View File

@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Jellyfin.Data.Events;
using Microsoft.AspNetCore.Http;
namespace MediaBrowser.Controller.Net
{
/// <summary>
/// Interface IHttpServer.
/// </summary>
public interface IWebSocketManager
{
/// <summary>
/// Occurs when [web socket connected].
/// </summary>
event EventHandler<GenericEventArgs<IWebSocketConnection>> WebSocketConnected;
/// <summary>
/// Inits this instance.
/// </summary>
/// <param name="listeners">The websocket listeners.</param>
void Init(IEnumerable<IWebSocketListener> listeners);
/// <summary>
/// The HTTP request handler.
/// </summary>
/// <param name="context">The current HTTP context.</param>
/// <returns>The task.</returns>
Task WebSocketRequestHandler(HttpContext context);
}
}