mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-24 22:35:39 -04:00
removed NzbDrone.Console dependency to UI components
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AspNet.SignalR;
|
||||
using NzbDrone.Api.SignalR;
|
||||
using NzbDrone.Common.Composition;
|
||||
using Owin;
|
||||
|
||||
namespace NzbDrone.Host.Owin.MiddleWare
|
||||
{
|
||||
public class SignalRMiddleWare : IOwinMiddleWare
|
||||
{
|
||||
private readonly IEnumerable<NzbDronePersistentConnection> _persistentConnections;
|
||||
|
||||
public int Order { get { return 0; } }
|
||||
|
||||
public SignalRMiddleWare(IEnumerable<NzbDronePersistentConnection> persistentConnections, IContainer container)
|
||||
{
|
||||
_persistentConnections = persistentConnections;
|
||||
|
||||
SignalrDependencyResolver.Register(container);
|
||||
}
|
||||
|
||||
public void Attach(IAppBuilder appBuilder)
|
||||
{
|
||||
foreach (var nzbDronePersistentConnection in _persistentConnections)
|
||||
{
|
||||
var url = string.Format("signalr/{0}", nzbDronePersistentConnection.Resource.Trim('/'));
|
||||
appBuilder.MapConnection(url, nzbDronePersistentConnection.GetType(), new ConnectionConfiguration { EnableCrossDomain = true });
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user