diff --git a/config.php.example b/config.php.example index d53280e..009de42 100644 --- a/config.php.example +++ b/config.php.example @@ -20,6 +20,9 @@ "disable_hidden_service_search" => false, + // You can disable automatic redirection from your instance + "automatic_redirection" => true, + /* Preset privacy friendly frontends for users, these can be overwritten by users in the settings e.g.: Preset the invidious instance URL: "instance_url" => "https://yewtu.be", diff --git a/engines/google/text.php b/engines/google/text.php index c598cc1..070e046 100644 --- a/engines/google/text.php +++ b/engines/google/text.php @@ -8,6 +8,7 @@ $results = array(); $domain = $config->google_domain; + $disable_automatic_redirection = isset($_COOKIE["disable_automatic_redirection"]); $site_language = isset($_COOKIE["google_language_site"]) ? trim(htmlspecialchars($_COOKIE["google_language_site"])) : $config->google_language_site; $results_language = isset($_COOKIE["google_language_results"]) ? trim(htmlspecialchars($_COOKIE["google_language_results"])) : $config->google_language_results; $number_of_results = isset($_COOKIE["google_number_of_results"]) ? trim(htmlspecialchars($_COOKIE["google_number_of_results"])) : $config->google_number_of_results; @@ -70,7 +71,10 @@ do { curl_multi_exec($mh, $running); } while ($running); - if (curl_getinfo($google_ch)['http_code'] == '302') { + + if (!$disabled_automatic_redirection + && $config->automatic_redirection + && curl_getinfo($google_ch)['http_code'] == '302') { $instances_json = json_decode(file_get_contents("instances.json"), true); $instances = array_map(fn($n) => $n['clearnet'], array_filter($instances_json['instances'], fn($n) => !is_null($n['clearnet']))); header("Location: " . $instances[array_rand($instances)] . "search.php?q=$query"); diff --git a/settings.php b/settings.php index fa41f3d..914e456 100644 --- a/settings.php +++ b/settings.php @@ -103,6 +103,13 @@

Google settings

+ automatic_redirection) : ?> +
+ + > +
+ +
Site language