Skip to content

Commit

Permalink
Merge pull request #1 from elektrikfisch/fix-not-a-valid-url
Browse files Browse the repository at this point in the history
Fix errant Not A Valid URL error
  • Loading branch information
elektrikfisch authored Sep 5, 2024
2 parents ec61147 + c8da25d commit 6d3f091
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions app/Controllers/ProxyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,8 @@ static private function isValidDomain(string $url): bool {
$valid = false;
$host = parse_url($url, PHP_URL_HOST);
$host_split = explode('.', $host);
$host_count = count($host_split);
if ($host_count === 2) {
// Using no watermark
$valid = in_array($host_split[0] . '.' . $host_split[1], self::VALID_TIKTOK_DOMAINS);
} elseif ($host_count === 3) {
$valid = in_array($host_split[1] . '.' . $host_split[2], self::VALID_TIKTOK_DOMAINS);
}
$host_domain = array_slice($host_split,-2)[0] . '.' . array_slice($host_split,-2)[1];
$valid = in_array($host_domain, self::VALID_TIKTOK_DOMAINS);
return $valid;
}

Expand Down

0 comments on commit 6d3f091

Please sign in to comment.