diff --git a/engines/google/text.php b/engines/google/text.php index 6d4b44c..d5321b2 100644 --- a/engines/google/text.php +++ b/engines/google/text.php @@ -1,6 +1,9 @@ textContent; - if (substr_count($_SERVER["HTTP_COOKIE"], " ") >= 1) - $url = check_for_privacy_friendly_alternative($url); + + $url = privacy_friendly_alternative($url); $title = $xpath->evaluate(".//h3", $result)[0]; $description = $xpath->evaluate(".//div[contains(@class, 'VwiC3b')]", $result)[0]; diff --git a/engines/google/video.php b/engines/google/video.php index b834106..5526fc4 100644 --- a/engines/google/video.php +++ b/engines/google/video.php @@ -21,8 +21,8 @@ continue; $url = $url->textContent; - if (substr_count($_SERVER["HTTP_COOKIE"], " ") >= 1) - $url = check_for_privacy_friendly_alternative($url); + + $url = privacy_friendly_alternative($url); $title = $xpath->evaluate(".//h3", $result)[0]; diff --git a/misc/header.php b/misc/header.php index 2536e85..398765d 100644 --- a/misc/header.php +++ b/misc/header.php @@ -9,4 +9,12 @@ - "/> \ No newline at end of file + + "/> \ No newline at end of file diff --git a/misc/tools.php b/misc/tools.php index edf25ed..6268873 100644 --- a/misc/tools.php +++ b/misc/tools.php @@ -6,21 +6,36 @@ return $base_url; } - function check_for_privacy_friendly_alternative($url) + function check_for_privacy_friendly_alternative($url, $frontend, $tobereplaced) { - if (isset($_COOKIE["invidious"]) && strpos($url, "youtube.com")) - $url = $_COOKIE["invidious"] . explode("youtube.com", $url)[1]; - else if (isset($_COOKIE["bibliogram"]) && strpos($url, "instagram.com")) + if (isset($_COOKIE[$frontend]) || isset($_REQUEST[$frontend])) { - if (!strpos($url, "/p/")) - $_COOKIE["bibliogram"] .= "/u"; + $frontend = isset($_COOKIE[$frontend]) ? $_COOKIE[$frontend] : $_REQUEST[$frontend]; - $url = $_COOKIE["bibliogram"] . explode("instagram.com", $url)[1]; + if ($tobereplaced == "instagram.com") + { + if (!strpos($url, "/p/")) + $frontend .= "/u"; + } + + $url = $frontend . explode($tobereplaced, $url)[1]; + + return $url; } - else if (isset($_COOKIE["nitter"]) && strpos($url, "twitter.com")) - $url = $_COOKIE["nitter"] . explode("twitter.com", $url)[1]; - else if (isset($_COOKIE["libreddit"]) && strpos($url, "reddit.com")) - $url = $_COOKIE["libreddit"] . explode("reddit.com", $url)[1]; + + return $url; + } + + function privacy_friendly_alternative($url) + { + if (strpos($url, "youtube.com")) + $url = check_for_privacy_friendly_alternative($url, "invidious", "youtube.com"); + else if (strpos($url, "instagram.com")) + $url = check_for_privacy_friendly_alternative($url, "bibliogram", "instagram.com"); + else if (strpos($url, "twitter.com")) + $url = check_for_privacy_friendly_alternative($url, "nitter", "twitter.com"); + else if (strpos($url, "reddit.com")) + $url = check_for_privacy_friendly_alternative($url, "libreddit", "reddit.com"); return $url; } diff --git a/settings.php b/settings.php index 7d3402b..636ada2 100644 --- a/settings.php +++ b/settings.php @@ -1,4 +1,44 @@ - + +
For an example if you want to view YouTube without getting spied on, click on "Invidious", find the instance that is most suitable for you then paste it in (correct format: https://url.domain)
+For an example if you want to view YouTube without getting spied on, click on "Invidious", find the instance that is most suitable for you then paste it in (correct format: https://example.com)
- +