diff options
| author | Mark Monteiro <marknr.monteiro@protonmail.com> | 2020-04-01 23:09:55 +0200 |
|---|---|---|
| committer | Mark Monteiro <marknr.monteiro@protonmail.com> | 2020-04-01 23:09:55 +0200 |
| commit | 123bfbcf19a06bc45f13ff0c25b1f34a5d9f94b8 (patch) | |
| tree | d19446e7f253a04a2e5e412a2b33fbef09211135 /Jellyfin.Server/Program.cs | |
| parent | 41de0bd24569341199a7caed21469b7813d3c98d (diff) | |
| parent | cc40f84f3c138e439318e400eeb53cbb74eb8a84 (diff) | |
Merge remote-tracking branch 'upstream/master' into use-development-exception-page
Diffstat (limited to 'Jellyfin.Server/Program.cs')
| -rw-r--r-- | Jellyfin.Server/Program.cs | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs index d9ca14136..5766a9dc3 100644 --- a/Jellyfin.Server/Program.cs +++ b/Jellyfin.Server/Program.cs @@ -1,6 +1,5 @@ using System; using System.Diagnostics; -using System.Globalization; using System.IO; using System.Linq; using System.Net; @@ -20,6 +19,7 @@ using Jellyfin.Drawing.Skia; using MediaBrowser.Common.Configuration; using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.Extensions; +using MediaBrowser.WebDashboard.Api; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; @@ -27,7 +27,6 @@ using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Serilog; -using Serilog.Events; using Serilog.Extensions.Logging; using SQLitePCL; using ILogger = Microsoft.Extensions.Logging.ILogger; @@ -185,8 +184,23 @@ namespace Jellyfin.Server new ManagedFileSystem(_loggerFactory.CreateLogger<ManagedFileSystem>(), appPaths), GetImageEncoder(appPaths), new NetworkManager(_loggerFactory.CreateLogger<NetworkManager>())); + try { + // If hosting the web client, validate the client content path + if (startupConfig.HostWebClient()) + { + string webContentPath = DashboardService.GetDashboardUIPath(startupConfig, appHost.ServerConfigurationManager); + if (!Directory.Exists(webContentPath) || Directory.GetFiles(webContentPath).Length == 0) + { + 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" + + $"'{MediaBrowser.Controller.Extensions.ConfigurationExtensions.HostWebClientKey}=false' in your config settings."); + } + } + ServiceCollection serviceCollection = new ServiceCollection(); await appHost.InitAsync(serviceCollection, startupConfig).ConfigureAwait(false); @@ -549,7 +563,7 @@ namespace Jellyfin.Server } catch (Exception ex) { - _logger.LogWarning(ex, "Skia not available. Will fallback to NullIMageEncoder."); + _logger.LogWarning(ex, $"Skia not available. Will fallback to {nameof(NullImageEncoder)}."); } return new NullImageEncoder(); |
