mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-09 07:10:34 +02:00
Do not set a static content root if the jellyfin-web directory does not exist or is empty
This commit is contained in:
parent
f11678ae4b
commit
26af5ea45a
|
@ -40,7 +40,7 @@ namespace Emby.Server.Implementations.AppBase
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the path to the web UI resources folder.
|
/// Gets the path to the web UI resources folder.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The web UI resources path.</value>
|
/// <value>The web UI resources path, or null if the server is not hosting any web content.</value>
|
||||||
public string WebPath { get; }
|
public string WebPath { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -240,7 +240,7 @@ namespace Emby.Server.Implementations
|
||||||
public int HttpsPort { get; private set; }
|
public int HttpsPort { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the content root for the webhost.
|
/// Gets the content root for the webhost. If the webhost is not serving static web content, this will be null.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ContentRoot { get; private set; }
|
public string ContentRoot { get; private set; }
|
||||||
|
|
||||||
|
|
|
@ -222,7 +222,7 @@ namespace Jellyfin.Server
|
||||||
|
|
||||||
private static IWebHostBuilder CreateWebHostBuilder(ApplicationHost appHost, IServiceCollection serviceCollection)
|
private static IWebHostBuilder CreateWebHostBuilder(ApplicationHost appHost, IServiceCollection serviceCollection)
|
||||||
{
|
{
|
||||||
return new WebHostBuilder()
|
var webhostBuilder = new WebHostBuilder()
|
||||||
.UseKestrel(options =>
|
.UseKestrel(options =>
|
||||||
{
|
{
|
||||||
var addresses = appHost.ServerConfigurationManager
|
var addresses = appHost.ServerConfigurationManager
|
||||||
|
@ -260,13 +260,20 @@ namespace Jellyfin.Server
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.UseContentRoot(appHost.ContentRoot)
|
|
||||||
.ConfigureServices(services =>
|
.ConfigureServices(services =>
|
||||||
{
|
{
|
||||||
// Merge the external ServiceCollection into ASP.NET DI
|
// Merge the external ServiceCollection into ASP.NET DI
|
||||||
services.TryAdd(serviceCollection);
|
services.TryAdd(serviceCollection);
|
||||||
})
|
})
|
||||||
.UseStartup<Startup>();
|
.UseStartup<Startup>();
|
||||||
|
|
||||||
|
// Set the root directory for static content, if one exists
|
||||||
|
if (!string.IsNullOrEmpty(appHost.ContentRoot))
|
||||||
|
{
|
||||||
|
webhostBuilder.UseContentRoot(appHost.ContentRoot);
|
||||||
|
}
|
||||||
|
|
||||||
|
return webhostBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -383,7 +390,7 @@ namespace Jellyfin.Server
|
||||||
// webDir
|
// webDir
|
||||||
// IF --webdir
|
// IF --webdir
|
||||||
// ELSE IF $JELLYFIN_WEB_DIR
|
// ELSE IF $JELLYFIN_WEB_DIR
|
||||||
// ELSE use <bindir>/jellyfin-web
|
// ELSE <bindir>/jellyfin-web
|
||||||
var webDir = options.WebDir;
|
var webDir = options.WebDir;
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(webDir))
|
if (string.IsNullOrEmpty(webDir))
|
||||||
|
@ -397,6 +404,13 @@ namespace Jellyfin.Server
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reset webDir if the directory does not exist, or is empty
|
||||||
|
if (!Directory.Exists(webDir) || !Directory.GetFiles(webDir).Any())
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Server will not host static content because the web content directory does not exist or is empty: {ContentRoot}", webDir);
|
||||||
|
webDir = null;
|
||||||
|
}
|
||||||
|
|
||||||
// logDir
|
// logDir
|
||||||
// IF --logdir
|
// IF --logdir
|
||||||
// ELSE IF $JELLYFIN_LOG_DIR
|
// ELSE IF $JELLYFIN_LOG_DIR
|
||||||
|
|
Loading…
Reference in a new issue