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 /MediaBrowser.WebDashboard/Api/DashboardService.cs | |
| parent | 41de0bd24569341199a7caed21469b7813d3c98d (diff) | |
| parent | cc40f84f3c138e439318e400eeb53cbb74eb8a84 (diff) | |
Merge remote-tracking branch 'upstream/master' into use-development-exception-page
Diffstat (limited to 'MediaBrowser.WebDashboard/Api/DashboardService.cs')
| -rw-r--r-- | MediaBrowser.WebDashboard/Api/DashboardService.cs | 43 |
1 files changed, 17 insertions, 26 deletions
diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.cs index a71d685fb..133a35527 100644 --- a/MediaBrowser.WebDashboard/Api/DashboardService.cs +++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs @@ -135,20 +135,6 @@ namespace MediaBrowser.WebDashboard.Api _serverConfigurationManager = serverConfigurationManager; _fileSystem = fileSystem; _resultFactory = resultFactory; - - // If hosting the web client, validate the client content path - if (appConfig.HostWebClient()) - { - string webContentPath = DashboardUIPath; - if (!Directory.Exists(webContentPath) || !Directory.GetFiles(webContentPath).Any()) - { - 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."); - } - } } /// <summary> @@ -161,22 +147,27 @@ namespace MediaBrowser.WebDashboard.Api /// Gets the path of the directory containing the static web interface content, or null if the server is not /// hosting the web client. /// </summary> - public string DashboardUIPath + public string DashboardUIPath => GetDashboardUIPath(_appConfig, _serverConfigurationManager); + + /// <summary> + /// Gets the path of the directory containing the static web interface content. + /// </summary> + /// <param name="appConfig">The app configuration.</param> + /// <param name="serverConfigManager">The server configuration manager.</param> + /// <returns>The directory path, or null if the server is not hosting the web client.</returns> + public static string GetDashboardUIPath(IConfiguration appConfig, IServerConfigurationManager serverConfigManager) { - get + if (!appConfig.HostWebClient()) { - if (!_appConfig.HostWebClient()) - { - return null; - } - - if (!string.IsNullOrEmpty(_serverConfigurationManager.Configuration.DashboardSourcePath)) - { - return _serverConfigurationManager.Configuration.DashboardSourcePath; - } + return null; + } - return _serverConfigurationManager.ApplicationPaths.WebPath; + if (!string.IsNullOrEmpty(serverConfigManager.Configuration.DashboardSourcePath)) + { + return serverConfigManager.Configuration.DashboardSourcePath; } + + return serverConfigManager.ApplicationPaths.WebPath; } [SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "request", Justification = "Required for ServiceStack")] |
