mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-15 09:59:06 -07:00
Rename command line option to --nowebclient and config setting to HostWebClient
This commit is contained in:
parent
1a63c3f364
commit
aa546dd36a
@ -15,7 +15,7 @@ namespace Emby.Server.Implementations
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static Dictionary<string, string> DefaultConfiguration => new Dictionary<string, string>
|
public static Dictionary<string, string> DefaultConfiguration => new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
{ NoWebContentKey, bool.FalseString },
|
{ HostWebClientKey, bool.TrueString },
|
||||||
{ HttpListenerHost.DefaultRedirectKey, "web/index.html" },
|
{ HttpListenerHost.DefaultRedirectKey, "web/index.html" },
|
||||||
{ FfmpegProbeSizeKey, "1G" },
|
{ FfmpegProbeSizeKey, "1G" },
|
||||||
{ FfmpegAnalyzeDurationKey, "200M" },
|
{ FfmpegAnalyzeDurationKey, "200M" },
|
||||||
|
@ -37,7 +37,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
|||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_appConfig.NoWebContent())
|
if (!_appConfig.HostWebClient())
|
||||||
{
|
{
|
||||||
BrowserLauncher.OpenSwaggerPage(_appHost);
|
BrowserLauncher.OpenSwaggerPage(_appHost);
|
||||||
}
|
}
|
||||||
|
@ -490,9 +490,9 @@ namespace Jellyfin.Server
|
|||||||
IApplicationPaths appPaths,
|
IApplicationPaths appPaths,
|
||||||
IConfiguration? startupConfig = null)
|
IConfiguration? startupConfig = null)
|
||||||
{
|
{
|
||||||
// Use the swagger API page as the default redirect path if not hosting the jellyfin-web content
|
// Use the swagger API page as the default redirect path if not hosting the web client
|
||||||
var inMemoryDefaultConfig = ConfigurationOptions.DefaultConfiguration;
|
var inMemoryDefaultConfig = ConfigurationOptions.DefaultConfiguration;
|
||||||
if (startupConfig != null && startupConfig.NoWebContent())
|
if (startupConfig != null && !startupConfig.HostWebClient())
|
||||||
{
|
{
|
||||||
inMemoryDefaultConfig[HttpListenerHost.DefaultRedirectKey] = "swagger/index.html";
|
inMemoryDefaultConfig[HttpListenerHost.DefaultRedirectKey] = "swagger/index.html";
|
||||||
}
|
}
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
"Jellyfin.Server": {
|
"Jellyfin.Server": {
|
||||||
"commandName": "Project"
|
"commandName": "Project"
|
||||||
},
|
},
|
||||||
"Jellyfin.Server (nowebcontent)": {
|
"Jellyfin.Server (nowebclient)": {
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"commandLineArgs": "--nowebcontent"
|
"commandLineArgs": "--nowebclient"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,10 +19,10 @@ namespace Jellyfin.Server
|
|||||||
public string? DataDir { get; set; }
|
public string? DataDir { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether the server should not host static web content.
|
/// Gets or sets a value indicating whether the server should not host the web client.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Option(ConfigurationExtensions.NoWebContentKey, Required = false, HelpText = "Indicates that the web server should not host any static web content.")]
|
[Option("nowebclient", Required = false, HelpText = "Indicates that the web server should not host the web client.")]
|
||||||
public bool NoWebContent { get; set; }
|
public bool NoWebClient { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the path to the web directory.
|
/// Gets or sets the path to the web directory.
|
||||||
@ -84,9 +84,9 @@ namespace Jellyfin.Server
|
|||||||
{
|
{
|
||||||
var config = new Dictionary<string, string>();
|
var config = new Dictionary<string, string>();
|
||||||
|
|
||||||
if (NoWebContent)
|
if (NoWebClient)
|
||||||
{
|
{
|
||||||
config.Add(ConfigurationExtensions.NoWebContentKey, bool.TrueString);
|
config.Add(ConfigurationExtensions.HostWebClientKey, bool.FalseString);
|
||||||
}
|
}
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
|
@ -9,9 +9,9 @@ namespace MediaBrowser.Controller.Extensions
|
|||||||
public static class ConfigurationExtensions
|
public static class ConfigurationExtensions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The key for a setting that indicates whether the application should host static web content.
|
/// The key for a setting that indicates whether the application should host web client content.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string NoWebContentKey = "nowebcontent";
|
public const string HostWebClientKey = "hostwebclient";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The key for the FFmpeg probe size option.
|
/// The key for the FFmpeg probe size option.
|
||||||
@ -34,8 +34,8 @@ namespace MediaBrowser.Controller.Extensions
|
|||||||
/// <param name="configuration">The configuration to retrieve the value from.</param>
|
/// <param name="configuration">The configuration to retrieve the value from.</param>
|
||||||
/// <returns>The parsed config value.</returns>
|
/// <returns>The parsed config value.</returns>
|
||||||
/// <exception cref="FormatException">The config value is not a valid bool string. See <see cref="bool.Parse(string)"/>.</exception>
|
/// <exception cref="FormatException">The config value is not a valid bool string. See <see cref="bool.Parse(string)"/>.</exception>
|
||||||
public static bool NoWebContent(this IConfiguration configuration)
|
public static bool HostWebClient(this IConfiguration configuration)
|
||||||
=> configuration.GetValue<bool>(NoWebContentKey);
|
=> configuration.GetValue<bool>(HostWebClientKey);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the FFmpeg probe size from the <see cref="IConfiguration" />.
|
/// Gets the FFmpeg probe size from the <see cref="IConfiguration" />.
|
||||||
|
@ -136,15 +136,18 @@ namespace MediaBrowser.WebDashboard.Api
|
|||||||
_fileSystem = fileSystem;
|
_fileSystem = fileSystem;
|
||||||
_resultFactory = resultFactory;
|
_resultFactory = resultFactory;
|
||||||
|
|
||||||
// Validate web content path
|
// If hosting the web client, validate the client content path
|
||||||
string webContentPath = DashboardUIPath;
|
if (appConfig.HostWebClient())
|
||||||
bool webContentPathValid = appConfig.NoWebContent() || (Directory.Exists(webContentPath) && Directory.GetFiles(webContentPath).Any());
|
|
||||||
if (!webContentPathValid)
|
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException(
|
string webContentPath = DashboardUIPath;
|
||||||
"The server is expected to host web content, but the provided content directory is either " +
|
if (!Directory.Exists(webContentPath) || !Directory.GetFiles(webContentPath).Any())
|
||||||
$"invalid or empty: {webContentPath}. If you do not want to host web content with the server, " +
|
{
|
||||||
$"you may set the '{Controller.Extensions.ConfigurationExtensions.NoWebContentKey}' flag.");
|
throw new InvalidOperationException(
|
||||||
|
"The server is expected to host the web client, but the provided content directory is either " +
|
||||||
|
$"invalid or empty: {webContentPath}. If you do not want to host the web client with the " +
|
||||||
|
"server, you may set the '--nowebclient' command line flag, or set" +
|
||||||
|
$"'{Controller.Extensions.ConfigurationExtensions.HostWebClientKey}=false' in your config settings.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,13 +159,13 @@ namespace MediaBrowser.WebDashboard.Api
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the path of the directory containing the static web interface content, or null if the server is not
|
/// Gets the path of the directory containing the static web interface content, or null if the server is not
|
||||||
/// hosting the static web content.
|
/// hosting the web client.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string DashboardUIPath
|
public string DashboardUIPath
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (_appConfig.NoWebContent())
|
if (!_appConfig.HostWebClient())
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -329,7 +332,7 @@ namespace MediaBrowser.WebDashboard.Api
|
|||||||
/// <returns>System.Object.</returns>
|
/// <returns>System.Object.</returns>
|
||||||
public async Task<object> Get(GetDashboardResource request)
|
public async Task<object> Get(GetDashboardResource request)
|
||||||
{
|
{
|
||||||
if (_appConfig.NoWebContent() || DashboardUIPath == null)
|
if (!_appConfig.HostWebClient() || DashboardUIPath == null)
|
||||||
{
|
{
|
||||||
throw new ResourceNotFoundException();
|
throw new ResourceNotFoundException();
|
||||||
}
|
}
|
||||||
@ -405,7 +408,7 @@ namespace MediaBrowser.WebDashboard.Api
|
|||||||
|
|
||||||
public async Task<object> Get(GetDashboardPackage request)
|
public async Task<object> Get(GetDashboardPackage request)
|
||||||
{
|
{
|
||||||
if (_appConfig.NoWebContent() || DashboardUIPath == null)
|
if (!_appConfig.HostWebClient() || DashboardUIPath == null)
|
||||||
{
|
{
|
||||||
throw new ResourceNotFoundException();
|
throw new ResourceNotFoundException();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user