mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-21 01:26:41 +00:00
remove mono compiler directives
This commit is contained in:
@@ -43,6 +43,8 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
||||
|
||||
private readonly ReaderWriterLockSlim _localEndpointLock = new ReaderWriterLockSlim();
|
||||
|
||||
private readonly bool _supportsNativeWebSocket;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the local end points.
|
||||
/// </summary>
|
||||
@@ -61,10 +63,17 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
||||
}
|
||||
}
|
||||
|
||||
public HttpListenerHost(IApplicationHost applicationHost, ILogManager logManager, string serviceName, string handlerPath, string defaultRedirectPath, params Assembly[] assembliesWithServices)
|
||||
public HttpListenerHost(IApplicationHost applicationHost,
|
||||
ILogManager logManager,
|
||||
string serviceName,
|
||||
string handlerPath,
|
||||
string defaultRedirectPath,
|
||||
bool supportsNativeWebSocket,
|
||||
params Assembly[] assembliesWithServices)
|
||||
: base(serviceName, assembliesWithServices)
|
||||
{
|
||||
DefaultRedirectPath = defaultRedirectPath;
|
||||
_supportsNativeWebSocket = supportsNativeWebSocket;
|
||||
HandlerPath = handlerPath;
|
||||
|
||||
_logger = logManager.GetLogger("HttpServer");
|
||||
@@ -195,7 +204,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
||||
{
|
||||
HostContext.Config.HandlerFactoryPath = ListenerRequest.GetHandlerPathIfAny(UrlPrefixes.First());
|
||||
|
||||
_listener = NativeWebSocket.IsSupported
|
||||
_listener = _supportsNativeWebSocket && NativeWebSocket.IsSupported
|
||||
? _listener = new HttpListenerServer(_logger, OnRequestReceived)
|
||||
//? _listener = new WebSocketSharpListener(_logger, OnRequestReceived)
|
||||
: _listener = new WebSocketSharpListener(_logger, OnRequestReceived);
|
||||
|
||||
@@ -219,11 +219,6 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
||||
{
|
||||
get
|
||||
{
|
||||
#if __MonoCS__
|
||||
return false;
|
||||
#else
|
||||
#endif
|
||||
|
||||
if (!_supportsNativeWebSocket.HasValue)
|
||||
{
|
||||
try
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using System.Collections.Generic;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Net;
|
||||
using MediaBrowser.Controller.Session;
|
||||
@@ -57,15 +58,14 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security
|
||||
}
|
||||
|
||||
private void ValidateUser(IRequest req, bool allowLocal,
|
||||
string[] roles)
|
||||
IEnumerable<string> roles)
|
||||
{
|
||||
//This code is executed before the service
|
||||
// This code is executed before the service
|
||||
var auth = AuthorizationContext.GetAuthorizationInfo(req);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(auth.Token)
|
||||
|| _config.Configuration.SecureApps2.Contains(auth.Client ?? string.Empty, StringComparer.OrdinalIgnoreCase))
|
||||
if (!allowLocal || !req.IsLocal)
|
||||
{
|
||||
if (!allowLocal || !req.IsLocal)
|
||||
if (!_config.Configuration.InsecureApps.Contains(auth.Client ?? string.Empty, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
SessionManager.ValidateSecurityToken(auth.Token);
|
||||
}
|
||||
|
||||
@@ -18,12 +18,18 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
||||
/// <param name="serverName">Name of the server.</param>
|
||||
/// <param name="handlerPath">The handler path.</param>
|
||||
/// <param name="defaultRedirectpath">The default redirectpath.</param>
|
||||
/// <param name="supportsNativeWebSocket">if set to <c>true</c> [supports native web socket].</param>
|
||||
/// <returns>IHttpServer.</returns>
|
||||
public static IHttpServer CreateServer(IApplicationHost applicationHost, ILogManager logManager, string serverName, string handlerPath, string defaultRedirectpath)
|
||||
public static IHttpServer CreateServer(IApplicationHost applicationHost,
|
||||
ILogManager logManager,
|
||||
string serverName,
|
||||
string handlerPath,
|
||||
string defaultRedirectpath,
|
||||
bool supportsNativeWebSocket)
|
||||
{
|
||||
LogManager.LogFactory = new ServerLogFactory(logManager);
|
||||
|
||||
return new HttpListenerHost(applicationHost, logManager, serverName, handlerPath, defaultRedirectpath);
|
||||
|
||||
return new HttpListenerHost(applicationHost, logManager, serverName, handlerPath, defaultRedirectpath, supportsNativeWebSocket);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user