New: Force all usenet indexers to use Redirection

This commit is contained in:
Robin Dadswell 2025-05-19 18:24:20 +01:00 committed by Qstick
parent cbfec3df3c
commit aba69901c9
2 changed files with 8 additions and 2 deletions

View file

@ -208,6 +208,12 @@ public ValidationResult Test()
try
{
// Ensure Redirect is true for Usenet protocols
if (Protocol == DownloadProtocol.Usenet || (SupportsRedirect && Redirect))
{
failures.Add(new ValidationFailure("Redirect", "Redirect must be enabled for Usenet indexers"));
}
Test(failures).GetAwaiter().GetResult();
}
catch (Exception ex)

View file

@ -262,8 +262,8 @@ public async Task<object> GetDownload(int id, string link, string file)
throw new BadRequestException("Failed to normalize provided link");
}
// If Indexer is set to download via Redirect then just redirect to the link
if (indexer.SupportsRedirect && indexerDef.Redirect)
// If Indexer is set to download via Redirect then just redirect to the link unless it's a Usenet indexer at which point it forces Redirect.
if (indexer.Protocol == DownloadProtocol.Usenet || (indexer.SupportsRedirect && indexerDef.Redirect))
{
_downloadService.RecordRedirect(unprotectedLink, id, source, host, file);
return RedirectPermanent(unprotectedLink);