mirror of
https://github.com/Cleanuparr/Cleanuparr.git
synced 2026-04-08 08:09:15 -04:00
* refactored code added deluge support added transmission support added content blocker added blacklist and whitelist * increased level on some logs; updated test docker compose; updated dev appsettings * updated docker compose and readme * moved some logs * fixed env var typo; fixed sonarr and radarr default download client
40 lines
1.1 KiB
C#
40 lines
1.1 KiB
C#
namespace Common.Configuration.ContentBlocker;
|
|
|
|
public sealed record ContentBlockerConfig : IConfig
|
|
{
|
|
public const string SectionName = "ContentBlocker";
|
|
|
|
public required bool Enabled { get; init; }
|
|
|
|
public PatternConfig? Blacklist { get; init; }
|
|
|
|
public PatternConfig? Whitelist { get; init; }
|
|
|
|
public void Validate()
|
|
{
|
|
if (!Enabled)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (Blacklist is null && Whitelist is null)
|
|
{
|
|
throw new Exception("content blocker is enabled, but both blacklist and whitelist are missing");
|
|
}
|
|
|
|
if (Blacklist?.Enabled is true && Whitelist?.Enabled is true)
|
|
{
|
|
throw new Exception("only one exclusion (blacklist/whitelist) list is allowed");
|
|
}
|
|
|
|
if (Blacklist?.Enabled is true && string.IsNullOrEmpty(Blacklist.Path))
|
|
{
|
|
throw new Exception("blacklist path is required");
|
|
}
|
|
|
|
if (Whitelist?.Enabled is true && string.IsNullOrEmpty(Whitelist.Path))
|
|
{
|
|
throw new Exception("blacklist path is required");
|
|
}
|
|
}
|
|
} |