mirror of https://github.com/jellyfin/jellyfin.git
Fix option to disable server discovery
This commit is contained in:
parent
68e7072698
commit
3cb49d6df0
|
@ -44,7 +44,6 @@ using Emby.Server.Implementations.Serialization;
|
||||||
using Emby.Server.Implementations.Session;
|
using Emby.Server.Implementations.Session;
|
||||||
using Emby.Server.Implementations.SyncPlay;
|
using Emby.Server.Implementations.SyncPlay;
|
||||||
using Emby.Server.Implementations.TV;
|
using Emby.Server.Implementations.TV;
|
||||||
using Emby.Server.Implementations.Udp;
|
|
||||||
using Emby.Server.Implementations.Updates;
|
using Emby.Server.Implementations.Updates;
|
||||||
using Jellyfin.Api.Helpers;
|
using Jellyfin.Api.Helpers;
|
||||||
using Jellyfin.MediaEncoding.Hls.Playlist;
|
using Jellyfin.MediaEncoding.Hls.Playlist;
|
||||||
|
@ -104,6 +103,7 @@ 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;
|
||||||
|
using static MediaBrowser.Controller.Extensions.ConfigurationExtensions;
|
||||||
using WebSocketManager = Emby.Server.Implementations.HttpServer.WebSocketManager;
|
using WebSocketManager = Emby.Server.Implementations.HttpServer.WebSocketManager;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations
|
namespace Emby.Server.Implementations
|
||||||
|
@ -184,6 +184,11 @@ namespace Emby.Server.Implementations
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler HasPendingRestartChanged;
|
public event EventHandler HasPendingRestartChanged;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the value of the PublishedServerUrl setting.
|
||||||
|
/// </summary>
|
||||||
|
private string PublishedServerUrl => _startupConfig[AddressOverrideKey];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether this instance can self restart.
|
/// Gets a value indicating whether this instance can self restart.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -260,11 +265,6 @@ namespace Emby.Server.Implementations
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int HttpsPort { get; private set; }
|
public int HttpsPort { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the value of the PublishedServerUrl setting.
|
|
||||||
/// </summary>
|
|
||||||
public string PublishedServerUrl => _startupOptions.PublishedServerUrl ?? _startupConfig[UdpServer.AddressOverrideConfigKey];
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public Version ApplicationVersion { get; }
|
public Version ApplicationVersion { get; }
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@ using System.Net.Sockets;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Emby.Server.Implementations.Udp;
|
using Emby.Server.Implementations.Udp;
|
||||||
|
using Jellyfin.Networking.Configuration;
|
||||||
|
using MediaBrowser.Common.Configuration;
|
||||||
using MediaBrowser.Controller;
|
using MediaBrowser.Controller;
|
||||||
using MediaBrowser.Controller.Plugins;
|
using MediaBrowser.Controller.Plugins;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
|
@ -26,6 +28,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||||
private readonly ILogger<UdpServerEntryPoint> _logger;
|
private readonly ILogger<UdpServerEntryPoint> _logger;
|
||||||
private readonly IServerApplicationHost _appHost;
|
private readonly IServerApplicationHost _appHost;
|
||||||
private readonly IConfiguration _config;
|
private readonly IConfiguration _config;
|
||||||
|
private readonly IConfigurationManager _configurationManager;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The UDP server.
|
/// The UDP server.
|
||||||
|
@ -40,14 +43,17 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||||
/// <param name="logger">Instance of the <see cref="ILogger{UdpServerEntryPoint}"/> interface.</param>
|
/// <param name="logger">Instance of the <see cref="ILogger{UdpServerEntryPoint}"/> interface.</param>
|
||||||
/// <param name="appHost">Instance of the <see cref="IServerApplicationHost"/> interface.</param>
|
/// <param name="appHost">Instance of the <see cref="IServerApplicationHost"/> interface.</param>
|
||||||
/// <param name="configuration">Instance of the <see cref="IConfiguration"/> interface.</param>
|
/// <param name="configuration">Instance of the <see cref="IConfiguration"/> interface.</param>
|
||||||
|
/// <param name="configurationManager">Instance of the <see cref="IConfigurationManager"/> interface.</param>
|
||||||
public UdpServerEntryPoint(
|
public UdpServerEntryPoint(
|
||||||
ILogger<UdpServerEntryPoint> logger,
|
ILogger<UdpServerEntryPoint> logger,
|
||||||
IServerApplicationHost appHost,
|
IServerApplicationHost appHost,
|
||||||
IConfiguration configuration)
|
IConfiguration configuration,
|
||||||
|
IConfigurationManager configurationManager)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_appHost = appHost;
|
_appHost = appHost;
|
||||||
_config = configuration;
|
_config = configuration;
|
||||||
|
_configurationManager = configurationManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
@ -55,6 +61,11 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||||
{
|
{
|
||||||
CheckDisposed();
|
CheckDisposed();
|
||||||
|
|
||||||
|
if (_configurationManager.GetNetworkConfiguration().AutoDiscovery)
|
||||||
|
{
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_udpServer = new UdpServer(_logger, _appHost, _config, PortNumber);
|
_udpServer = new UdpServer(_logger, _appHost, _config, PortNumber);
|
||||||
|
|
|
@ -9,6 +9,7 @@ using MediaBrowser.Controller;
|
||||||
using MediaBrowser.Model.ApiClient;
|
using MediaBrowser.Model.ApiClient;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using static MediaBrowser.Controller.Extensions.ConfigurationExtensions;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.Udp
|
namespace Emby.Server.Implementations.Udp
|
||||||
{
|
{
|
||||||
|
@ -17,11 +18,6 @@ namespace Emby.Server.Implementations.Udp
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class UdpServer : IDisposable
|
public sealed class UdpServer : IDisposable
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Address Override Configuration Key.
|
|
||||||
/// </summary>
|
|
||||||
public const string AddressOverrideConfigKey = "PublishedServerUrl";
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The _logger.
|
/// The _logger.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -60,7 +56,7 @@ namespace Emby.Server.Implementations.Udp
|
||||||
|
|
||||||
private async Task RespondToV2Message(EndPoint endpoint, CancellationToken cancellationToken)
|
private async Task RespondToV2Message(EndPoint endpoint, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
string? localUrl = _config[AddressOverrideConfigKey];
|
string? localUrl = _config[AddressOverrideKey];
|
||||||
if (string.IsNullOrEmpty(localUrl))
|
if (string.IsNullOrEmpty(localUrl))
|
||||||
{
|
{
|
||||||
localUrl = _appHost.GetSmartApiUrl(((IPEndPoint)endpoint).Address);
|
localUrl = _appHost.GetSmartApiUrl(((IPEndPoint)endpoint).Address);
|
||||||
|
@ -68,7 +64,7 @@ namespace Emby.Server.Implementations.Udp
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(localUrl))
|
if (string.IsNullOrEmpty(localUrl))
|
||||||
{
|
{
|
||||||
_logger.LogWarning("Unable to respond to udp request because the local ip address could not be determined.");
|
_logger.LogWarning("Unable to respond to server discovery request because the local ip address could not be determined.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -628,7 +628,6 @@ namespace Jellyfin.Networking.Manager
|
||||||
}
|
}
|
||||||
|
|
||||||
TrustAllIP6Interfaces = config.TrustAllIP6Interfaces;
|
TrustAllIP6Interfaces = config.TrustAllIP6Interfaces;
|
||||||
// UdpHelper.EnableMultiSocketBinding = config.EnableMultiSocketBinding;
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(MockNetworkSettings))
|
if (string.IsNullOrEmpty(MockNetworkSettings))
|
||||||
{
|
{
|
||||||
|
@ -750,7 +749,7 @@ namespace Jellyfin.Networking.Manager
|
||||||
bool partial = token[^1] == '*';
|
bool partial = token[^1] == '*';
|
||||||
if (partial)
|
if (partial)
|
||||||
{
|
{
|
||||||
token = token[0..^1];
|
token = token[..^1];
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ((string interfc, int interfcIndex) in _interfaceNames)
|
foreach ((string interfc, int interfcIndex) in _interfaceNames)
|
||||||
|
|
|
@ -5,7 +5,7 @@ using MediaBrowser.Controller.Configuration;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using ConfigurationExtensions = MediaBrowser.Controller.Extensions.ConfigurationExtensions;
|
using static MediaBrowser.Controller.Extensions.ConfigurationExtensions;
|
||||||
|
|
||||||
namespace Jellyfin.Server.Middleware
|
namespace Jellyfin.Server.Middleware
|
||||||
{
|
{
|
||||||
|
@ -65,7 +65,7 @@ namespace Jellyfin.Server.Middleware
|
||||||
{
|
{
|
||||||
// Always redirect back to the default path if the base prefix is invalid, missing, or is the full path.
|
// Always redirect back to the default path if the base prefix is invalid, missing, or is the full path.
|
||||||
_logger.LogDebug("Normalizing an URL at {LocalPath}", localPath);
|
_logger.LogDebug("Normalizing an URL at {LocalPath}", localPath);
|
||||||
httpContext.Response.Redirect(baseUrlPrefix + "/" + _configuration[ConfigurationExtensions.DefaultRedirectKey]);
|
httpContext.Response.Redirect(baseUrlPrefix + "/" + _configuration[DefaultRedirectKey]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ namespace Jellyfin.Server.Middleware
|
||||||
{
|
{
|
||||||
// Always redirect back to the default path if root is requested.
|
// Always redirect back to the default path if root is requested.
|
||||||
_logger.LogDebug("Normalizing an URL at {LocalPath}", localPath);
|
_logger.LogDebug("Normalizing an URL at {LocalPath}", localPath);
|
||||||
httpContext.Response.Redirect("/" + _configuration[ConfigurationExtensions.DefaultRedirectKey]);
|
httpContext.Response.Redirect("/" + _configuration[DefaultRedirectKey]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@ using Emby.Server.Implementations;
|
||||||
using Jellyfin.Server.Implementations;
|
using Jellyfin.Server.Implementations;
|
||||||
using MediaBrowser.Common.Configuration;
|
using MediaBrowser.Common.Configuration;
|
||||||
using MediaBrowser.Common.Net;
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Controller.Extensions;
|
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
@ -26,7 +25,7 @@ using Microsoft.Extensions.Logging.Abstractions;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using Serilog.Extensions.Logging;
|
using Serilog.Extensions.Logging;
|
||||||
using SQLitePCL;
|
using SQLitePCL;
|
||||||
using ConfigurationExtensions = MediaBrowser.Controller.Extensions.ConfigurationExtensions;
|
using static MediaBrowser.Controller.Extensions.ConfigurationExtensions;
|
||||||
using ILogger = Microsoft.Extensions.Logging.ILogger;
|
using ILogger = Microsoft.Extensions.Logging.ILogger;
|
||||||
|
|
||||||
namespace Jellyfin.Server
|
namespace Jellyfin.Server
|
||||||
|
@ -168,7 +167,7 @@ namespace Jellyfin.Server
|
||||||
"server, you may set the '--nowebclient' command line flag, or set" +
|
"server, you may set the '--nowebclient' command line flag, or set" +
|
||||||
"'{ConfigKey}=false' in your config settings.",
|
"'{ConfigKey}=false' in your config settings.",
|
||||||
webContentPath,
|
webContentPath,
|
||||||
ConfigurationExtensions.HostWebClientKey);
|
HostWebClientKey);
|
||||||
Environment.ExitCode = 1;
|
Environment.ExitCode = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -583,7 +582,7 @@ namespace Jellyfin.Server
|
||||||
var inMemoryDefaultConfig = ConfigurationOptions.DefaultConfiguration;
|
var inMemoryDefaultConfig = ConfigurationOptions.DefaultConfiguration;
|
||||||
if (startupConfig != null && !startupConfig.HostWebClient())
|
if (startupConfig != null && !startupConfig.HostWebClient())
|
||||||
{
|
{
|
||||||
inMemoryDefaultConfig[ConfigurationExtensions.DefaultRedirectKey] = "api-docs/swagger";
|
inMemoryDefaultConfig[DefaultRedirectKey] = "api-docs/swagger";
|
||||||
}
|
}
|
||||||
|
|
||||||
return config
|
return config
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using CommandLine;
|
using CommandLine;
|
||||||
using Emby.Server.Implementations;
|
using Emby.Server.Implementations;
|
||||||
using Emby.Server.Implementations.Udp;
|
using static MediaBrowser.Controller.Extensions.ConfigurationExtensions;
|
||||||
using MediaBrowser.Controller.Extensions;
|
|
||||||
|
|
||||||
namespace Jellyfin.Server
|
namespace Jellyfin.Server
|
||||||
{
|
{
|
||||||
|
@ -86,17 +85,17 @@ namespace Jellyfin.Server
|
||||||
|
|
||||||
if (NoWebClient)
|
if (NoWebClient)
|
||||||
{
|
{
|
||||||
config.Add(ConfigurationExtensions.HostWebClientKey, bool.FalseString);
|
config.Add(HostWebClientKey, bool.FalseString);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PublishedServerUrl != null)
|
if (PublishedServerUrl != null)
|
||||||
{
|
{
|
||||||
config.Add(UdpServer.AddressOverrideConfigKey, PublishedServerUrl);
|
config.Add(AddressOverrideKey, PublishedServerUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FFmpegPath != null)
|
if (FFmpegPath != null)
|
||||||
{
|
{
|
||||||
config.Add(ConfigurationExtensions.FfmpegPathKey, FFmpegPath);
|
config.Add(FfmpegPathKey, FFmpegPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
|
|
|
@ -14,6 +14,11 @@ namespace MediaBrowser.Controller.Extensions
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string DefaultRedirectKey = "DefaultRedirectPath";
|
public const string DefaultRedirectKey = "DefaultRedirectPath";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The key for the address override option.
|
||||||
|
/// </summary>
|
||||||
|
public const string AddressOverrideKey = "PublishedServerUrl";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The key for a setting that indicates whether the application should host web client content.
|
/// The key for a setting that indicates whether the application should host web client content.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -7,11 +7,11 @@ using MediaBrowser.Common;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Mvc.Testing;
|
using Microsoft.AspNetCore.Mvc.Testing;
|
||||||
using Microsoft.AspNetCore.TestHost;
|
using Microsoft.AspNetCore.TestHost;
|
||||||
using Microsoft.Extensions.Configuration;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using Serilog.Extensions.Logging;
|
using Serilog.Extensions.Logging;
|
||||||
|
using static MediaBrowser.Controller.Extensions.ConfigurationExtensions;
|
||||||
|
|
||||||
namespace Jellyfin.Server.Integration.Tests
|
namespace Jellyfin.Server.Integration.Tests
|
||||||
{
|
{
|
||||||
|
@ -74,7 +74,7 @@ namespace Jellyfin.Server.Integration.Tests
|
||||||
appPaths,
|
appPaths,
|
||||||
loggerFactory,
|
loggerFactory,
|
||||||
commandLineOpts,
|
commandLineOpts,
|
||||||
new ConfigurationBuilder().Build());
|
startupConfig);
|
||||||
_disposableComponents.Add(appHost);
|
_disposableComponents.Add(appHost);
|
||||||
var serviceCollection = new ServiceCollection();
|
var serviceCollection = new ServiceCollection();
|
||||||
appHost.Init(serviceCollection);
|
appHost.Init(serviceCollection);
|
||||||
|
|
Loading…
Reference in New Issue