mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-26 12:05:04 +01:00
update portable projects
This commit is contained in:
1629
Emby.Server.Core/ApplicationHost.cs
Normal file
1629
Emby.Server.Core/ApplicationHost.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -16,6 +16,14 @@
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Emby.Drawing\Emby.Drawing.csproj" />
|
||||
<ProjectReference Include="..\Emby.Photos\Emby.Photos.csproj" />
|
||||
<ProjectReference Include="..\MediaBrowser.Api\MediaBrowser.Api.csproj" />
|
||||
<ProjectReference Include="..\MediaBrowser.XbmcMetadata\MediaBrowser.XbmcMetadata.csproj" />
|
||||
<ProjectReference Include="..\MediaBrowser.LocalMetadata\MediaBrowser.LocalMetadata.csproj" />
|
||||
<ProjectReference Include="..\MediaBrowser.WebDashboard\MediaBrowser.WebDashboard.csproj" />
|
||||
<ProjectReference Include="..\MediaBrowser.MediaEncoding\MediaBrowser.MediaEncoding.csproj" />
|
||||
<ProjectReference Include="..\Emby.Dlna\Emby.Dlna.csproj" />
|
||||
<ProjectReference Include="..\Emby.Server.Implementations\Emby.Server.Implementations.csproj" />
|
||||
<ProjectReference Include="..\MediaBrowser.Controller\MediaBrowser.Controller.csproj" />
|
||||
<ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj" />
|
||||
|
||||
107
Emby.Server.Core/HttpServerFactory.cs
Normal file
107
Emby.Server.Core/HttpServerFactory.cs
Normal file
@@ -0,0 +1,107 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net.Security;
|
||||
using System.Net.Sockets;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Threading.Tasks;
|
||||
using Emby.Common.Implementations.Net;
|
||||
using Emby.Server.Implementations.HttpServer;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Net;
|
||||
using MediaBrowser.Model.Cryptography;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Net;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using MediaBrowser.Model.System;
|
||||
using MediaBrowser.Model.Text;
|
||||
using ServiceStack.Text.Jsv;
|
||||
using SocketHttpListener.Primitives;
|
||||
|
||||
namespace Emby.Server.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Class ServerFactory
|
||||
/// </summary>
|
||||
public static class HttpServerFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates the server.
|
||||
/// </summary>
|
||||
/// <returns>IHttpServer.</returns>
|
||||
public static IHttpServer CreateServer(IServerApplicationHost applicationHost,
|
||||
ILogManager logManager,
|
||||
IServerConfigurationManager config,
|
||||
INetworkManager networkmanager,
|
||||
IMemoryStreamFactory streamProvider,
|
||||
string serverName,
|
||||
string defaultRedirectpath,
|
||||
ITextEncoding textEncoding,
|
||||
ISocketFactory socketFactory,
|
||||
ICryptoProvider cryptoProvider,
|
||||
IJsonSerializer json,
|
||||
IXmlSerializer xml,
|
||||
IEnvironmentInfo environment,
|
||||
ICertificate certificate)
|
||||
{
|
||||
var logger = logManager.GetLogger("HttpServer");
|
||||
|
||||
return new HttpListenerHost(applicationHost,
|
||||
logger,
|
||||
config,
|
||||
serverName,
|
||||
defaultRedirectpath,
|
||||
networkmanager,
|
||||
streamProvider,
|
||||
textEncoding,
|
||||
socketFactory,
|
||||
cryptoProvider,
|
||||
json,
|
||||
xml,
|
||||
environment,
|
||||
certificate,
|
||||
new StreamFactory(),
|
||||
GetParseFn);
|
||||
}
|
||||
|
||||
private static Func<string, object> GetParseFn(Type propertyType)
|
||||
{
|
||||
return s => JsvReader.GetParseFn(propertyType)(s);
|
||||
}
|
||||
}
|
||||
|
||||
public class StreamFactory : IStreamFactory
|
||||
{
|
||||
public Stream CreateNetworkStream(ISocket socket, bool ownsSocket)
|
||||
{
|
||||
var netSocket = (NetSocket)socket;
|
||||
|
||||
return new NetworkStream(netSocket.Socket, ownsSocket);
|
||||
}
|
||||
|
||||
public Task AuthenticateSslStreamAsServer(Stream stream, ICertificate certificate)
|
||||
{
|
||||
var sslStream = (SslStream)stream;
|
||||
var cert = (Certificate)certificate;
|
||||
|
||||
return sslStream.AuthenticateAsServerAsync(cert.X509Certificate);
|
||||
}
|
||||
|
||||
public Stream CreateSslStream(Stream innerStream, bool leaveInnerStreamOpen)
|
||||
{
|
||||
return new SslStream(innerStream, leaveInnerStreamOpen);
|
||||
}
|
||||
}
|
||||
|
||||
public class Certificate : ICertificate
|
||||
{
|
||||
public Certificate(X509Certificate x509Certificate)
|
||||
{
|
||||
X509Certificate = x509Certificate;
|
||||
}
|
||||
|
||||
public X509Certificate X509Certificate { get; private set; }
|
||||
}
|
||||
}
|
||||
@@ -67,12 +67,6 @@ namespace Emby.Server.Core
|
||||
/// <param name="autorun">if set to <c>true</c> [autorun].</param>
|
||||
void ConfigureAutoRun(bool autorun);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the network manager.
|
||||
/// </summary>
|
||||
/// <returns>INetworkManager.</returns>
|
||||
INetworkManager CreateNetworkManager(ILogger logger);
|
||||
|
||||
FFMpegInstallInfo GetFfmpegInstallInfo();
|
||||
|
||||
void LaunchUrl(string url);
|
||||
|
||||
@@ -31,8 +31,33 @@
|
||||
},
|
||||
"MediaBrowser.Server.Implementations": {
|
||||
"target": "project"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Emby.Dlna": {
|
||||
"target": "project"
|
||||
},
|
||||
"Emby.Photos": {
|
||||
"target": "project"
|
||||
},
|
||||
"MediaBrowser.Api": {
|
||||
"target": "project"
|
||||
},
|
||||
"MediaBrowser.MediaEncoding": {
|
||||
"target": "project"
|
||||
},
|
||||
"MediaBrowser.XbmcMetadata": {
|
||||
"target": "project"
|
||||
},
|
||||
"MediaBrowser.LocalMetadata": {
|
||||
"target": "project"
|
||||
},
|
||||
"MediaBrowser.WebDashboard": {
|
||||
"target": "project"
|
||||
},
|
||||
"Emby.Drawing": {
|
||||
"target": "project"
|
||||
},
|
||||
"SocketHttpListener.Portable": "1.0.50"
|
||||
}
|
||||
},
|
||||
"netstandard1.6": {
|
||||
"imports": "dnxcore50",
|
||||
@@ -41,6 +66,10 @@
|
||||
"System.AppDomain": "2.0.11",
|
||||
"System.Globalization.Extensions": "4.0.1",
|
||||
"System.IO.FileSystem.Watcher": "4.0.0",
|
||||
"System.Net.Security": "4.0.0",
|
||||
"System.Security.Cryptography.X509Certificates": "4.1.0",
|
||||
"System.Runtime.Extensions": "4.1.0",
|
||||
"SocketHttpListener.Portable": "1.0.50",
|
||||
"MediaBrowser.Model": {
|
||||
"target": "project"
|
||||
},
|
||||
@@ -61,6 +90,30 @@
|
||||
},
|
||||
"MediaBrowser.Server.Implementations": {
|
||||
"target": "project"
|
||||
},
|
||||
"Emby.Dlna": {
|
||||
"target": "project"
|
||||
},
|
||||
"Emby.Photos": {
|
||||
"target": "project"
|
||||
},
|
||||
"MediaBrowser.Api": {
|
||||
"target": "project"
|
||||
},
|
||||
"MediaBrowser.MediaEncoding": {
|
||||
"target": "project"
|
||||
},
|
||||
"MediaBrowser.XbmcMetadata": {
|
||||
"target": "project"
|
||||
},
|
||||
"MediaBrowser.LocalMetadata": {
|
||||
"target": "project"
|
||||
},
|
||||
"MediaBrowser.WebDashboard": {
|
||||
"target": "project"
|
||||
},
|
||||
"Emby.Drawing": {
|
||||
"target": "project"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user