From 176d09016497524c83f0ff9f0cc99a5ae433dad5 Mon Sep 17 00:00:00 2001 From: LukePulverenti Date: Mon, 4 Mar 2013 23:34:00 -0500 Subject: [PATCH] removed plugin configuration pages from the kernel --- MediaBrowser.Controller/Kernel.cs | 7 ---- .../WebSocketEvents.cs | 2 +- .../Api/DashboardService.cs | 4 +-- .../MediaBrowser.WebDashboard.csproj | 1 + MediaBrowser.WebDashboard/ServerEntryPoint.cs | 34 +++++++++++++++++++ 5 files changed, 38 insertions(+), 10 deletions(-) create mode 100644 MediaBrowser.WebDashboard/ServerEntryPoint.cs diff --git a/MediaBrowser.Controller/Kernel.cs b/MediaBrowser.Controller/Kernel.cs index 947fb8e6d1..2cf6fd1888 100644 --- a/MediaBrowser.Controller/Kernel.cs +++ b/MediaBrowser.Controller/Kernel.cs @@ -74,12 +74,6 @@ namespace MediaBrowser.Controller /// The string files. public IEnumerable StringFiles { get; private set; } - /// - /// Gets the list of plugin configuration pages - /// - /// The configuration pages. - public IEnumerable PluginConfigurationPages { get; private set; } - /// /// Gets the list of currently registered weather prvoiders /// @@ -204,7 +198,6 @@ namespace MediaBrowser.Controller DisplayPreferencesRepositories = ApplicationHost.GetExports(); ItemRepositories = ApplicationHost.GetExports(); WeatherProviders = ApplicationHost.GetExports(); - PluginConfigurationPages = ApplicationHost.GetExports(); ImageEnhancers = ApplicationHost.GetExports().OrderBy(e => e.Priority).ToArray(); StringFiles = ApplicationHost.GetExports(); MetadataProviders = ApplicationHost.GetExports().OrderBy(e => e.Priority).ToArray(); diff --git a/MediaBrowser.ServerApplication/WebSocketEvents.cs b/MediaBrowser.ServerApplication/WebSocketEvents.cs index 4d6720869d..caa4ca2abc 100644 --- a/MediaBrowser.ServerApplication/WebSocketEvents.cs +++ b/MediaBrowser.ServerApplication/WebSocketEvents.cs @@ -14,7 +14,7 @@ namespace MediaBrowser.ServerApplication /// /// Class WebSocketEvents /// - public class WebSocketEvents : IServerEntryPoint, IDisposable + public class WebSocketEvents : IServerEntryPoint { /// /// The _server manager diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.cs index 1603fc9eb1..4cc34ba28b 100644 --- a/MediaBrowser.WebDashboard/Api/DashboardService.cs +++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs @@ -147,7 +147,7 @@ namespace MediaBrowser.WebDashboard.Api /// System.Object. public object Get(GetDashboardConfigurationPage request) { - var page = Kernel.Instance.PluginConfigurationPages.First(p => p.Name.Equals(request.Name, StringComparison.OrdinalIgnoreCase)); + var page = ServerEntryPoint.Instance.PluginConfigurationPages.First(p => p.Name.Equals(request.Name, StringComparison.OrdinalIgnoreCase)); return ToStaticResult(page.Version.GetMD5(), page.DateLastModified, null, MimeTypes.GetMimeType("page.html"), () => ModifyHtml(page.GetHtmlStream())); } @@ -159,7 +159,7 @@ namespace MediaBrowser.WebDashboard.Api /// System.Object. public object Get(GetDashboardConfigurationPages request) { - var pages = Kernel.Instance.PluginConfigurationPages; + var pages = ServerEntryPoint.Instance.PluginConfigurationPages; if (request.PageType.HasValue) { diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj index 4d1685d026..6e51ad0d2f 100644 --- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj +++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj @@ -85,6 +85,7 @@ + diff --git a/MediaBrowser.WebDashboard/ServerEntryPoint.cs b/MediaBrowser.WebDashboard/ServerEntryPoint.cs new file mode 100644 index 0000000000..690c07d8ff --- /dev/null +++ b/MediaBrowser.WebDashboard/ServerEntryPoint.cs @@ -0,0 +1,34 @@ +using MediaBrowser.Common; +using MediaBrowser.Controller.Plugins; +using System.Collections.Generic; + +namespace MediaBrowser.WebDashboard +{ + public class ServerEntryPoint : IServerEntryPoint + { + /// + /// Gets the list of plugin configuration pages + /// + /// The configuration pages. + public IEnumerable PluginConfigurationPages { get; private set; } + + private readonly IApplicationHost _appHost; + + public static ServerEntryPoint Instance { get; private set; } + + public ServerEntryPoint(IApplicationHost appHost) + { + _appHost = appHost; + Instance = this; + } + + public void Run() + { + PluginConfigurationPages = _appHost.GetExports(); + } + + public void Dispose() + { + } + } +}