Fix option to disable server discovery

This commit is contained in:
Bond_009
2022-02-14 14:39:33 +01:00
parent 68e7072698
commit 3cb49d6df0
9 changed files with 39 additions and 30 deletions

View File

@@ -5,7 +5,7 @@ using MediaBrowser.Controller.Configuration;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using ConfigurationExtensions = MediaBrowser.Controller.Extensions.ConfigurationExtensions;
using static MediaBrowser.Controller.Extensions.ConfigurationExtensions;
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.
_logger.LogDebug("Normalizing an URL at {LocalPath}", localPath);
httpContext.Response.Redirect(baseUrlPrefix + "/" + _configuration[ConfigurationExtensions.DefaultRedirectKey]);
httpContext.Response.Redirect(baseUrlPrefix + "/" + _configuration[DefaultRedirectKey]);
return;
}
}
@@ -74,7 +74,7 @@ namespace Jellyfin.Server.Middleware
{
// Always redirect back to the default path if root is requested.
_logger.LogDebug("Normalizing an URL at {LocalPath}", localPath);
httpContext.Response.Redirect("/" + _configuration[ConfigurationExtensions.DefaultRedirectKey]);
httpContext.Response.Redirect("/" + _configuration[DefaultRedirectKey]);
return;
}

View File

@@ -13,7 +13,6 @@ using Emby.Server.Implementations;
using Jellyfin.Server.Implementations;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Extensions;
using MediaBrowser.Model.IO;
using Microsoft.AspNetCore.Hosting;
using Microsoft.EntityFrameworkCore;
@@ -26,7 +25,7 @@ using Microsoft.Extensions.Logging.Abstractions;
using Serilog;
using Serilog.Extensions.Logging;
using SQLitePCL;
using ConfigurationExtensions = MediaBrowser.Controller.Extensions.ConfigurationExtensions;
using static MediaBrowser.Controller.Extensions.ConfigurationExtensions;
using ILogger = Microsoft.Extensions.Logging.ILogger;
namespace Jellyfin.Server
@@ -168,7 +167,7 @@ namespace Jellyfin.Server
"server, you may set the '--nowebclient' command line flag, or set" +
"'{ConfigKey}=false' in your config settings.",
webContentPath,
ConfigurationExtensions.HostWebClientKey);
HostWebClientKey);
Environment.ExitCode = 1;
return;
}
@@ -583,7 +582,7 @@ namespace Jellyfin.Server
var inMemoryDefaultConfig = ConfigurationOptions.DefaultConfiguration;
if (startupConfig != null && !startupConfig.HostWebClient())
{
inMemoryDefaultConfig[ConfigurationExtensions.DefaultRedirectKey] = "api-docs/swagger";
inMemoryDefaultConfig[DefaultRedirectKey] = "api-docs/swagger";
}
return config

View File

@@ -1,8 +1,7 @@
using System.Collections.Generic;
using CommandLine;
using Emby.Server.Implementations;
using Emby.Server.Implementations.Udp;
using MediaBrowser.Controller.Extensions;
using static MediaBrowser.Controller.Extensions.ConfigurationExtensions;
namespace Jellyfin.Server
{
@@ -86,17 +85,17 @@ namespace Jellyfin.Server
if (NoWebClient)
{
config.Add(ConfigurationExtensions.HostWebClientKey, bool.FalseString);
config.Add(HostWebClientKey, bool.FalseString);
}
if (PublishedServerUrl != null)
{
config.Add(UdpServer.AddressOverrideConfigKey, PublishedServerUrl);
config.Add(AddressOverrideKey, PublishedServerUrl);
}
if (FFmpegPath != null)
{
config.Add(ConfigurationExtensions.FfmpegPathKey, FFmpegPath);
config.Add(FfmpegPathKey, FFmpegPath);
}
return config;