fix: bypass affiliate logic

Removed affiliate link generation and verification logic from Wish class methods.
This commit is contained in:
Kumi 2024-11-04 09:54:31 +01:00
parent 368c8767f0
commit db4b1193cf
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -74,43 +74,13 @@ class Wish
public static function getAffiliateLink(string $url): string public static function getAffiliateLink(string $url): string
{ {
$urlParts = parse_url($url); // Bypass the link generation entirely for Private.coffee fork
if (isset($urlParts['query'])) {
\parse_str($urlParts['query'], $urlParameters);
} else {
$urlParameters = [];
}
foreach (self::$affiliates as $host => $tagId) {
if (\str_contains($urlParts['host'], $host)) {
$urlParameters['tag'] = $tagId;
$urlParts['query'] = \http_build_query($urlParameters);
$url = $urlParts['scheme'] . '://' . $urlParts['host'] . $urlParts['path'] . '?' . $urlParts['query'];
break;
}
}
return $url; return $url;
} }
public static function hasAffiliateLink(string $url): bool public static function hasAffiliateLink(string $url): bool
{ {
$urlParts = parse_url($url); // Just bypass the check entirely for Private.coffee fork
if (isset($urlParts['query'])) {
\parse_str($urlParts['query'], $urlParameters);
} else {
$urlParameters = [];
}
foreach (self::$affiliates as $host => $tagId) {
if (\str_contains($urlParts['host'], $host) && isset($urlParameters['tag'])) {
return true;
}
}
return false; return false;
} }