Explorar el Código

Merge pull request #1092 from joshuaboniface/configurable-webdir

Add configurable webdir option
Joshua M. Boniface hace 6 años
padre
commit
6751560228

+ 9 - 1
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");
         }
@@ -33,6 +35,12 @@ namespace Emby.Server.Implementations.AppBase
         /// <value>The program data path.</value>
         public string ProgramDataPath { get; private set; }
 
+        /// <summary>
+        /// Gets the path to the web UI resources folder
+        /// </summary>
+        /// <value>The web UI resources path.</value>
+        public string WebPath { get; set; }
+
         /// <summary>
         /// Gets the path to the system folder
         /// </summary>

+ 3 - 1
Emby.Server.Implementations/ApplicationHost.cs

@@ -617,7 +617,7 @@ namespace Emby.Server.Implementations
             string contentRoot = ServerConfigurationManager.Configuration.DashboardSourcePath;
             if (string.IsNullOrEmpty(contentRoot))
             {
-                contentRoot = Path.Combine(ServerConfigurationManager.ApplicationPaths.ApplicationResourcesPath, "jellyfin-web", "src");
+                contentRoot = ServerConfigurationManager.ApplicationPaths.WebPath;
             }
 
             var host = new WebHostBuilder()
@@ -914,6 +914,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);
         }
 
@@ -1386,6 +1387,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,

+ 4 - 2
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)
         {
         }
 

+ 18 - 1
Jellyfin.Server/Program.cs

@@ -262,6 +262,23 @@ namespace Jellyfin.Server
                 }
             }
 
+            // webDir
+            // IF      --webdir
+            // ELSE IF $JELLYFIN_WEB_DIR
+            // ELSE    use <bindir>/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", "src");
+                }
+            }
+
             // logDir
             // IF      --logdir
             // ELSE IF $JELLYFIN_LOG_DIR
@@ -295,7 +312,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<IConfiguration> CreateConfiguration(IApplicationPaths appPaths)

+ 3 - 0
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 UI resources.")]
+        public string WebDir { get; set; }
+
         [Option('C', "cachedir", Required = false, HelpText = "Path to use for caching.")]
         public string CacheDir { get; set; }
 

+ 6 - 0
MediaBrowser.Common/Configuration/IApplicationPaths.cs

@@ -11,6 +11,12 @@ namespace MediaBrowser.Common.Configuration
         /// <value>The program data path.</value>
         string ProgramDataPath { get; }
 
+        /// <summary>
+        /// Gets the path to the web UI resources folder
+        /// </summary>
+        /// <value>The web UI resources path.</value>
+        string WebPath { get; }
+
         /// <summary>
         /// Gets the path to the program system folder
         /// </summary>

+ 6 - 0
MediaBrowser.Model/System/SystemInfo.cs

@@ -83,6 +83,12 @@ namespace MediaBrowser.Model.System
         /// <value>The program data path.</value>
         public string ProgramDataPath { get; set; }
 
+        /// <summary>
+        /// Gets or sets the web UI resources path.
+        /// </summary>
+        /// <value>The web UI resources path.</value>
+        public string WebPath { get; set; }
+
         /// <summary>
         /// Gets or sets the items by name path.
         /// </summary>

+ 1 - 1
MediaBrowser.WebDashboard/Api/DashboardService.cs

@@ -154,7 +154,7 @@ namespace MediaBrowser.WebDashboard.Api
                     return _serverConfigurationManager.Configuration.DashboardSourcePath;
                 }
 
-                return Path.Combine(_serverConfigurationManager.ApplicationPaths.ApplicationResourcesPath, "jellyfin-web", "src");
+                return _serverConfigurationManager.ApplicationPaths.WebPath;
             }
         }