Compare commits

...

4 Commits

Author SHA1 Message Date
Flaminel
cc45233223 Add support for basic auth for Apprise (#221) 2025-07-03 12:43:43 +03:00
Flaminel
5d12d601ae fixed repo links in the docs 2025-07-01 22:02:14 +03:00
Flaminel
88f40438af Fix validations and increased strikes limits (#212) 2025-07-01 13:18:50 +03:00
Flaminel
0a9ec06841 removed forgotten release step from MacOS workflow 2025-07-01 11:05:00 +03:00
46 changed files with 855 additions and 129 deletions

View File

@@ -363,14 +363,4 @@ jobs:
path: '${{ env.pkgName }}'
retention-days: 30
- name: Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
name: ${{ env.releaseVersion }}
tag_name: ${{ env.releaseVersion }}
repository: ${{ env.githubRepository }}
token: ${{ env.REPO_READONLY_PAT }}
make_latest: true
files: |
${{ env.pkgName }}
# Removed individual release step - handled by main release workflow

View File

@@ -3,7 +3,6 @@ using Cleanuparr.Application.Features.Arr.Dtos;
using Cleanuparr.Application.Features.DownloadClient.Dtos;
using Cleanuparr.Domain.Enums;
using Cleanuparr.Domain.Exceptions;
using Cleanuparr.Infrastructure.Helpers;
using Cleanuparr.Infrastructure.Http.DynamicHttpClientSystem;
using Cleanuparr.Infrastructure.Logging;
using Cleanuparr.Infrastructure.Models;

View File

@@ -1,11 +1,11 @@
using System.Text.Json.Serialization;
using Cleanuparr.Infrastructure.Features.DownloadRemover.Consumers;
using Cleanuparr.Infrastructure.Features.Notifications.Consumers;
using Cleanuparr.Infrastructure.Features.Notifications.Models;
using Cleanuparr.Infrastructure.Health;
using Cleanuparr.Infrastructure.Http;
using Cleanuparr.Infrastructure.Http.DynamicHttpClientSystem;
using Data.Models.Arr;
using Infrastructure.Verticals.Notifications.Models;
using MassTransit;
using Microsoft.Extensions.Caching.Memory;

View File

@@ -3,13 +3,11 @@ using Cleanuparr.Infrastructure.Features.Notifications.Models;
using Cleanuparr.Persistence;
using Cleanuparr.Persistence.Models.Configuration.Notification;
using Infrastructure.Verticals.Notifications;
using Infrastructure.Verticals.Notifications.Models;
namespace Cleanuparr.Infrastructure.Features.Notifications.Apprise;
public sealed class AppriseProvider : NotificationProvider<AppriseConfig>
{
private readonly DataContext _dataContext;
private readonly IAppriseProxy _proxy;
public override string Name => "Apprise";
@@ -17,7 +15,6 @@ public sealed class AppriseProvider : NotificationProvider<AppriseConfig>
public AppriseProvider(DataContext dataContext, IAppriseProxy proxy)
: base(dataContext.AppriseConfigs)
{
_dataContext = dataContext;
_proxy = proxy;
}

View File

@@ -1,4 +1,5 @@
using System.Text;
using System.Net.Http.Headers;
using System.Text;
using Cleanuparr.Persistence.Models.Configuration.Notification;
using Cleanuparr.Shared.Helpers;
using Newtonsoft.Json;
@@ -22,12 +23,18 @@ public sealed class AppriseProxy : IAppriseProxy
ContractResolver = new CamelCasePropertyNamesContractResolver()
});
UriBuilder uriBuilder = new(config.Url);
UriBuilder uriBuilder = new(config.Url.ToString());
uriBuilder.Path = $"{uriBuilder.Path.TrimEnd('/')}/notify/{config.Key}";
using HttpRequestMessage request = new(HttpMethod.Post, uriBuilder.Uri);
request.Method = HttpMethod.Post;
request.Content = new StringContent(content, Encoding.UTF8, "application/json");
if (!string.IsNullOrEmpty(config.Url.UserInfo))
{
var byteArray = Encoding.ASCII.GetBytes(config.Url.UserInfo);
request.Headers.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
}
using HttpResponseMessage response = await _httpClient.SendAsync(request);
response.EnsureSuccessStatusCode();

View File

@@ -1,5 +1,5 @@
using Infrastructure.Verticals.Notifications;
using Infrastructure.Verticals.Notifications.Models;
using Cleanuparr.Infrastructure.Features.Notifications.Models;
using Infrastructure.Verticals.Notifications;
using MassTransit;
using Microsoft.Extensions.Logging;

View File

@@ -1,5 +1,5 @@
using Cleanuparr.Infrastructure.Features.Notifications.Models;
using Cleanuparr.Persistence.Models.Configuration.Notification;
using Infrastructure.Verticals.Notifications.Models;
namespace Cleanuparr.Infrastructure.Features.Notifications;

View File

@@ -1,5 +1,4 @@
using Cleanuparr.Domain.Enums;
using Infrastructure.Verticals.Notifications.Models;
namespace Cleanuparr.Infrastructure.Features.Notifications.Models;

View File

@@ -1,4 +1,4 @@
namespace Infrastructure.Verticals.Notifications.Models;
namespace Cleanuparr.Infrastructure.Features.Notifications.Models;
public sealed record CategoryChangedNotification : Notification
{

View File

@@ -1,4 +1,4 @@
namespace Infrastructure.Verticals.Notifications.Models;
namespace Cleanuparr.Infrastructure.Features.Notifications.Models;
public sealed record DownloadCleanedNotification : Notification
{

View File

@@ -1,6 +1,4 @@
using Cleanuparr.Infrastructure.Features.Notifications.Models;
namespace Infrastructure.Verticals.Notifications.Models;
namespace Cleanuparr.Infrastructure.Features.Notifications.Models;
public sealed record FailedImportStrikeNotification : ArrNotification
{

View File

@@ -1,4 +1,4 @@
namespace Infrastructure.Verticals.Notifications.Models;
namespace Cleanuparr.Infrastructure.Features.Notifications.Models;
public abstract record Notification
{

View File

@@ -1,4 +1,4 @@
namespace Infrastructure.Verticals.Notifications.Models;
namespace Cleanuparr.Infrastructure.Features.Notifications.Models;
public sealed record NotificationField
{

View File

@@ -1,4 +1,4 @@
namespace Infrastructure.Verticals.Notifications.Models;
namespace Cleanuparr.Infrastructure.Features.Notifications.Models;
public enum NotificationLevel
{

View File

@@ -1,6 +1,4 @@
using Cleanuparr.Infrastructure.Features.Notifications.Models;
namespace Infrastructure.Verticals.Notifications.Models;
namespace Cleanuparr.Infrastructure.Features.Notifications.Models;
public sealed record QueueItemDeletedNotification : ArrNotification
{

View File

@@ -1,6 +1,4 @@
using Cleanuparr.Infrastructure.Features.Notifications.Models;
namespace Infrastructure.Verticals.Notifications.Models;
namespace Cleanuparr.Infrastructure.Features.Notifications.Models;
public sealed record SlowStrikeNotification : ArrNotification
{

View File

@@ -1,6 +1,4 @@
using Cleanuparr.Infrastructure.Features.Notifications.Models;
namespace Infrastructure.Verticals.Notifications.Models;
namespace Cleanuparr.Infrastructure.Features.Notifications.Models;
public sealed record StalledStrikeNotification : ArrNotification
{

View File

@@ -2,7 +2,6 @@ using Cleanuparr.Infrastructure.Features.Notifications.Models;
using Cleanuparr.Persistence;
using Cleanuparr.Persistence.Models.Configuration.Notification;
using Infrastructure.Verticals.Notifications;
using Infrastructure.Verticals.Notifications.Models;
using Mapster;
namespace Cleanuparr.Infrastructure.Features.Notifications.Notifiarr;

View File

@@ -1,5 +1,5 @@
using Cleanuparr.Infrastructure.Features.Notifications.Models;
using Cleanuparr.Persistence.Models.Configuration.Notification;
using Infrastructure.Verticals.Notifications.Models;
using Microsoft.EntityFrameworkCore;
namespace Cleanuparr.Infrastructure.Features.Notifications;
@@ -10,7 +10,7 @@ public abstract class NotificationProvider<T> : INotificationProvider<T>
protected readonly DbSet<T> _notificationConfig;
protected T? _config;
public T Config => _config ??= _notificationConfig.First();
public T Config => _config ??= _notificationConfig.AsNoTracking().First();
NotificationConfig INotificationProvider.Config => Config;

View File

@@ -6,7 +6,6 @@ using Cleanuparr.Infrastructure.Features.Notifications.Models;
using Cleanuparr.Persistence.Models.Configuration.Arr;
using Data.Models.Arr.Queue;
using Infrastructure.Interceptors;
using Infrastructure.Verticals.Notifications.Models;
using Mapster;
using MassTransit;
using Microsoft.Extensions.Logging;

View File

@@ -1,5 +1,5 @@
using Cleanuparr.Infrastructure.Features.Notifications;
using Infrastructure.Verticals.Notifications.Models;
using Cleanuparr.Infrastructure.Features.Notifications.Models;
using Microsoft.Extensions.Logging;
namespace Infrastructure.Verticals.Notifications;

View File

@@ -0,0 +1,620 @@
// <auto-generated />
using System;
using System.Collections.Generic;
using Cleanuparr.Persistence;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace Cleanuparr.Persistence.Migrations.Data
{
[DbContext(typeof(DataContext))]
[Migration("20250702192200_ChangeAppriseConfig")]
partial class ChangeAppriseConfig
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "9.0.6");
modelBuilder.Entity("Cleanuparr.Persistence.Models.Configuration.Arr.ArrConfig", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasColumnName("id");
b.Property<short>("FailedImportMaxStrikes")
.HasColumnType("INTEGER")
.HasColumnName("failed_import_max_strikes");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("type");
b.HasKey("Id")
.HasName("pk_arr_configs");
b.ToTable("arr_configs", (string)null);
});
modelBuilder.Entity("Cleanuparr.Persistence.Models.Configuration.Arr.ArrInstance", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasColumnName("id");
b.Property<string>("ApiKey")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("api_key");
b.Property<Guid>("ArrConfigId")
.HasColumnType("TEXT")
.HasColumnName("arr_config_id");
b.Property<bool>("Enabled")
.HasColumnType("INTEGER")
.HasColumnName("enabled");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("name");
b.Property<string>("Url")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("url");
b.HasKey("Id")
.HasName("pk_arr_instances");
b.HasIndex("ArrConfigId")
.HasDatabaseName("ix_arr_instances_arr_config_id");
b.ToTable("arr_instances", (string)null);
});
modelBuilder.Entity("Cleanuparr.Persistence.Models.Configuration.ContentBlocker.ContentBlockerConfig", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasColumnName("id");
b.Property<string>("CronExpression")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("cron_expression");
b.Property<bool>("DeletePrivate")
.HasColumnType("INTEGER")
.HasColumnName("delete_private");
b.Property<bool>("Enabled")
.HasColumnType("INTEGER")
.HasColumnName("enabled");
b.Property<bool>("IgnorePrivate")
.HasColumnType("INTEGER")
.HasColumnName("ignore_private");
b.Property<bool>("UseAdvancedScheduling")
.HasColumnType("INTEGER")
.HasColumnName("use_advanced_scheduling");
b.ComplexProperty<Dictionary<string, object>>("Lidarr", "Cleanuparr.Persistence.Models.Configuration.ContentBlocker.ContentBlockerConfig.Lidarr#BlocklistSettings", b1 =>
{
b1.IsRequired();
b1.Property<string>("BlocklistPath")
.HasColumnType("TEXT")
.HasColumnName("lidarr_blocklist_path");
b1.Property<string>("BlocklistType")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("lidarr_blocklist_type");
b1.Property<bool>("Enabled")
.HasColumnType("INTEGER")
.HasColumnName("lidarr_enabled");
});
b.ComplexProperty<Dictionary<string, object>>("Radarr", "Cleanuparr.Persistence.Models.Configuration.ContentBlocker.ContentBlockerConfig.Radarr#BlocklistSettings", b1 =>
{
b1.IsRequired();
b1.Property<string>("BlocklistPath")
.HasColumnType("TEXT")
.HasColumnName("radarr_blocklist_path");
b1.Property<string>("BlocklistType")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("radarr_blocklist_type");
b1.Property<bool>("Enabled")
.HasColumnType("INTEGER")
.HasColumnName("radarr_enabled");
});
b.ComplexProperty<Dictionary<string, object>>("Readarr", "Cleanuparr.Persistence.Models.Configuration.ContentBlocker.ContentBlockerConfig.Readarr#BlocklistSettings", b1 =>
{
b1.IsRequired();
b1.Property<string>("BlocklistPath")
.HasColumnType("TEXT")
.HasColumnName("readarr_blocklist_path");
b1.Property<string>("BlocklistType")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("readarr_blocklist_type");
b1.Property<bool>("Enabled")
.HasColumnType("INTEGER")
.HasColumnName("readarr_enabled");
});
b.ComplexProperty<Dictionary<string, object>>("Sonarr", "Cleanuparr.Persistence.Models.Configuration.ContentBlocker.ContentBlockerConfig.Sonarr#BlocklistSettings", b1 =>
{
b1.IsRequired();
b1.Property<string>("BlocklistPath")
.HasColumnType("TEXT")
.HasColumnName("sonarr_blocklist_path");
b1.Property<string>("BlocklistType")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("sonarr_blocklist_type");
b1.Property<bool>("Enabled")
.HasColumnType("INTEGER")
.HasColumnName("sonarr_enabled");
});
b.HasKey("Id")
.HasName("pk_content_blocker_configs");
b.ToTable("content_blocker_configs", (string)null);
});
modelBuilder.Entity("Cleanuparr.Persistence.Models.Configuration.DownloadCleaner.CleanCategory", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasColumnName("id");
b.Property<Guid>("DownloadCleanerConfigId")
.HasColumnType("TEXT")
.HasColumnName("download_cleaner_config_id");
b.Property<double>("MaxRatio")
.HasColumnType("REAL")
.HasColumnName("max_ratio");
b.Property<double>("MaxSeedTime")
.HasColumnType("REAL")
.HasColumnName("max_seed_time");
b.Property<double>("MinSeedTime")
.HasColumnType("REAL")
.HasColumnName("min_seed_time");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("name");
b.HasKey("Id")
.HasName("pk_clean_categories");
b.HasIndex("DownloadCleanerConfigId")
.HasDatabaseName("ix_clean_categories_download_cleaner_config_id");
b.ToTable("clean_categories", (string)null);
});
modelBuilder.Entity("Cleanuparr.Persistence.Models.Configuration.DownloadCleaner.DownloadCleanerConfig", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasColumnName("id");
b.Property<string>("CronExpression")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("cron_expression");
b.Property<bool>("DeletePrivate")
.HasColumnType("INTEGER")
.HasColumnName("delete_private");
b.Property<bool>("Enabled")
.HasColumnType("INTEGER")
.HasColumnName("enabled");
b.PrimitiveCollection<string>("UnlinkedCategories")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("unlinked_categories");
b.Property<bool>("UnlinkedEnabled")
.HasColumnType("INTEGER")
.HasColumnName("unlinked_enabled");
b.Property<string>("UnlinkedIgnoredRootDir")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("unlinked_ignored_root_dir");
b.Property<string>("UnlinkedTargetCategory")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("unlinked_target_category");
b.Property<bool>("UnlinkedUseTag")
.HasColumnType("INTEGER")
.HasColumnName("unlinked_use_tag");
b.Property<bool>("UseAdvancedScheduling")
.HasColumnType("INTEGER")
.HasColumnName("use_advanced_scheduling");
b.HasKey("Id")
.HasName("pk_download_cleaner_configs");
b.ToTable("download_cleaner_configs", (string)null);
});
modelBuilder.Entity("Cleanuparr.Persistence.Models.Configuration.DownloadClientConfig", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasColumnName("id");
b.Property<bool>("Enabled")
.HasColumnType("INTEGER")
.HasColumnName("enabled");
b.Property<string>("Host")
.HasColumnType("TEXT")
.HasColumnName("host");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("name");
b.Property<string>("Password")
.HasColumnType("TEXT")
.HasColumnName("password");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("type");
b.Property<string>("TypeName")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("type_name");
b.Property<string>("UrlBase")
.HasColumnType("TEXT")
.HasColumnName("url_base");
b.Property<string>("Username")
.HasColumnType("TEXT")
.HasColumnName("username");
b.HasKey("Id")
.HasName("pk_download_clients");
b.ToTable("download_clients", (string)null);
});
modelBuilder.Entity("Cleanuparr.Persistence.Models.Configuration.General.GeneralConfig", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasColumnName("id");
b.Property<bool>("DisplaySupportBanner")
.HasColumnType("INTEGER")
.HasColumnName("display_support_banner");
b.Property<bool>("DryRun")
.HasColumnType("INTEGER")
.HasColumnName("dry_run");
b.Property<string>("EncryptionKey")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("encryption_key");
b.Property<string>("HttpCertificateValidation")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("http_certificate_validation");
b.Property<ushort>("HttpMaxRetries")
.HasColumnType("INTEGER")
.HasColumnName("http_max_retries");
b.Property<ushort>("HttpTimeout")
.HasColumnType("INTEGER")
.HasColumnName("http_timeout");
b.PrimitiveCollection<string>("IgnoredDownloads")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("ignored_downloads");
b.Property<string>("LogLevel")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("log_level");
b.Property<ushort>("SearchDelay")
.HasColumnType("INTEGER")
.HasColumnName("search_delay");
b.Property<bool>("SearchEnabled")
.HasColumnType("INTEGER")
.HasColumnName("search_enabled");
b.HasKey("Id")
.HasName("pk_general_configs");
b.ToTable("general_configs", (string)null);
});
modelBuilder.Entity("Cleanuparr.Persistence.Models.Configuration.Notification.AppriseConfig", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasColumnName("id");
b.Property<string>("FullUrl")
.HasColumnType("TEXT")
.HasColumnName("full_url");
b.Property<string>("Key")
.HasColumnType("TEXT")
.HasColumnName("key");
b.Property<bool>("OnCategoryChanged")
.HasColumnType("INTEGER")
.HasColumnName("on_category_changed");
b.Property<bool>("OnDownloadCleaned")
.HasColumnType("INTEGER")
.HasColumnName("on_download_cleaned");
b.Property<bool>("OnFailedImportStrike")
.HasColumnType("INTEGER")
.HasColumnName("on_failed_import_strike");
b.Property<bool>("OnQueueItemDeleted")
.HasColumnType("INTEGER")
.HasColumnName("on_queue_item_deleted");
b.Property<bool>("OnSlowStrike")
.HasColumnType("INTEGER")
.HasColumnName("on_slow_strike");
b.Property<bool>("OnStalledStrike")
.HasColumnType("INTEGER")
.HasColumnName("on_stalled_strike");
b.HasKey("Id")
.HasName("pk_apprise_configs");
b.ToTable("apprise_configs", (string)null);
});
modelBuilder.Entity("Cleanuparr.Persistence.Models.Configuration.Notification.NotifiarrConfig", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasColumnName("id");
b.Property<string>("ApiKey")
.HasColumnType("TEXT")
.HasColumnName("api_key");
b.Property<string>("ChannelId")
.HasColumnType("TEXT")
.HasColumnName("channel_id");
b.Property<bool>("OnCategoryChanged")
.HasColumnType("INTEGER")
.HasColumnName("on_category_changed");
b.Property<bool>("OnDownloadCleaned")
.HasColumnType("INTEGER")
.HasColumnName("on_download_cleaned");
b.Property<bool>("OnFailedImportStrike")
.HasColumnType("INTEGER")
.HasColumnName("on_failed_import_strike");
b.Property<bool>("OnQueueItemDeleted")
.HasColumnType("INTEGER")
.HasColumnName("on_queue_item_deleted");
b.Property<bool>("OnSlowStrike")
.HasColumnType("INTEGER")
.HasColumnName("on_slow_strike");
b.Property<bool>("OnStalledStrike")
.HasColumnType("INTEGER")
.HasColumnName("on_stalled_strike");
b.HasKey("Id")
.HasName("pk_notifiarr_configs");
b.ToTable("notifiarr_configs", (string)null);
});
modelBuilder.Entity("Cleanuparr.Persistence.Models.Configuration.QueueCleaner.QueueCleanerConfig", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasColumnName("id");
b.Property<string>("CronExpression")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("cron_expression");
b.Property<bool>("Enabled")
.HasColumnType("INTEGER")
.HasColumnName("enabled");
b.Property<bool>("UseAdvancedScheduling")
.HasColumnType("INTEGER")
.HasColumnName("use_advanced_scheduling");
b.ComplexProperty<Dictionary<string, object>>("FailedImport", "Cleanuparr.Persistence.Models.Configuration.QueueCleaner.QueueCleanerConfig.FailedImport#FailedImportConfig", b1 =>
{
b1.IsRequired();
b1.Property<bool>("DeletePrivate")
.HasColumnType("INTEGER")
.HasColumnName("failed_import_delete_private");
b1.Property<bool>("IgnorePrivate")
.HasColumnType("INTEGER")
.HasColumnName("failed_import_ignore_private");
b1.PrimitiveCollection<string>("IgnoredPatterns")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("failed_import_ignored_patterns");
b1.Property<ushort>("MaxStrikes")
.HasColumnType("INTEGER")
.HasColumnName("failed_import_max_strikes");
});
b.ComplexProperty<Dictionary<string, object>>("Slow", "Cleanuparr.Persistence.Models.Configuration.QueueCleaner.QueueCleanerConfig.Slow#SlowConfig", b1 =>
{
b1.IsRequired();
b1.Property<bool>("DeletePrivate")
.HasColumnType("INTEGER")
.HasColumnName("slow_delete_private");
b1.Property<string>("IgnoreAboveSize")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("slow_ignore_above_size");
b1.Property<bool>("IgnorePrivate")
.HasColumnType("INTEGER")
.HasColumnName("slow_ignore_private");
b1.Property<ushort>("MaxStrikes")
.HasColumnType("INTEGER")
.HasColumnName("slow_max_strikes");
b1.Property<double>("MaxTime")
.HasColumnType("REAL")
.HasColumnName("slow_max_time");
b1.Property<string>("MinSpeed")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("slow_min_speed");
b1.Property<bool>("ResetStrikesOnProgress")
.HasColumnType("INTEGER")
.HasColumnName("slow_reset_strikes_on_progress");
});
b.ComplexProperty<Dictionary<string, object>>("Stalled", "Cleanuparr.Persistence.Models.Configuration.QueueCleaner.QueueCleanerConfig.Stalled#StalledConfig", b1 =>
{
b1.IsRequired();
b1.Property<bool>("DeletePrivate")
.HasColumnType("INTEGER")
.HasColumnName("stalled_delete_private");
b1.Property<ushort>("DownloadingMetadataMaxStrikes")
.HasColumnType("INTEGER")
.HasColumnName("stalled_downloading_metadata_max_strikes");
b1.Property<bool>("IgnorePrivate")
.HasColumnType("INTEGER")
.HasColumnName("stalled_ignore_private");
b1.Property<ushort>("MaxStrikes")
.HasColumnType("INTEGER")
.HasColumnName("stalled_max_strikes");
b1.Property<bool>("ResetStrikesOnProgress")
.HasColumnType("INTEGER")
.HasColumnName("stalled_reset_strikes_on_progress");
});
b.HasKey("Id")
.HasName("pk_queue_cleaner_configs");
b.ToTable("queue_cleaner_configs", (string)null);
});
modelBuilder.Entity("Cleanuparr.Persistence.Models.Configuration.Arr.ArrInstance", b =>
{
b.HasOne("Cleanuparr.Persistence.Models.Configuration.Arr.ArrConfig", "ArrConfig")
.WithMany("Instances")
.HasForeignKey("ArrConfigId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_arr_instances_arr_configs_arr_config_id");
b.Navigation("ArrConfig");
});
modelBuilder.Entity("Cleanuparr.Persistence.Models.Configuration.DownloadCleaner.CleanCategory", b =>
{
b.HasOne("Cleanuparr.Persistence.Models.Configuration.DownloadCleaner.DownloadCleanerConfig", "DownloadCleanerConfig")
.WithMany("Categories")
.HasForeignKey("DownloadCleanerConfigId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_clean_categories_download_cleaner_configs_download_cleaner_config_id");
b.Navigation("DownloadCleanerConfig");
});
modelBuilder.Entity("Cleanuparr.Persistence.Models.Configuration.Arr.ArrConfig", b =>
{
b.Navigation("Instances");
});
modelBuilder.Entity("Cleanuparr.Persistence.Models.Configuration.DownloadCleaner.DownloadCleanerConfig", b =>
{
b.Navigation("Categories");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,28 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Cleanuparr.Persistence.Migrations.Data
{
/// <inheritdoc />
public partial class ChangeAppriseConfig : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "url",
table: "apprise_configs",
newName: "full_url");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "full_url",
table: "apprise_configs",
newName: "url");
}
}
}

