Add IServerApplicationHost parameter to IPluginServiceRegistrator
This commit is contained in:
parent
2b742be38e
commit
1e1e1560a4
|
@ -12,10 +12,11 @@ using System.Threading.Tasks;
|
||||||
using Emby.Server.Implementations.Library;
|
using Emby.Server.Implementations.Library;
|
||||||
using Jellyfin.Extensions.Json;
|
using Jellyfin.Extensions.Json;
|
||||||
using Jellyfin.Extensions.Json.Converters;
|
using Jellyfin.Extensions.Json.Converters;
|
||||||
using MediaBrowser.Common;
|
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Common.Extensions;
|
||||||
using MediaBrowser.Common.Net;
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Common.Plugins;
|
using MediaBrowser.Common.Plugins;
|
||||||
|
using MediaBrowser.Controller;
|
||||||
|
using MediaBrowser.Controller.Plugins;
|
||||||
using MediaBrowser.Model.Configuration;
|
using MediaBrowser.Model.Configuration;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.Plugins;
|
using MediaBrowser.Model.Plugins;
|
||||||
|
@ -37,7 +38,7 @@ namespace Emby.Server.Implementations.Plugins
|
||||||
private readonly List<AssemblyLoadContext> _assemblyLoadContexts;
|
private readonly List<AssemblyLoadContext> _assemblyLoadContexts;
|
||||||
private readonly JsonSerializerOptions _jsonOptions;
|
private readonly JsonSerializerOptions _jsonOptions;
|
||||||
private readonly ILogger<PluginManager> _logger;
|
private readonly ILogger<PluginManager> _logger;
|
||||||
private readonly IApplicationHost _appHost;
|
private readonly IServerApplicationHost _appHost;
|
||||||
private readonly ServerConfiguration _config;
|
private readonly ServerConfiguration _config;
|
||||||
private readonly List<LocalPlugin> _plugins;
|
private readonly List<LocalPlugin> _plugins;
|
||||||
private readonly Version _minimumVersion;
|
private readonly Version _minimumVersion;
|
||||||
|
@ -48,13 +49,13 @@ namespace Emby.Server.Implementations.Plugins
|
||||||
/// Initializes a new instance of the <see cref="PluginManager"/> class.
|
/// Initializes a new instance of the <see cref="PluginManager"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="logger">The <see cref="ILogger{PluginManager}"/>.</param>
|
/// <param name="logger">The <see cref="ILogger{PluginManager}"/>.</param>
|
||||||
/// <param name="appHost">The <see cref="IApplicationHost"/>.</param>
|
/// <param name="appHost">The <see cref="IServerApplicationHost"/>.</param>
|
||||||
/// <param name="config">The <see cref="ServerConfiguration"/>.</param>
|
/// <param name="config">The <see cref="ServerConfiguration"/>.</param>
|
||||||
/// <param name="pluginsPath">The plugin path.</param>
|
/// <param name="pluginsPath">The plugin path.</param>
|
||||||
/// <param name="appVersion">The application version.</param>
|
/// <param name="appVersion">The application version.</param>
|
||||||
public PluginManager(
|
public PluginManager(
|
||||||
ILogger<PluginManager> logger,
|
ILogger<PluginManager> logger,
|
||||||
IApplicationHost appHost,
|
IServerApplicationHost appHost,
|
||||||
ServerConfiguration config,
|
ServerConfiguration config,
|
||||||
string pluginsPath,
|
string pluginsPath,
|
||||||
Version appVersion)
|
Version appVersion)
|
||||||
|
@ -222,7 +223,7 @@ namespace Emby.Server.Implementations.Plugins
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var instance = (IPluginServiceRegistrator?)Activator.CreateInstance(pluginServiceRegistrator);
|
var instance = (IPluginServiceRegistrator?)Activator.CreateInstance(pluginServiceRegistrator);
|
||||||
instance?.RegisterServices(serviceCollection);
|
instance?.RegisterServices(serviceCollection, _appHost);
|
||||||
}
|
}
|
||||||
#pragma warning disable CA1031 // Do not catch general exception types
|
#pragma warning disable CA1031 // Do not catch general exception types
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
namespace MediaBrowser.Common.Plugins
|
|
||||||
{
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Defines the <see cref="IPluginServiceRegistrator" />.
|
|
||||||
/// </summary>
|
|
||||||
public interface IPluginServiceRegistrator
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Registers the plugin's services with the service collection.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// This interface is only used for service registration and requires a parameterless constructor.
|
|
||||||
/// </remarks>
|
|
||||||
/// <param name="serviceCollection">The service collection.</param>
|
|
||||||
void RegisterServices(IServiceCollection serviceCollection);
|
|
||||||
}
|
|
||||||
}
|
|
19
MediaBrowser.Controller/Plugins/IPluginServiceRegistrator.cs
Normal file
19
MediaBrowser.Controller/Plugins/IPluginServiceRegistrator.cs
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Controller.Plugins;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines the <see cref="IPluginServiceRegistrator" />.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This interface is only used for service registration and requires a parameterless constructor.
|
||||||
|
/// </remarks>
|
||||||
|
public interface IPluginServiceRegistrator
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Registers the plugin's services with the service collection.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="serviceCollection">The service collection.</param>
|
||||||
|
/// <param name="applicationHost">The server application host.</param>
|
||||||
|
void RegisterServices(IServiceCollection serviceCollection, IServerApplicationHost applicationHost);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user