mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-09 03:04:20 -04:00
Cleaning plugin requirements
This commit is contained in:
parent
3e8dbc84a8
commit
709e12191d
@ -1,20 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Kyoo.Models.Exceptions
|
||||
{
|
||||
/// <summary>
|
||||
/// An exception raised when a plugin requires dependencies that can't be found with the current configuration.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class MissingDependencyException : Exception
|
||||
{
|
||||
/// <summary>
|
||||
/// Create a new <see cref="MissingDependencyException"/> with a custom message
|
||||
/// </summary>
|
||||
/// <param name="plugin">The name of the plugin that can't be loaded.</param>
|
||||
/// <param name="dependency">The name of the missing dependency.</param>
|
||||
public MissingDependencyException(string plugin, string dependency)
|
||||
: base($"No {dependency} are available in Kyoo but the plugin {plugin} requires it.")
|
||||
{}
|
||||
}
|
||||
}
|
@ -4,7 +4,6 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Loader;
|
||||
using Kyoo.Models.Exceptions;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
@ -106,8 +105,8 @@ namespace Kyoo.Controllers
|
||||
if (missing == null)
|
||||
return true;
|
||||
|
||||
Exception error = new MissingDependencyException(plugin.Name, missing.Name);
|
||||
_logger.LogCritical(error, "A plugin's dependency could not be met");
|
||||
_logger.LogCritical("No {Dependency} available in Kyoo but the plugin {Plugin} requires it",
|
||||
missing.Name, plugin.Name);
|
||||
return false;
|
||||
}));
|
||||
|
||||
|
@ -48,7 +48,20 @@ namespace Kyoo
|
||||
};
|
||||
|
||||
/// <inheritdoc />
|
||||
public ICollection<Type> Requires => ArraySegment<Type>.Empty;
|
||||
public ICollection<Type> Requires => new []
|
||||
{
|
||||
typeof(ILibraryRepository),
|
||||
typeof(ILibraryItemRepository),
|
||||
typeof(ICollectionRepository),
|
||||
typeof(IShowRepository),
|
||||
typeof(ISeasonRepository),
|
||||
typeof(IEpisodeRepository),
|
||||
typeof(ITrackRepository),
|
||||
typeof(IPeopleRepository),
|
||||
typeof(IStudioRepository),
|
||||
typeof(IGenreRepository),
|
||||
typeof(IProviderRepository)
|
||||
};
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Configure(IServiceCollection services, ICollection<Type> availableTypes)
|
||||
|
Loading…
x
Reference in New Issue
Block a user