Skip to content

Commit

Permalink
Fix errant Not A Valid URL error
Browse files Browse the repository at this point in the history
  • Loading branch information
elektrikfisch committed Sep 2, 2024
1 parent ec61147 commit c8da25d
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 c8da25d

Please sign in to comment.