mirror of
https://github.com/zoriya/Kyoo.git
synced 2026-05-30 02:52:27 -04:00
Reworking the plugin interface and moving the database to an external dll
This commit is contained in:
@@ -1,8 +1,14 @@
|
||||
using JetBrains.Annotations;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Unity;
|
||||
|
||||
namespace Kyoo.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// A common interface used to discord plugins
|
||||
/// </summary>
|
||||
[UsedImplicitly(ImplicitUseTargetFlags.WithInheritors)]
|
||||
public interface IPlugin
|
||||
{
|
||||
/// <summary>
|
||||
@@ -19,21 +25,35 @@ namespace Kyoo.Controllers
|
||||
/// The description of this plugin. This will be displayed on the "installed plugins" page.
|
||||
/// </summary>
|
||||
string Description { get; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A configure method that will be runned on plugin's startup.
|
||||
/// A list of services that are provided by this service. This allow other plugins to declare dependencies.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// You can have use any services as parameter, they will be injected from the service provider
|
||||
/// You can add managed types or any type you like using the IUnityContainer like so:
|
||||
/// <code>
|
||||
/// public static void Configure(IUnityContainer services)
|
||||
/// {
|
||||
/// services.AddTask<MyTask>()
|
||||
/// }
|
||||
/// </code>
|
||||
/// The format should be the name of the interface ':' and the name of the implementation.
|
||||
/// For a plugins that provide a new service named IService with a default implementation named Koala, that would
|
||||
/// be "IService:Koala".
|
||||
/// </remarks>
|
||||
static void Configure() { }
|
||||
string[] Provides { get; }
|
||||
|
||||
/// <summary>
|
||||
/// A list of services that are required by this service.
|
||||
/// The Core will warn the user that this plugin can't be loaded if a required service is not found.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is the same format as <see cref="Provides"/> but you may leave a blank implementation's name if you don't need a special one.
|
||||
/// For example, if you need a service named IService but you don't care what implementation it will be, you can use
|
||||
/// "IService:"
|
||||
/// </remarks>
|
||||
string[] Requires { get; }
|
||||
|
||||
/// <summary>
|
||||
/// A configure method that will be run on plugin's startup.
|
||||
/// </summary>
|
||||
/// <param name="container">A unity container to register new services.</param>
|
||||
/// <param name="config">The configuration, if you need values at config time (database connection strings...)</param>
|
||||
/// <param name="app">The Asp.Net application builder. On most case it is not needed but you can use it to add asp net functionalities.</param>
|
||||
/// <param name="debugMode">True if the app should run in debug mode.</param>
|
||||
void Configure(IUnityContainer container, IConfiguration config, IApplicationBuilder app, bool debugMode);
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ namespace Kyoo.Controllers
|
||||
/// <param name="arguments">A list of arguments to pass to the task. An automatic conversion will be made if arguments to not fit.</param>
|
||||
/// <exception cref="ArgumentException">If the number of arguments is invalid or if an argument can't be converted.</exception>
|
||||
/// <exception cref="ItemNotFound">The task could not be found.</exception>
|
||||
void StartTask(string taskSlug, Dictionary<string, object> arguments);
|
||||
void StartTask(string taskSlug, Dictionary<string, object> arguments = null);
|
||||
|
||||
/// <summary>
|
||||
/// Get all currently running tasks
|
||||
|
||||
Reference in New Issue
Block a user