Compare commits

..

2 Commits

Author SHA1 Message Date
Brock H Caldwell
dbcc24c49f fix(DownloadOptionEvaluator): bad logic checking filters
Some checks failed
SonarQube Scan / SonarQube Trigger (push) Failing after -50s
2026-02-08 12:34:50 -06:00
Brock H Caldwell
939b059872 fix: adds download url check for monitors
Some checks failed
SonarQube Scan / SonarQube Trigger (push) Failing after -1m0s
2026-02-06 19:41:09 -06:00

View File

@@ -21,7 +21,12 @@ class DownloadOptionEvaluator
return false; return false;
} }
if (false === $this->validateSize($result, $filter)) { // todo: This is arbitrary- revisit in the future
//if (false === $this->validateSize($result, $filter)) {
// return false;
//}
if (false === $this->validateDownloadUrl($result->url)) {
return false; return false;
} }
@@ -47,15 +52,15 @@ class DownloadOptionEvaluator
$valid = false; $valid = false;
} }
if (null !== $filter->codec && in_array($result->codec, $filter->codec)) { if (null !== $filter->codec && !in_array($result->codec, $filter->codec)) {
$valid = false; $valid = false;
} }
if (null !== $filter->quality && in_array($result->quality, $filter->quality)) { if (null !== $filter->quality && !in_array($result->quality, $filter->quality)) {
$valid = false; $valid = false;
} }
if (null !== $filter->provider && in_array($result->provider, $filter->provider)) { if (null !== $filter->provider && !in_array($result->provider, $filter->provider)) {
$valid = false; $valid = false;
} }
@@ -79,4 +84,18 @@ class DownloadOptionEvaluator
return false; return false;
} }
public function validateDownloadUrl(string $downloadUrl)
{
$badFileLocations = [
'https://torrentio.strem.fun/videos/failed_infringement_v2.mp4' => 'Removed for Copyright Infringement.',
];
$headers = get_headers($downloadUrl, true);
if (array_key_exists($headers['Location'], $badFileLocations)) {
return false;
}
return true;
}
} }