Fix IWebSocketListener service registration

This commit is contained in:
cvium
2020-10-06 14:44:07 +02:00
parent 5e11eb0359
commit 38cb8fee8a
4 changed files with 17 additions and 19 deletions

View File

@@ -4,6 +4,8 @@ using System.IO;
using System.Reflection;
using Emby.Drawing;
using Emby.Server.Implementations;
using Emby.Server.Implementations.Session;
using Jellyfin.Api.WebSocketListeners;
using Jellyfin.Drawing.Skia;
using Jellyfin.Server.Implementations;
using Jellyfin.Server.Implementations.Activity;
@@ -14,6 +16,7 @@ using MediaBrowser.Controller;
using MediaBrowser.Controller.Drawing;
using MediaBrowser.Controller.Events;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Activity;
using MediaBrowser.Model.IO;
using Microsoft.EntityFrameworkCore;
@@ -80,6 +83,14 @@ namespace Jellyfin.Server
ServiceCollection.AddSingleton<IUserManager, UserManager>();
ServiceCollection.AddSingleton<IDisplayPreferencesManager, DisplayPreferencesManager>();
ServiceCollection.AddScoped<IWebSocketListener, SessionWebSocketListener>();
ServiceCollection.AddScoped<IWebSocketListener, ActivityLogWebSocketListener>();
ServiceCollection.AddScoped<IWebSocketListener, ScheduledTasksWebSocketListener>();
ServiceCollection.AddScoped<IWebSocketListener, SessionInfoWebSocketListener>();
// TODO fix circular dependency on IWebSocketManager
ServiceCollection.AddScoped(serviceProvider => new Lazy<IEnumerable<IWebSocketListener>>(serviceProvider.GetRequiredService<IEnumerable<IWebSocketListener>>));
base.RegisterServices();
}

View File

@@ -378,7 +378,7 @@ namespace Jellyfin.Server
.ConfigureServices(services =>
{
// Merge the external ServiceCollection into ASP.NET DI
services.TryAdd(serviceCollection);
services.Add(serviceCollection);
})
.UseStartup<Startup>();
}