Your ROOT_URL in app.ini is https://git.cloudchain.link/ but you are visiting https://dash.bss.nz/open-source-mirrors/Lidarr/commit/5d3ff26703e3fcc3646d58353c26d4808ae789e5
You should set ROOT_URL correctly, otherwise the web may not work correctly.
2 changed files with
46 additions and
0 deletions
@ -17,6 +17,8 @@ namespace Lidarr.Api.V1.Profiles.Quality
ruleBuilder . SetValidator ( new ItemGroupIdValidator < T > ( ) ) ;
ruleBuilder . SetValidator ( new UniqueIdValidator < T > ( ) ) ;
ruleBuilder . SetValidator ( new UniqueQualityIdValidator < T > ( ) ) ;
ruleBuilder . SetValidator ( new AllQualitiesValidator < T > ( ) ) ;
return ruleBuilder . SetValidator ( new ItemGroupNameValidator < T > ( ) ) ;
}
}
@ -151,4 +153,46 @@ namespace Lidarr.Api.V1.Profiles.Quality
return true ;
}
}
public class AllQualitiesValidator < T > : PropertyValidator
{
protected override string GetDefaultMessageTemplate ( ) = > "Must contain all qualities" ;
protected override bool IsValid ( PropertyValidatorContext context )
{
if ( context . PropertyValue is not IList < QualityProfileQualityItemResource > items )
{
return false ;
}
var qualityIds = new HashSet < int > ( ) ;
foreach ( var item in items )
{
if ( item . Id > 0 )
{
foreach ( var quality in item . Items )
{
qualityIds . Add ( quality . Quality . Id ) ;
}
}
else
{
qualityIds . Add ( item . Quality . Id ) ;
}
}
var allQualityIds = NzbDrone . Core . Qualities . Quality . All ;
foreach ( var quality in allQualityIds )
{
if ( ! qualityIds . Contains ( quality . Id ) )
{
return false ;
}
}
return true ;
}
}
}
@ -24,6 +24,7 @@ namespace Lidarr.Api.V1.Profiles.Quality
SharedValidator . RuleFor ( c = > c . Name ) . NotEmpty ( ) ;
SharedValidator . RuleFor ( c = > c . Cutoff ) . ValidCutoff ( ) ;
SharedValidator . RuleFor ( c = > c . Items ) . ValidItems ( ) ;
SharedValidator . RuleFor ( c = > c . FormatItems ) . Must ( items = >
{
var all = _formatService . All ( ) . Select ( f = > f . Id ) . ToList ( ) ;
@ -31,6 +32,7 @@ namespace Lidarr.Api.V1.Profiles.Quality
return all . Except ( ids ) . Empty ( ) ;
} ) . WithMessage ( "All Custom Formats and no extra ones need to be present inside your Profile! Try refreshing your browser." ) ;
SharedValidator . RuleFor ( c = > c ) . Custom ( ( profile , context ) = >
{
if ( profile . FormatItems . Where ( x = > x . Score > 0 ) . Sum ( x = > x . Score ) < profile . MinFormatScore & &