From 508ac0c576adc5314c3b8d6e5287a5ee2506b461 Mon Sep 17 00:00:00 2001 From: davidovski Date: Thu, 24 Aug 2023 15:45:45 +0100 Subject: [PATCH] Use cookie frontend over config frontend --- engines/invidious/video.php | 2 +- misc/search_engine.php | 21 ++++++++++----------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/engines/invidious/video.php b/engines/invidious/video.php index 17264df..afd51b2 100644 --- a/engines/invidious/video.php +++ b/engines/invidious/video.php @@ -15,7 +15,7 @@ if ($response["type"] == "video") { $title = $response["title"]; $url = "https://youtube.com/watch?v=" . $response["videoId"]; - $url = check_for_privacy_frontend($url, $this-opts); + $url = check_for_privacy_frontend($url, $this->opts); $uploader = $response["author"]; $views = $response["viewCount"]; $date = $response["publishedText"]; diff --git a/misc/search_engine.php b/misc/search_engine.php index b22941d..5ef99c4 100644 --- a/misc/search_engine.php +++ b/misc/search_engine.php @@ -6,19 +6,19 @@ $this->opts = $opts; $url = $this->get_request_url(); - error_log($url); - if ($url) { - $this->ch = curl_init($url); + if (!$url) + return; - if ($opts->curl_settings) - curl_setopt_array($this->ch, $opts->curl_settings); + $this->ch = curl_init($url); - if ($mh) - curl_multi_add_handle($mh, $this->ch); - } + if ($opts->curl_settings) + curl_setopt_array($this->ch, $opts->curl_settings); + + if ($mh) + curl_multi_add_handle($mh, $this->ch); } - public function get_request_url(){ + public function get_request_url() { return ""; } @@ -55,8 +55,7 @@ $opts->number_of_results ??= trim(htmlspecialchars($_COOKIE["number_of_results"])); foreach (array_keys($opts->frontends ?? array()) as $frontend) { - if (!$opts->frontends[$frontend]["instance_url"]) - $opts->frontends[$frontend]["instance_url"] = $_COOKIE[$frontend] ?? ""; + $opts->frontends[$frontend]["instance_url"] = $_COOKIE[$frontend] ?? $opts->frontends[$frontend]["instance_url"]; } return $opts; }