|
|
@ -99,6 +99,7 @@ using MediaBrowser.Providers.Subtitles;
|
|
|
|
using MediaBrowser.XbmcMetadata.Providers;
|
|
|
|
using MediaBrowser.XbmcMetadata.Providers;
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
using Prometheus.DotNetRuntime;
|
|
|
|
using Prometheus.DotNetRuntime;
|
|
|
@ -118,6 +119,7 @@ namespace Emby.Server.Implementations
|
|
|
|
private static readonly string[] _relevantEnvVarPrefixes = { "JELLYFIN_", "DOTNET_", "ASPNETCORE_" };
|
|
|
|
private static readonly string[] _relevantEnvVarPrefixes = { "JELLYFIN_", "DOTNET_", "ASPNETCORE_" };
|
|
|
|
|
|
|
|
|
|
|
|
private readonly IFileSystem _fileSystemManager;
|
|
|
|
private readonly IFileSystem _fileSystemManager;
|
|
|
|
|
|
|
|
private readonly IConfiguration _startupConfig;
|
|
|
|
private readonly IXmlSerializer _xmlSerializer;
|
|
|
|
private readonly IXmlSerializer _xmlSerializer;
|
|
|
|
private readonly IStartupOptions _startupOptions;
|
|
|
|
private readonly IStartupOptions _startupOptions;
|
|
|
|
private readonly IPluginManager _pluginManager;
|
|
|
|
private readonly IPluginManager _pluginManager;
|
|
|
@ -228,6 +230,11 @@ namespace Emby.Server.Implementations
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public int HttpsPort { get; private set; }
|
|
|
|
public int HttpsPort { get; private set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Gets the PublishedServerUrl setting.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public string PublishedServerUrl => _startupOptions.PublishedServerUrl ?? _startupConfig["PublishedServerUrl"];
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Gets the server configuration manager.
|
|
|
|
/// Gets the server configuration manager.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
@ -240,12 +247,14 @@ namespace Emby.Server.Implementations
|
|
|
|
/// <param name="applicationPaths">Instance of the <see cref="IServerApplicationPaths"/> interface.</param>
|
|
|
|
/// <param name="applicationPaths">Instance of the <see cref="IServerApplicationPaths"/> interface.</param>
|
|
|
|
/// <param name="loggerFactory">Instance of the <see cref="ILoggerFactory"/> interface.</param>
|
|
|
|
/// <param name="loggerFactory">Instance of the <see cref="ILoggerFactory"/> interface.</param>
|
|
|
|
/// <param name="options">Instance of the <see cref="IStartupOptions"/> interface.</param>
|
|
|
|
/// <param name="options">Instance of the <see cref="IStartupOptions"/> interface.</param>
|
|
|
|
|
|
|
|
/// <param name="startupConfig">The <see cref="IConfiguration" /> interface.</param>
|
|
|
|
/// <param name="fileSystem">Instance of the <see cref="IFileSystem"/> interface.</param>
|
|
|
|
/// <param name="fileSystem">Instance of the <see cref="IFileSystem"/> interface.</param>
|
|
|
|
/// <param name="serviceCollection">Instance of the <see cref="IServiceCollection"/> interface.</param>
|
|
|
|
/// <param name="serviceCollection">Instance of the <see cref="IServiceCollection"/> interface.</param>
|
|
|
|
public ApplicationHost(
|
|
|
|
public ApplicationHost(
|
|
|
|
IServerApplicationPaths applicationPaths,
|
|
|
|
IServerApplicationPaths applicationPaths,
|
|
|
|
ILoggerFactory loggerFactory,
|
|
|
|
ILoggerFactory loggerFactory,
|
|
|
|
IStartupOptions options,
|
|
|
|
IStartupOptions options,
|
|
|
|
|
|
|
|
IConfiguration startupConfig,
|
|
|
|
IFileSystem fileSystem,
|
|
|
|
IFileSystem fileSystem,
|
|
|
|
IServiceCollection serviceCollection)
|
|
|
|
IServiceCollection serviceCollection)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -268,6 +277,7 @@ namespace Emby.Server.Implementations
|
|
|
|
Logger = LoggerFactory.CreateLogger<ApplicationHost>();
|
|
|
|
Logger = LoggerFactory.CreateLogger<ApplicationHost>();
|
|
|
|
|
|
|
|
|
|
|
|
_startupOptions = options;
|
|
|
|
_startupOptions = options;
|
|
|
|
|
|
|
|
_startupConfig = startupConfig;
|
|
|
|
|
|
|
|
|
|
|
|
// Initialize runtime stat collection
|
|
|
|
// Initialize runtime stat collection
|
|
|
|
if (ServerConfigurationManager.Configuration.EnableMetrics)
|
|
|
|
if (ServerConfigurationManager.Configuration.EnableMetrics)
|
|
|
@ -1145,10 +1155,10 @@ namespace Emby.Server.Implementations
|
|
|
|
public string GetSmartApiUrl(IPAddress ipAddress, int? port = null)
|
|
|
|
public string GetSmartApiUrl(IPAddress ipAddress, int? port = null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Published server ends with a /
|
|
|
|
// Published server ends with a /
|
|
|
|
if (_startupOptions.PublishedServerUrl != null)
|
|
|
|
if (!string.IsNullOrEmpty(PublishedServerUrl))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Published server ends with a '/', so we need to remove it.
|
|
|
|
// Published server ends with a '/', so we need to remove it.
|
|
|
|
return _startupOptions.PublishedServerUrl.ToString().Trim('/');
|
|
|
|
return PublishedServerUrl.Trim('/');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string smart = NetManager.GetBindInterface(ipAddress, out port);
|
|
|
|
string smart = NetManager.GetBindInterface(ipAddress, out port);
|
|
|
@ -1165,10 +1175,10 @@ namespace Emby.Server.Implementations
|
|
|
|
public string GetSmartApiUrl(HttpRequest request, int? port = null)
|
|
|
|
public string GetSmartApiUrl(HttpRequest request, int? port = null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Published server ends with a /
|
|
|
|
// Published server ends with a /
|
|
|
|
if (_startupOptions.PublishedServerUrl != null)
|
|
|
|
if (!string.IsNullOrEmpty(PublishedServerUrl))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Published server ends with a '/', so we need to remove it.
|
|
|
|
// Published server ends with a '/', so we need to remove it.
|
|
|
|
return _startupOptions.PublishedServerUrl.ToString().Trim('/');
|
|
|
|
return PublishedServerUrl.Trim('/');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string smart = NetManager.GetBindInterface(request, out port);
|
|
|
|
string smart = NetManager.GetBindInterface(request, out port);
|
|
|
@ -1185,10 +1195,10 @@ namespace Emby.Server.Implementations
|
|
|
|
public string GetSmartApiUrl(string hostname, int? port = null)
|
|
|
|
public string GetSmartApiUrl(string hostname, int? port = null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Published server ends with a /
|
|
|
|
// Published server ends with a /
|
|
|
|
if (_startupOptions.PublishedServerUrl != null)
|
|
|
|
if (!string.IsNullOrEmpty(PublishedServerUrl))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Published server ends with a '/', so we need to remove it.
|
|
|
|
// Published server ends with a '/', so we need to remove it.
|
|
|
|
return _startupOptions.PublishedServerUrl.ToString().Trim('/');
|
|
|
|
return PublishedServerUrl.Trim('/');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string smart = NetManager.GetBindInterface(hostname, out port);
|
|
|
|
string smart = NetManager.GetBindInterface(hostname, out port);
|
|
|
|