View File

@@ -387,6 +387,10 @@ namespace Cleanuparr.Persistence.Migrations.Data
.HasColumnType("TEXT")
.HasColumnName("id");
b.Property<string>("FullUrl")
.HasColumnType("TEXT")
.HasColumnName("full_url");
b.Property<string>("Key")
.HasColumnType("TEXT")
.HasColumnName("key");
@@ -415,10 +419,6 @@ namespace Cleanuparr.Persistence.Migrations.Data
.HasColumnType("INTEGER")
.HasColumnName("on_stalled_strike");
b.Property<string>("Url")
.HasColumnType("TEXT")
.HasColumnName("url");
b.HasKey("Id")
.HasName("pk_apprise_configs");

View File

@@ -1,10 +1,15 @@
namespace Cleanuparr.Persistence.Models.Configuration.Notification;
using System.ComponentModel.DataAnnotations.Schema;
namespace Cleanuparr.Persistence.Models.Configuration.Notification;
public sealed record AppriseConfig : NotificationConfig
{
public Uri? Url { get; init; }
public string? FullUrl { get; set; }
public string? Key { get; init; }
[NotMapped]
public Uri? Url => string.IsNullOrEmpty(FullUrl) ? null : new Uri(FullUrl, UriKind.Absolute);
public string? Key { get; set; }
public override bool IsValid()
{

View File

@@ -93,7 +93,7 @@ export class DocumentationService {
'notifications': {
'notifiarr.apiKey': 'notifiarr-api-key',
'notifiarr.channelId': 'notifiarr-channel-id',
'apprise.url': 'apprise-url',
'apprise.fullUrl': 'apprise-url',
'apprise.key': 'apprise-key',
'eventTriggers': 'event-triggers'
}

View File

@@ -101,7 +101,7 @@
<div class="field-input">
<input type="text" pInputText formControlName="cronExpression" placeholder="0 0/5 * ? * * *" />
</div>
<small *ngIf="contentBlockerForm.get('cronExpression')?.hasError('required') && contentBlockerForm.get('cronExpression')?.touched" class="p-error">Cron expression is required</small>
<small *ngIf="hasError('cronExpression', 'required')" class="p-error">Cron expression is required</small>
<small class="form-helper-text">Enter a valid Quartz cron expression (e.g., "0 0/5 * ? * * *" runs every 5 minutes)</small>
</div>
</div>

View File

@@ -605,7 +605,7 @@ export class ContentBlockerSettingsComponent implements OnDestroy, CanComponentD
*/
hasError(controlName: string, errorName: string): boolean {
const control = this.contentBlockerForm.get(controlName);
return control ? control.touched && control.hasError(errorName) : false;
return control ? control.dirty && control.hasError(errorName) : false;
}
/**
@@ -633,7 +633,7 @@ export class ContentBlockerSettingsComponent implements OnDestroy, CanComponentD
}
const control = parentControl.get(controlName);
return control ? control.touched && control.hasError(errorName) : false;
return control ? control.dirty && control.hasError(errorName) : false;
}

View File

@@ -101,7 +101,7 @@
<div class="field-input">
<input type="text" pInputText formControlName="cronExpression" placeholder="0 0/5 * ? * * *" />
</div>
<small *ngIf="downloadCleanerForm.get('cronExpression')?.hasError('required') && downloadCleanerForm.get('cronExpression')?.touched" class="p-error">Cron expression is required</small>
<small *ngIf="hasError('cronExpression', 'required')" class="p-error">Cron expression is required</small>
<small class="form-helper-text">Enter a valid Quartz cron expression (e.g., "0 0/5 * ? * * *" runs every 5 minutes)</small>
</div>
</div>

View File

@@ -660,14 +660,14 @@ export class DownloadCleanerSettingsComponent implements OnDestroy, CanComponent
*/
hasError(controlName: string, errorName: string): boolean {
const control = this.downloadCleanerForm.get(controlName);
return control ? control.touched && control.hasError(errorName) : false;
return control ? control.dirty && control.hasError(errorName) : false;
}
/**
* Check if the form has the unlinked categories validation error
*/
hasUnlinkedCategoriesError(): boolean {
return this.downloadCleanerForm.touched && this.downloadCleanerForm.hasError('unlinkedCategoriesRequired');
return this.downloadCleanerForm.dirty && this.downloadCleanerForm.hasError('unlinkedCategoriesRequired');
}
/**
@@ -695,7 +695,7 @@ export class DownloadCleanerSettingsComponent implements OnDestroy, CanComponent
}
const control = parentControl.get(controlName);
return control ? control.touched && control.hasError(errorName) : false;
return control ? control.dirty && control.hasError(errorName) : false;
}
/**
@@ -706,7 +706,7 @@ export class DownloadCleanerSettingsComponent implements OnDestroy, CanComponent
if (!categoryGroup) return false;
const control = categoryGroup.get(controlName);
return control ? control.touched && control.hasError(errorName) : false;
return control ? control.dirty && control.hasError(errorName) : false;
}
/**
@@ -715,7 +715,7 @@ export class DownloadCleanerSettingsComponent implements OnDestroy, CanComponent
hasCategoryControlError(categoryIndex: number, controlName: string, errorName: string): boolean {
const categoryGroup = this.categoriesFormArray.at(categoryIndex);
const control = categoryGroup.get(controlName);
return control ? control.touched && control.hasError(errorName) : false;
return control ? control.dirty && control.hasError(errorName) : false;
}
/**
@@ -723,7 +723,7 @@ export class DownloadCleanerSettingsComponent implements OnDestroy, CanComponent
*/
hasCategoryGroupError(categoryIndex: number, errorName: string): boolean {
const categoryGroup = this.categoriesFormArray.at(categoryIndex);
return categoryGroup ? categoryGroup.touched && categoryGroup.hasError(errorName) : false;
return categoryGroup ? categoryGroup.dirty && categoryGroup.hasError(errorName) : false;
}
/**

View File

@@ -156,7 +156,7 @@ export class DownloadClientSettingsComponent implements OnDestroy, CanComponentD
*/
hasError(form: FormGroup, controlName: string, errorName: string): boolean {
const control = form.get(controlName);
return control !== null && control.hasError(errorName) && control.touched;
return control !== null && control.hasError(errorName) && control.dirty;
}
/**

View File

@@ -355,7 +355,7 @@ export class GeneralSettingsComponent implements OnDestroy, CanComponentDeactiva
*/
hasError(controlName: string, errorName: string): boolean {
const control = this.generalForm.get(controlName);
return control ? control.touched && control.hasError(errorName) : false;
return control ? control.dirty && control.hasError(errorName) : false;
}
/**

View File

@@ -42,6 +42,9 @@
decrementButtonIcon="pi pi-minus"
></p-inputNumber>
</div>
<small *ngIf="hasError('failedImportMaxStrikes', 'required')" class="p-error">This field is required</small>
<small *ngIf="hasError('failedImportMaxStrikes', 'min')" class="p-error">Value cannot be less than -1</small>
<small *ngIf="hasError('failedImportMaxStrikes', 'max')" class="p-error">Value cannot exceed 5000</small>
<small class="form-helper-text">Maximum number of strikes before removing a failed import (-1 to use global setting; 0 to disable)</small>
</div>
</div>

View File

@@ -82,7 +82,7 @@ export class LidarrSettingsComponent implements OnDestroy, CanComponentDeactivat
constructor() {
// Initialize forms
this.globalForm = this.formBuilder.group({
failedImportMaxStrikes: [-1],
failedImportMaxStrikes: [-1, [Validators.required, Validators.min(-1), Validators.max(5000)]],
});
this.instanceForm = this.formBuilder.group({
@@ -211,11 +211,31 @@ export class LidarrSettingsComponent implements OnDestroy, CanComponentDeactivat
}
/**
* Check if a form control has an error
* Check if a form control has an error after it's been touched
*/
hasError(form: FormGroup, controlName: string, errorName: string): boolean {
const control = form.get(controlName);
return control !== null && control.hasError(errorName) && control.touched;
hasError(formOrControlName: FormGroup | string, controlNameOrErrorName: string, errorName?: string): boolean {
if (formOrControlName instanceof FormGroup) {
// For instance form
const control = formOrControlName.get(controlNameOrErrorName);
return control !== null && control.hasError(errorName!) && control.dirty;
} else {
// For global form
const control = this.globalForm.get(formOrControlName);
return control ? control.dirty && control.hasError(controlNameOrErrorName) : false;
}
}
/**
* Get nested form control errors
*/
hasNestedError(parentName: string, controlName: string, errorName: string): boolean {
const parentControl = this.globalForm.get(parentName);
if (!parentControl || !(parentControl instanceof FormGroup)) {
return false;
}
const control = parentControl.get(controlName);
return control ? control.dirty && control.hasError(errorName) : false;
}
/**
@@ -406,8 +426,6 @@ export class LidarrSettingsComponent implements OnDestroy, CanComponentDeactivat
});
}
/**
* Get modal title based on mode
*/

View File

@@ -114,13 +114,13 @@
<div class="field-row">
<label class="field-label">
<i class="pi pi-info-circle field-info-icon"
(click)="openFieldDocs('apprise.url')"
(click)="openFieldDocs('apprise.fullUrl')"
title="Click for documentation">
</i>
URL
</label>
<div class="field-input">
<input type="text" pInputText formControlName="url" inputId="appriseUrl" placeholder="Enter Apprise URL" />
<input type="text" pInputText formControlName="fullUrl" inputId="appriseUrl" placeholder="Enter Apprise URL" />
<small class="form-helper-text">The Apprise server URL</small>
</div>
</div>

View File

@@ -84,7 +84,7 @@ export class NotificationSettingsComponent implements OnDestroy, CanComponentDea
}),
// Apprise configuration
apprise: this.formBuilder.group({
url: [''],
fullUrl: [''],
key: [''],
onFailedImportStrike: [false],
onStalledStrike: [false],
@@ -112,7 +112,7 @@ export class NotificationSettingsComponent implements OnDestroy, CanComponentDea
onCategoryChanged: false,
},
apprise: config.apprise || {
url: '',
fullUrl: '',
key: '',
onFailedImportStrike: false,
onStalledStrike: false,
@@ -268,7 +268,7 @@ export class NotificationSettingsComponent implements OnDestroy, CanComponentDea
onCategoryChanged: false,
},
apprise: {
url: '',
fullUrl: '',
key: '',
onFailedImportStrike: false,
onStalledStrike: false,
@@ -311,7 +311,7 @@ export class NotificationSettingsComponent implements OnDestroy, CanComponentDea
*/
hasError(controlName: string, errorName: string): boolean {
const control = this.notificationForm.get(controlName);
return control ? control.touched && control.hasError(errorName) : false;
return control ? control.dirty && control.hasError(errorName) : false;
}
/**
@@ -319,7 +319,7 @@ export class NotificationSettingsComponent implements OnDestroy, CanComponentDea
*/
hasNestedError(groupName: string, controlName: string, errorName: string): boolean {
const control = this.notificationForm.get(`${groupName}.${controlName}`);
return control ? control.touched && control.hasError(errorName) : false;
return control ? control.dirty && control.hasError(errorName) : false;
}
/**

View File

@@ -101,7 +101,7 @@
<div class="field-input">
<input type="text" pInputText formControlName="cronExpression" placeholder="0 0/5 * ? * * *" />
</div>
<small *ngIf="queueCleanerForm.get('cronExpression')?.hasError('required') && queueCleanerForm.get('cronExpression')?.touched" class="p-error">Cron expression is required</small>
<small *ngIf="hasError('cronExpression', 'required')" class="p-error">Cron expression is required</small>
<small class="form-helper-text">Enter a valid Quartz cron expression (e.g., "0 0/5 * ? * * *" runs every 5 minutes)</small>
</div>
</div>
@@ -128,15 +128,18 @@
title="Click for documentation"></i>
Max Strikes
</label>
<div class="field-input">
<p-inputNumber
formControlName="maxStrikes"
[showButtons]="true"
[min]="0"
[max]="10"
buttonLayout="horizontal"
>
</p-inputNumber>
<div>
<div class="field-input">
<p-inputNumber
formControlName="maxStrikes"
[showButtons]="true"
[min]="0"
buttonLayout="horizontal"
>
</p-inputNumber>
</div>
<small *ngIf="hasNestedError('failedImport', 'maxStrikes', 'required')" class="p-error">This field is required</small>
<small *ngIf="hasNestedError('failedImport', 'maxStrikes', 'max')" class="p-error">Value cannot exceed 5000</small>
<small class="form-helper-text"
>Number of strikes before action is taken (0 to disable, min 3 to enable)</small
>
@@ -232,7 +235,7 @@
</p-inputNumber>
</div>
<small *ngIf="hasNestedError('stalled', 'maxStrikes', 'required')" class="p-error">This field is required</small>
<small *ngIf="hasNestedError('stalled', 'maxStrikes', 'max')" class="p-error">Value cannot exceed 100</small>
<small *ngIf="hasNestedError('stalled', 'maxStrikes', 'max')" class="p-error">Value cannot exceed 5000</small>
<small class="form-helper-text"
>Number of strikes before action is taken (0 to disable, min 3 to enable)</small
>
@@ -311,7 +314,7 @@
</p-inputNumber>
</div>
<small *ngIf="hasNestedError('stalled', 'downloadingMetadataMaxStrikes', 'required')" class="p-error">This field is required</small>
<small *ngIf="hasNestedError('stalled', 'downloadingMetadataMaxStrikes', 'max')" class="p-error">Value cannot exceed 100</small>
<small *ngIf="hasNestedError('stalled', 'downloadingMetadataMaxStrikes', 'max')" class="p-error">Value cannot exceed 5000</small>
<small class="form-helper-text"
>Number of strikes before action is taken (0 to disable, min 3 to enable)</small
>
@@ -351,7 +354,7 @@
</p-inputNumber>
</div>
<small *ngIf="hasNestedError('slow', 'maxStrikes', 'required')" class="p-error">This field is required</small>
<small *ngIf="hasNestedError('slow', 'maxStrikes', 'max')" class="p-error">Value cannot exceed 100</small>
<small *ngIf="hasNestedError('slow', 'maxStrikes', 'max')" class="p-error">Value cannot exceed 5000</small>
<small class="form-helper-text"
>Number of strikes before action is taken (0 to disable, min 3 to enable)</small
>
@@ -422,16 +425,18 @@
title="Click for documentation"></i>
Maximum Time (hours)
</label>
<div class="field-input">
<p-inputNumber
formControlName="maxTime"
[showButtons]="true"
[min]="0"
buttonLayout="horizontal"
>
</p-inputNumber>
<div>
<div class="field-input">
<p-inputNumber
formControlName="maxTime"
[showButtons]="true"
[min]="0"
buttonLayout="horizontal"
>
</p-inputNumber>
</div>
<small *ngIf="hasNestedError('slow', 'maxTime', 'required')" class="p-error">This field is required</small>
<small *ngIf="hasNestedError('slow', 'maxTime', 'max')" class="p-error">Value cannot exceed 168</small>
<small *ngIf="hasNestedError('slow', 'maxTime', 'max')" class="p-error">Value cannot exceed 1000</small>
<small class="form-helper-text">Maximum time allowed for slow downloads (0 means disabled)</small>
</div>
</div>

View File

@@ -142,7 +142,7 @@ export class QueueCleanerSettingsComponent implements OnDestroy, CanComponentDea
// Failed Import settings - nested group
failedImport: this.formBuilder.group({
maxStrikes: [0, [Validators.required, Validators.min(0), Validators.max(100)]],
maxStrikes: [0, [Validators.required, Validators.min(0), Validators.max(5000)]],
ignorePrivate: [{ value: false, disabled: true }],
deletePrivate: [{ value: false, disabled: true }],
ignoredPatterns: [{ value: [], disabled: true }],
@@ -150,21 +150,21 @@ export class QueueCleanerSettingsComponent implements OnDestroy, CanComponentDea
// Stalled settings - nested group
stalled: this.formBuilder.group({
maxStrikes: [0, [Validators.required, Validators.min(0), Validators.max(100)]],
maxStrikes: [0, [Validators.required, Validators.min(0), Validators.max(5000)]],
resetStrikesOnProgress: [{ value: false, disabled: true }],
ignorePrivate: [{ value: false, disabled: true }],
deletePrivate: [{ value: false, disabled: true }],
downloadingMetadataMaxStrikes: [0, [Validators.required, Validators.min(0), Validators.max(100)]],
downloadingMetadataMaxStrikes: [0, [Validators.required, Validators.min(0), Validators.max(5000)]],
}),
// Slow Download settings - nested group
slow: this.formBuilder.group({
maxStrikes: [0, [Validators.required, Validators.min(0), Validators.max(100)]],
maxStrikes: [0, [Validators.required, Validators.min(0), Validators.max(5000)]],
resetStrikesOnProgress: [{ value: false, disabled: true }],
ignorePrivate: [{ value: false, disabled: true }],
deletePrivate: [{ value: false, disabled: true }],
minSpeed: [{ value: "", disabled: true }],
maxTime: [{ value: 0, disabled: true }, [Validators.required, Validators.min(0), Validators.max(168)]],
maxTime: [{ value: 0, disabled: true }, [Validators.required, Validators.min(0), Validators.max(1000)]],
ignoreAboveSize: [{ value: "", disabled: true }],
}),
@@ -675,7 +675,7 @@ export class QueueCleanerSettingsComponent implements OnDestroy, CanComponentDea
*/
hasError(controlName: string, errorName: string): boolean {
const control = this.queueCleanerForm.get(controlName);
return control ? control.touched && control.hasError(errorName) : false;
return control ? control.dirty && control.hasError(errorName) : false;
}
/**
@@ -703,7 +703,7 @@ export class QueueCleanerSettingsComponent implements OnDestroy, CanComponentDea
}
const control = parentControl.get(controlName);
return control ? control.touched && control.hasError(errorName) : false;
return control ? control.dirty && control.hasError(errorName) : false;
}

View File

@@ -42,6 +42,9 @@
decrementButtonIcon="pi pi-minus"
></p-inputNumber>
</div>
<small *ngIf="hasError('failedImportMaxStrikes', 'required')" class="p-error">This field is required</small>
<small *ngIf="hasError('failedImportMaxStrikes', 'min')" class="p-error">Value cannot be less than -1</small>
<small *ngIf="hasError('failedImportMaxStrikes', 'max')" class="p-error">Value cannot exceed 5000</small>
<small class="form-helper-text">Maximum number of strikes before removing a failed import (-1 to use global setting; 0 to disable)</small>
</div>
</div>

View File

@@ -82,7 +82,7 @@ export class RadarrSettingsComponent implements OnDestroy, CanComponentDeactivat
constructor() {
// Initialize forms
this.globalForm = this.formBuilder.group({
failedImportMaxStrikes: [-1],
failedImportMaxStrikes: [-1, [Validators.required, Validators.min(-1), Validators.max(5000)]],
});
this.instanceForm = this.formBuilder.group({
@@ -211,11 +211,31 @@ export class RadarrSettingsComponent implements OnDestroy, CanComponentDeactivat
}
/**
* Check if a form control has an error
* Check if a form control has an error after it's been touched
*/
hasError(form: FormGroup, controlName: string, errorName: string): boolean {
const control = form.get(controlName);
return control !== null && control.hasError(errorName) && control.touched;
hasError(formOrControlName: FormGroup | string, controlNameOrErrorName: string, errorName?: string): boolean {
if (formOrControlName instanceof FormGroup) {
// For instance form
const control = formOrControlName.get(controlNameOrErrorName);
return control !== null && control.hasError(errorName!) && control.dirty;
} else {
// For global form
const control = this.globalForm.get(formOrControlName);
return control ? control.dirty && control.hasError(controlNameOrErrorName) : false;
}
}
/**
* Get nested form control errors
*/
hasNestedError(parentName: string, controlName: string, errorName: string): boolean {
const parentControl = this.globalForm.get(parentName);
if (!parentControl || !(parentControl instanceof FormGroup)) {
return false;
}
const control = parentControl.get(controlName);
return control ? control.dirty && control.hasError(errorName) : false;
}
/**
@@ -406,8 +426,6 @@ export class RadarrSettingsComponent implements OnDestroy, CanComponentDeactivat
});
}
/**
* Get modal title based on mode
*/

View File

@@ -42,6 +42,9 @@
decrementButtonIcon="pi pi-minus"
></p-inputNumber>
</div>
<small *ngIf="hasError('failedImportMaxStrikes', 'required')" class="p-error">This field is required</small>
<small *ngIf="hasError('failedImportMaxStrikes', 'min')" class="p-error">Value cannot be less than -1</small>
<small *ngIf="hasError('failedImportMaxStrikes', 'max')" class="p-error">Value cannot exceed 5000</small>
<small class="form-helper-text">Maximum number of strikes before removing a failed import (-1 to use global setting; 0 to disable)</small>
</div>
</div>

View File

@@ -82,7 +82,7 @@ export class ReadarrSettingsComponent implements OnDestroy, CanComponentDeactiva
constructor() {
// Initialize forms
this.globalForm = this.formBuilder.group({
failedImportMaxStrikes: [-1],
failedImportMaxStrikes: [-1, [Validators.required, Validators.min(-1), Validators.max(5000)]],
});
this.instanceForm = this.formBuilder.group({
@@ -211,11 +211,18 @@ export class ReadarrSettingsComponent implements OnDestroy, CanComponentDeactiva
}
/**
* Check if a form control has an error
* Check if a form control has an error after it's been touched
*/
hasError(form: FormGroup, controlName: string, errorName: string): boolean {
const control = form.get(controlName);
return control !== null && control.hasError(errorName) && control.touched;
hasError(formOrControlName: FormGroup | string, controlNameOrErrorName: string, errorName?: string): boolean {
if (formOrControlName instanceof FormGroup) {
// For instance form
const control = formOrControlName.get(controlNameOrErrorName);
return control !== null && control.hasError(errorName!) && control.dirty;
} else {
// For global form
const control = this.globalForm.get(formOrControlName);
return control ? control.dirty && control.hasError(controlNameOrErrorName) : false;
}
}
/**
@@ -412,4 +419,17 @@ export class ReadarrSettingsComponent implements OnDestroy, CanComponentDeactiva
get modalTitle(): string {
return this.modalMode === 'add' ? 'Add Readarr Instance' : 'Edit Readarr Instance';
}
/**
* Get nested form control errors
*/
hasNestedError(parentName: string, controlName: string, errorName: string): boolean {
const parentControl = this.globalForm.get(parentName);
if (!parentControl || !(parentControl instanceof FormGroup)) {
return false;
}
const control = parentControl.get(controlName);
return control ? control.dirty && control.hasError(errorName) : false;
}
}

View File

@@ -42,6 +42,9 @@
decrementButtonIcon="pi pi-minus"
></p-inputNumber>
</div>
<small *ngIf="hasError('failedImportMaxStrikes', 'required')" class="p-error">This field is required</small>
<small *ngIf="hasError('failedImportMaxStrikes', 'min')" class="p-error">Value cannot be less than -1</small>
<small *ngIf="hasError('failedImportMaxStrikes', 'max')" class="p-error">Value cannot exceed 5000</small>
<small class="form-helper-text">Maximum number of strikes before removing a failed import (-1 to use global setting; 0 to disable)</small>
</div>
</div>

View File

@@ -82,7 +82,7 @@ export class SonarrSettingsComponent implements OnDestroy, CanComponentDeactivat
constructor() {
// Initialize forms
this.globalForm = this.formBuilder.group({
failedImportMaxStrikes: [-1],
failedImportMaxStrikes: [-1, [Validators.required, Validators.min(-1), Validators.max(5000)]],
});
this.instanceForm = this.formBuilder.group({
@@ -211,11 +211,31 @@ export class SonarrSettingsComponent implements OnDestroy, CanComponentDeactivat
}
/**
* Check if a form control has an error
* Check if a form control has an error after it's been touched
*/
hasError(form: FormGroup, controlName: string, errorName: string): boolean {
const control = form.get(controlName);
return control !== null && control.hasError(errorName) && control.touched;
hasError(formOrControlName: FormGroup | string, controlNameOrErrorName: string, errorName?: string): boolean {
if (formOrControlName instanceof FormGroup) {
// For instance form
const control = formOrControlName.get(controlNameOrErrorName);
return control !== null && control.hasError(errorName!) && control.dirty;
} else {
// For global form
const control = this.globalForm.get(formOrControlName);
return control ? control.dirty && control.hasError(controlNameOrErrorName) : false;
}
}
/**
* Get nested form control errors
*/
hasNestedError(parentName: string, controlName: string, errorName: string): boolean {
const parentControl = this.globalForm.get(parentName);
if (!parentControl || !(parentControl instanceof FormGroup)) {
return false;
}
const control = parentControl.get(controlName);
return control ? control.dirty && control.hasError(errorName) : false;
}
/**
@@ -406,8 +426,6 @@ export class SonarrSettingsComponent implements OnDestroy, CanComponentDeactivat
});
}
/**
* Get modal title based on mode
*/

View File

@@ -1,6 +1,6 @@
import { NotificationConfig } from './notification-config.model';
export interface AppriseConfig extends NotificationConfig {
url?: string;
fullUrl?: string;
key?: string;
}

View File

@@ -84,14 +84,14 @@ export const alternativeSupport: AlternativeSupport[] = [
title: 'Star on GitHub',
description: 'Give us a star on GitHub to help increase visibility and show your support.',
icon: '⭐',
link: 'https://github.com/Cleanupparr/Cleanupparr',
link: 'https://github.com/Cleanuparr/Cleanuparr',
linkText: 'Star the Repository'
},
{
title: 'Report Bugs',
description: 'Help improve Cleanuparr by reporting bugs and issues you encounter.',
icon: '🐛',
link: 'https://github.com/Cleanupparr/Cleanupparr/issues',
link: 'https://github.com/Cleanuparr/Cleanuparr/issues',
linkText: 'Report an Issue'
},
{