mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-16 10:03:51 -07:00
fixed schema support for indexers
This commit is contained in:
parent
0eec2cd5f7
commit
4f9b745e70
3 changed files with 29 additions and 21 deletions
|
@ -63,15 +63,17 @@ namespace NzbDrone.Api.Indexers
|
|||
{
|
||||
var indexer = GetDefinition(indexerResource);
|
||||
|
||||
ValidateIndexer(indexer.Settings);
|
||||
ValidateIndexer(indexer);
|
||||
|
||||
_indexerService.Update(indexer);
|
||||
}
|
||||
|
||||
|
||||
private static void ValidateIndexer(IProviderConfig config)
|
||||
private static void ValidateIndexer(ProviderDefinition definition)
|
||||
{
|
||||
var validationResult = config.Validate();
|
||||
if (!definition.Enable) return;
|
||||
|
||||
var validationResult = definition.Settings.Validate();
|
||||
|
||||
if (!validationResult.IsValid)
|
||||
{
|
||||
|
@ -89,10 +91,7 @@ namespace NzbDrone.Api.Indexers
|
|||
var configContract = ReflectionExtensions.CoreAssembly.FindTypeByName(definition.ConfigContract);
|
||||
definition.Settings = (IProviderConfig)SchemaBuilder.ReadFormSchema(indexerResource.Fields, configContract);
|
||||
|
||||
if (indexerResource.Enable)
|
||||
{
|
||||
ValidateIndexer(definition.Settings);
|
||||
}
|
||||
ValidateIndexer(definition);
|
||||
|
||||
return definition;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue