Merge pull request #1092 from joshuaboniface/configurable-webdir

Add configurable webdir option
This commit is contained in:
Joshua M. Boniface 2019-03-12 12:51:11 -04:00 committed by GitHub
commit 6751560228
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 50 additions and 6 deletions

View File

@ -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>

View File

@ -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,

View File

@ -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)
{
}

View File

@ -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)

View File

@ -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; }

View File

@ -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>

View File

@ -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>

View File

@ -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;
}
}