mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-08 23:00:51 +02:00
Fix startup message
This commit is contained in:
parent
571d0570f5
commit
2f79c3095b
|
@ -132,6 +132,8 @@ namespace Emby.Server.Implementations
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool CanSelfRestart => _startupOptions.RestartPath != null;
|
public bool CanSelfRestart => _startupOptions.RestartPath != null;
|
||||||
|
|
||||||
|
public bool CoreStartupHasCompleted { get; private set; }
|
||||||
|
|
||||||
public virtual bool CanLaunchWebBrowser
|
public virtual bool CanLaunchWebBrowser
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -446,7 +448,7 @@ namespace Emby.Server.Implementations
|
||||||
Logger.LogInformation("Executed all pre-startup entry points in {Elapsed:g}", stopWatch.Elapsed);
|
Logger.LogInformation("Executed all pre-startup entry points in {Elapsed:g}", stopWatch.Elapsed);
|
||||||
|
|
||||||
Logger.LogInformation("Core startup complete");
|
Logger.LogInformation("Core startup complete");
|
||||||
|
CoreStartupHasCompleted = true;
|
||||||
stopWatch.Restart();
|
stopWatch.Restart();
|
||||||
await Task.WhenAll(StartEntryPoints(entryPoints, false)).ConfigureAwait(false);
|
await Task.WhenAll(StartEntryPoints(entryPoints, false)).ConfigureAwait(false);
|
||||||
Logger.LogInformation("Executed all post-startup entry points in {Elapsed:g}", stopWatch.Elapsed);
|
Logger.LogInformation("Executed all post-startup entry points in {Elapsed:g}", stopWatch.Elapsed);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System.Net.Mime;
|
using System.Net.Mime;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using MediaBrowser.Controller;
|
||||||
using MediaBrowser.Model.Globalization;
|
using MediaBrowser.Model.Globalization;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
|
||||||
|
@ -25,10 +26,20 @@ namespace Jellyfin.Server.Middleware
|
||||||
/// Executes the middleware action.
|
/// Executes the middleware action.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="httpContext">The current HTTP context.</param>
|
/// <param name="httpContext">The current HTTP context.</param>
|
||||||
|
/// <param name="serverApplicationHost">The server application host.</param>
|
||||||
/// <param name="localizationManager">The localization manager.</param>
|
/// <param name="localizationManager">The localization manager.</param>
|
||||||
/// <returns>The async task.</returns>
|
/// <returns>The async task.</returns>
|
||||||
public async Task Invoke(HttpContext httpContext, ILocalizationManager localizationManager)
|
public async Task Invoke(
|
||||||
|
HttpContext httpContext,
|
||||||
|
IServerApplicationHost serverApplicationHost,
|
||||||
|
ILocalizationManager localizationManager)
|
||||||
{
|
{
|
||||||
|
if (serverApplicationHost.CoreStartupHasCompleted)
|
||||||
|
{
|
||||||
|
await _next(httpContext).ConfigureAwait(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var message = localizationManager.GetLocalizedString("StartupEmbyServerIsLoading");
|
var message = localizationManager.GetLocalizedString("StartupEmbyServerIsLoading");
|
||||||
httpContext.Response.StatusCode = StatusCodes.Status503ServiceUnavailable;
|
httpContext.Response.StatusCode = StatusCodes.Status503ServiceUnavailable;
|
||||||
httpContext.Response.ContentType = MediaTypeNames.Text.Html;
|
httpContext.Response.ContentType = MediaTypeNames.Text.Html;
|
||||||
|
|
|
@ -123,6 +123,7 @@ namespace Jellyfin.Server
|
||||||
app.UseCorsOptionsResponse();
|
app.UseCorsOptionsResponse();
|
||||||
app.UseBaseUrlRedirection();
|
app.UseBaseUrlRedirection();
|
||||||
app.UseWebSocketHandler();
|
app.UseWebSocketHandler();
|
||||||
|
app.UseServerStartupMessage();
|
||||||
|
|
||||||
app.UseEndpoints(endpoints =>
|
app.UseEndpoints(endpoints =>
|
||||||
{
|
{
|
||||||
|
@ -133,8 +134,6 @@ namespace Jellyfin.Server
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.UseServerStartupMessage();
|
|
||||||
|
|
||||||
// Add type descriptor for legacy datetime parsing.
|
// Add type descriptor for legacy datetime parsing.
|
||||||
TypeDescriptor.AddAttributes(typeof(DateTime?), new TypeConverterAttribute(typeof(DateTimeTypeConverter)));
|
TypeDescriptor.AddAttributes(typeof(DateTime?), new TypeConverterAttribute(typeof(DateTimeTypeConverter)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,8 @@ namespace MediaBrowser.Controller
|
||||||
|
|
||||||
IServiceProvider ServiceProvider { get; }
|
IServiceProvider ServiceProvider { get; }
|
||||||
|
|
||||||
|
bool CoreStartupHasCompleted { get; }
|
||||||
|
|
||||||
bool CanLaunchWebBrowser { get; }
|
bool CanLaunchWebBrowser { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Reference in a new issue