removed usenet type

This commit is contained in:
Flaminel
2025-06-24 21:21:14 +03:00
parent d904240aa8
commit a26fd1da5d
8 changed files with 10 additions and 42 deletions

View File

@@ -58,9 +58,9 @@ public sealed record CreateDownloadClientDto
throw new ValidationException("Client name cannot be empty");
}
if (Host is null && TypeName is not DownloadClientTypeName.Usenet)
if (Host is null)
{
throw new ValidationException("Host cannot be empty for non-Usenet clients");
throw new ValidationException("Host cannot be empty");
}
}
}

View File

@@ -5,5 +5,4 @@ public enum DownloadClientTypeName
QBittorrent,
Deluge,
Transmission,
Usenet,
}

View File

@@ -263,11 +263,6 @@ public abstract class GenericHandler : IHandler
foreach (var config in downloadClientConfigs)
{
if (config.TypeName is DownloadClientTypeName.Usenet)
{
continue;
}
try
{
var downloadService = _downloadServiceFactory.GetDownloadService(config);

View File

@@ -112,7 +112,6 @@ public class HealthCheckService : IHealthCheckService
// Get all enabled client configurations
var enabledClients = await dataContext.DownloadClients
.Where(x => x.Enabled)
.Where(x => x.TypeName != DownloadClientTypeName.Usenet)
.ToListAsync();
var results = new Dictionary<Guid, HealthStatus>();

View File

@@ -74,12 +74,12 @@ public sealed record DownloadClientConfig
{
if (string.IsNullOrWhiteSpace(Name))
{
throw new ValidationException($"Client name cannot be empty for client ID: {Id}");
throw new ValidationException($"Client name cannot be empty");
}
if (Host is null && TypeName is not DownloadClientTypeName.Usenet)
if (Host is null)
{
throw new ValidationException($"Host cannot be empty for client ID: {Id}");
throw new ValidationException($"Host cannot be empty");
}
}
}

View File

@@ -152,8 +152,7 @@
<small *ngIf="hasError(clientForm, 'type', 'required')" class="p-error">Client type is required</small>
</div>
<!-- Connection fields - only shown when client type is not Usenet -->
<ng-container *ngIf="!isUsenetClient(clientForm.get('type')?.value)">
<ng-container>
<div class="field">
<label for="client-host">Host *</label>
<input
@@ -205,11 +204,6 @@
/>
</div>
</ng-container>
<!-- Message shown when Usenet is selected -->
<div *ngIf="isUsenetClient(clientForm.get('type')?.value)" class="p-3 mt-2 surface-overlay border-1 border-round-sm">
<small class="text-secondary">Usenet client type is for categorization only. No connection details needed.</small>
</div>
</form>
<ng-template pTemplate="footer">

View File

@@ -59,7 +59,6 @@ export class DownloadClientSettingsComponent implements OnDestroy, CanComponentD
{ label: "qBittorrent", value: DownloadClientType.QBittorrent },
{ label: "Deluge", value: DownloadClientType.Deluge },
{ label: "Transmission", value: DownloadClientType.Transmission },
{ label: "Usenet", value: DownloadClientType.Usenet }
];
// Clean up subscriptions
@@ -334,8 +333,6 @@ export class DownloadClientSettingsComponent implements OnDestroy, CanComponentD
return { typeName: 'Deluge', type: 'Torrent' };
case DownloadClientType.Transmission:
return { typeName: 'Transmission', type: 'Torrent' };
case DownloadClientType.Usenet:
return { typeName: 'Usenet', type: 'Usenet' };
default:
return { typeName: 'QBittorrent', type: 'Torrent' };
}
@@ -352,20 +349,11 @@ export class DownloadClientSettingsComponent implements OnDestroy, CanComponentD
return DownloadClientType.Deluge;
case 'Transmission':
return DownloadClientType.Transmission;
case 'Usenet':
return DownloadClientType.Usenet;
default:
return DownloadClientType.QBittorrent;
}
}
/**
* Checks if a client type is Usenet
*/
public isUsenetClient(clientType: DownloadClientType | null | undefined): boolean {
return clientType === DownloadClientType.Usenet;
}
/**
* Handle client type changes to update validation
*/
@@ -375,16 +363,10 @@ export class DownloadClientSettingsComponent implements OnDestroy, CanComponentD
if (!hostControl) return;
if (this.isUsenetClient(clientType)) {
// For Usenet, remove all validators
hostControl.clearValidators();
} else {
// For other client types, add required and URI validators
hostControl.setValidators([
Validators.required,
this.uriValidator.bind(this)
]);
}
hostControl.setValidators([
Validators.required,
this.uriValidator.bind(this)
]);
// Update validation state
hostControl.updateValueAndValidity();

View File

@@ -5,5 +5,4 @@ export enum DownloadClientType {
QBittorrent = 0,
Deluge = 1,
Transmission = 2,
Usenet = 3,
}