From 93d15cd96972588bbbc29a9398c9d4b050d30411 Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Sun, 10 Mar 2019 16:17:48 -0400 Subject: [PATCH 1/5] Add configuration flag for Web directory --- .../AppBase/BaseApplicationPaths.cs | 4 +++- .../ServerApplicationPaths.cs | 6 ++++-- Jellyfin.Server/Program.cs | 19 ++++++++++++++++++- Jellyfin.Server/StartupOptions.cs | 3 +++ 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs b/Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs index 65cdccfa5d..3ee09c9c04 100644 --- a/Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs +++ b/Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs @@ -17,12 +17,14 @@ namespace Emby.Server.Implementations.AppBase string programDataPath, string logDirectoryPath, string configurationDirectoryPath, - string cacheDirectoryPath) + string cacheDirectoryPath, + string webDirectoryPath) { ProgramDataPath = programDataPath; LogDirectoryPath = logDirectoryPath; ConfigurationDirectoryPath = configurationDirectoryPath; CachePath = cacheDirectoryPath; + WebPath = webDirectoryPath; DataPath = Path.Combine(ProgramDataPath, "data"); } diff --git a/Emby.Server.Implementations/ServerApplicationPaths.cs b/Emby.Server.Implementations/ServerApplicationPaths.cs index 05f6469ece..adaf23234f 100644 --- a/Emby.Server.Implementations/ServerApplicationPaths.cs +++ b/Emby.Server.Implementations/ServerApplicationPaths.cs @@ -17,11 +17,13 @@ namespace Emby.Server.Implementations string programDataPath, string logDirectoryPath, string configurationDirectoryPath, - string cacheDirectoryPath) + string cacheDirectoryPath, + string webDirectoryPath) : base(programDataPath, logDirectoryPath, configurationDirectoryPath, - cacheDirectoryPath) + cacheDirectoryPath, + webDirectoryPath) { } diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs index 0ef1711d4c..3d81ade35c 100644 --- a/Jellyfin.Server/Program.cs +++ b/Jellyfin.Server/Program.cs @@ -264,6 +264,23 @@ namespace Jellyfin.Server } } + // webDir + // IF --webdir + // ELSE IF $JELLYFIN_WEB_DIR + // ELSE use /jellyfin-web + var webDir = options.WebDir; + + if (string.IsNullOrEmpty(webDir)) + { + webDir = Environment.GetEnvironmentVariable("JELLYFIN_WEB_DIR"); + + if (string.IsNullOrEmpty(webDir)) + { + // Use default location under ResourcesPath + webDir = Path.Combine(AppContext.BaseDirectory, "jellyfin-web") + } + } + // logDir // IF --logdir // ELSE IF $JELLYFIN_LOG_DIR @@ -296,7 +313,7 @@ namespace Jellyfin.Server Environment.Exit(1); } - return new ServerApplicationPaths(dataDir, logDir, configDir, cacheDir); + return new ServerApplicationPaths(dataDir, logDir, configDir, cacheDir, webDir); } private static async Task CreateConfiguration(IApplicationPaths appPaths) diff --git a/Jellyfin.Server/StartupOptions.cs b/Jellyfin.Server/StartupOptions.cs index c8cdb984db..2b01c7bbdf 100644 --- a/Jellyfin.Server/StartupOptions.cs +++ b/Jellyfin.Server/StartupOptions.cs @@ -11,6 +11,9 @@ namespace Jellyfin.Server [Option('d', "datadir", Required = false, HelpText = "Path to use for the data folder (database files, etc.).")] public string DataDir { get; set; } + [Option('w', "webdir", Required = false, HelpText = "Path to the Jellyfin web resources.")] + public string WebDir { get; set; } + [Option('C', "cachedir", Required = false, HelpText = "Path to use for caching.")] public string CacheDir { get; set; } From 25deca95793581df85dab8c454d53a1d07a6ab53 Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Sun, 10 Mar 2019 16:20:46 -0400 Subject: [PATCH 2/5] Make use of WebPath --- Emby.Server.Implementations/ApplicationHost.cs | 2 +- MediaBrowser.WebDashboard/Api/DashboardService.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index ae54606747..05ede0ddab 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -621,7 +621,7 @@ namespace Emby.Server.Implementations string contentRoot = ServerConfigurationManager.Configuration.DashboardSourcePath; if (string.IsNullOrEmpty(contentRoot)) { - contentRoot = Path.Combine(ServerConfigurationManager.ApplicationPaths.ApplicationResourcesPath, "jellyfin-web", "src"); + contentRoot = Path.Combine(ServerConfigurationManager.ApplicationPaths,WebPath, "src"); } var host = new WebHostBuilder() diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.cs index 531978e1dd..05df54b115 100644 --- a/MediaBrowser.WebDashboard/Api/DashboardService.cs +++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs @@ -149,7 +149,7 @@ namespace MediaBrowser.WebDashboard.Api return _serverConfigurationManager.Configuration.DashboardSourcePath; } - return Path.Combine(_serverConfigurationManager.ApplicationPaths.ApplicationResourcesPath, "jellyfin-web", "src"); + return Path.Combine(_serverConfigurationManager.ApplicationPaths.WebPath, "src"); } } From 132ce3ece14ff7ca756c81e0a12172744c5c50aa Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Sun, 10 Mar 2019 17:04:18 -0400 Subject: [PATCH 3/5] Add further resources to complete WebPath --- Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs | 6 ++++++ Emby.Server.Implementations/ApplicationHost.cs | 4 +++- Emby.Server.Implementations/ServerApplicationPaths.cs | 6 ++++++ Jellyfin.Server/Program.cs | 2 +- MediaBrowser.Common/Configuration/IApplicationPaths.cs | 6 ++++++ MediaBrowser.Model/System/SystemInfo.cs | 6 ++++++ 6 files changed, 28 insertions(+), 2 deletions(-) diff --git a/Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs b/Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs index 3ee09c9c04..fd9ce3a364 100644 --- a/Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs +++ b/Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs @@ -35,6 +35,12 @@ namespace Emby.Server.Implementations.AppBase /// The program data path. public string ProgramDataPath { get; private set; } + /// + /// Gets the path to the web resources folder + /// + /// The web resources path. + public string WebPath { get; set; } + /// /// Gets the path to the system folder /// diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 05ede0ddab..f240ef871a 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -621,7 +621,7 @@ namespace Emby.Server.Implementations string contentRoot = ServerConfigurationManager.Configuration.DashboardSourcePath; if (string.IsNullOrEmpty(contentRoot)) { - contentRoot = Path.Combine(ServerConfigurationManager.ApplicationPaths,WebPath, "src"); + contentRoot = Path.Combine(ServerConfigurationManager.ApplicationPaths.WebPath, "src"); } var host = new WebHostBuilder() @@ -921,6 +921,7 @@ namespace Emby.Server.Implementations logger.LogInformation("User Interactive: {IsUserInteractive}", Environment.UserInteractive); logger.LogInformation("Processor count: {ProcessorCount}", Environment.ProcessorCount); logger.LogInformation("Program data path: {ProgramDataPath}", appPaths.ProgramDataPath); + logger.LogInformation("Web resources path: {WebPath}", appPaths.WebPath); logger.LogInformation("Application directory: {ApplicationPath}", appPaths.ProgramSystemPath); } @@ -1393,6 +1394,7 @@ namespace Emby.Server.Implementations CompletedInstallations = InstallationManager.CompletedInstallations.ToArray(), Id = SystemId, ProgramDataPath = ApplicationPaths.ProgramDataPath, + WebPath = ApplicationPaths.WebPath, LogPath = ApplicationPaths.LogDirectoryPath, ItemsByNamePath = ApplicationPaths.InternalMetadataPath, InternalMetadataPath = ApplicationPaths.InternalMetadataPath, diff --git a/Emby.Server.Implementations/ServerApplicationPaths.cs b/Emby.Server.Implementations/ServerApplicationPaths.cs index adaf23234f..68d5881220 100644 --- a/Emby.Server.Implementations/ServerApplicationPaths.cs +++ b/Emby.Server.Implementations/ServerApplicationPaths.cs @@ -35,6 +35,12 @@ namespace Emby.Server.Implementations /// The root folder path. public string RootFolderPath => Path.Combine(ProgramDataPath, "root"); +/* /// + /// Gets the path to the Web resources + /// + /// The web folder path. + public string WebPath => WebPath; */ + /// /// Gets the path to the default user view directory. Used if no specific user view is defined. /// diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs index 3d81ade35c..8f1498b13b 100644 --- a/Jellyfin.Server/Program.cs +++ b/Jellyfin.Server/Program.cs @@ -277,7 +277,7 @@ namespace Jellyfin.Server if (string.IsNullOrEmpty(webDir)) { // Use default location under ResourcesPath - webDir = Path.Combine(AppContext.BaseDirectory, "jellyfin-web") + webDir = Path.Combine(AppContext.BaseDirectory, "jellyfin-web"); } } diff --git a/MediaBrowser.Common/Configuration/IApplicationPaths.cs b/MediaBrowser.Common/Configuration/IApplicationPaths.cs index cb4e8bf5f0..1f56c98fd8 100644 --- a/MediaBrowser.Common/Configuration/IApplicationPaths.cs +++ b/MediaBrowser.Common/Configuration/IApplicationPaths.cs @@ -11,6 +11,12 @@ namespace MediaBrowser.Common.Configuration /// The program data path. string ProgramDataPath { get; } + /// + /// Gets the path to the web resources folder + /// + /// The web resources path. + string WebPath { get; } + /// /// Gets the path to the program system folder /// diff --git a/MediaBrowser.Model/System/SystemInfo.cs b/MediaBrowser.Model/System/SystemInfo.cs index 6482f2c840..fa72624819 100644 --- a/MediaBrowser.Model/System/SystemInfo.cs +++ b/MediaBrowser.Model/System/SystemInfo.cs @@ -83,6 +83,12 @@ namespace MediaBrowser.Model.System /// The program data path. public string ProgramDataPath { get; set; } + /// + /// Gets or sets the web resources path. + /// + /// The web resources path. + public string WebPath { get; set; } + /// /// Gets or sets the items by name path. /// From 5f7524aca26797a3dc7acbed8cd50e113e2f9a4d Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Sun, 10 Mar 2019 17:21:10 -0400 Subject: [PATCH 4/5] Remove unneccessary string --- Emby.Server.Implementations/ServerApplicationPaths.cs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Emby.Server.Implementations/ServerApplicationPaths.cs b/Emby.Server.Implementations/ServerApplicationPaths.cs index 68d5881220..adaf23234f 100644 --- a/Emby.Server.Implementations/ServerApplicationPaths.cs +++ b/Emby.Server.Implementations/ServerApplicationPaths.cs @@ -35,12 +35,6 @@ namespace Emby.Server.Implementations /// The root folder path. public string RootFolderPath => Path.Combine(ProgramDataPath, "root"); -/* /// - /// Gets the path to the Web resources - /// - /// The web folder path. - public string WebPath => WebPath; */ - /// /// Gets the path to the default user view directory. Used if no specific user view is defined. /// From 3c4043199accbfe7995dd6060c89fc837300884a Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Tue, 12 Mar 2019 09:18:45 -0400 Subject: [PATCH 5/5] Implement review feedback --- Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs | 4 ++-- Emby.Server.Implementations/ApplicationHost.cs | 2 +- Jellyfin.Server/Program.cs | 2 +- Jellyfin.Server/StartupOptions.cs | 2 +- MediaBrowser.Common/Configuration/IApplicationPaths.cs | 4 ++-- MediaBrowser.Model/System/SystemInfo.cs | 4 ++-- MediaBrowser.WebDashboard/Api/DashboardService.cs | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs b/Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs index fd9ce3a364..00cfa0c9a9 100644 --- a/Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs +++ b/Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs @@ -36,9 +36,9 @@ namespace Emby.Server.Implementations.AppBase public string ProgramDataPath { get; private set; } /// - /// Gets the path to the web resources folder + /// Gets the path to the web UI resources folder /// - /// The web resources path. + /// The web UI resources path. public string WebPath { get; set; } /// diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index f240ef871a..14c700cc5d 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -621,7 +621,7 @@ namespace Emby.Server.Implementations string contentRoot = ServerConfigurationManager.Configuration.DashboardSourcePath; if (string.IsNullOrEmpty(contentRoot)) { - contentRoot = Path.Combine(ServerConfigurationManager.ApplicationPaths.WebPath, "src"); + contentRoot = ServerConfigurationManager.ApplicationPaths.WebPath; } var host = new WebHostBuilder() diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs index 8f1498b13b..7534a6398f 100644 --- a/Jellyfin.Server/Program.cs +++ b/Jellyfin.Server/Program.cs @@ -277,7 +277,7 @@ namespace Jellyfin.Server if (string.IsNullOrEmpty(webDir)) { // Use default location under ResourcesPath - webDir = Path.Combine(AppContext.BaseDirectory, "jellyfin-web"); + webDir = Path.Combine(AppContext.BaseDirectory, "jellyfin-web", "src"); } } diff --git a/Jellyfin.Server/StartupOptions.cs b/Jellyfin.Server/StartupOptions.cs index 2b01c7bbdf..345a8a731f 100644 --- a/Jellyfin.Server/StartupOptions.cs +++ b/Jellyfin.Server/StartupOptions.cs @@ -11,7 +11,7 @@ namespace Jellyfin.Server [Option('d', "datadir", Required = false, HelpText = "Path to use for the data folder (database files, etc.).")] public string DataDir { get; set; } - [Option('w', "webdir", Required = false, HelpText = "Path to the Jellyfin web resources.")] + [Option('w', "webdir", Required = false, HelpText = "Path to the Jellyfin web UI resources.")] public string WebDir { get; set; } [Option('C', "cachedir", Required = false, HelpText = "Path to use for caching.")] diff --git a/MediaBrowser.Common/Configuration/IApplicationPaths.cs b/MediaBrowser.Common/Configuration/IApplicationPaths.cs index 1f56c98fd8..fd11bf904f 100644 --- a/MediaBrowser.Common/Configuration/IApplicationPaths.cs +++ b/MediaBrowser.Common/Configuration/IApplicationPaths.cs @@ -12,9 +12,9 @@ namespace MediaBrowser.Common.Configuration string ProgramDataPath { get; } /// - /// Gets the path to the web resources folder + /// Gets the path to the web UI resources folder /// - /// The web resources path. + /// The web UI resources path. string WebPath { get; } /// diff --git a/MediaBrowser.Model/System/SystemInfo.cs b/MediaBrowser.Model/System/SystemInfo.cs index fa72624819..222c10798a 100644 --- a/MediaBrowser.Model/System/SystemInfo.cs +++ b/MediaBrowser.Model/System/SystemInfo.cs @@ -84,9 +84,9 @@ namespace MediaBrowser.Model.System public string ProgramDataPath { get; set; } /// - /// Gets or sets the web resources path. + /// Gets or sets the web UI resources path. /// - /// The web resources path. + /// The web UI resources path. public string WebPath { get; set; } /// diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.cs index 05df54b115..01cbe2c314 100644 --- a/MediaBrowser.WebDashboard/Api/DashboardService.cs +++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs @@ -149,7 +149,7 @@ namespace MediaBrowser.WebDashboard.Api return _serverConfigurationManager.Configuration.DashboardSourcePath; } - return Path.Combine(_serverConfigurationManager.ApplicationPaths.WebPath, "src"); + return _serverConfigurationManager.ApplicationPaths.WebPath; } }