aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server/Middleware/ServerStartupMessageMiddleware.cs
diff options
context:
space:
mode:
authorClaus Vium <clausvium@gmail.com>2020-09-03 11:54:38 +0200
committerClaus Vium <clausvium@gmail.com>2020-09-03 11:54:38 +0200
commit2f79c3095bb742136ff83141f42e344b33c3a45f (patch)
tree95cdd8edb775ad8658e451c9d7dd19fc1c476114 /Jellyfin.Server/Middleware/ServerStartupMessageMiddleware.cs
parent571d0570f5560bde79d21c33173742f6a31e24cf (diff)
Fix startup message
Diffstat (limited to 'Jellyfin.Server/Middleware/ServerStartupMessageMiddleware.cs')
-rw-r--r--Jellyfin.Server/Middleware/ServerStartupMessageMiddleware.cs13
1 files changed, 12 insertions, 1 deletions
diff --git a/Jellyfin.Server/Middleware/ServerStartupMessageMiddleware.cs b/Jellyfin.Server/Middleware/ServerStartupMessageMiddleware.cs
index 4f347d6d3..ea81c03a2 100644
--- a/Jellyfin.Server/Middleware/ServerStartupMessageMiddleware.cs
+++ b/Jellyfin.Server/Middleware/ServerStartupMessageMiddleware.cs
@@ -1,5 +1,6 @@
using System.Net.Mime;
using System.Threading.Tasks;
+using MediaBrowser.Controller;
using MediaBrowser.Model.Globalization;
using Microsoft.AspNetCore.Http;
@@ -25,10 +26,20 @@ namespace Jellyfin.Server.Middleware
/// Executes the middleware action.
/// </summary>
/// <param name="httpContext">The current HTTP context.</param>
+ /// <param name="serverApplicationHost">The server application host.</param>
/// <param name="localizationManager">The localization manager.</param>
/// <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");
httpContext.Response.StatusCode = StatusCodes.Status503ServiceUnavailable;
httpContext.Response.ContentType = MediaTypeNames.Text.Html;