chromium-browser-stable-test/0002-Yandex-as-default-search-engine.patch

228 lines
10 KiB
Diff
Raw Normal View History

2023-10-16 23:43:39 +03:00
From 27630293baa498cdc49748e16974108e5369282c Mon Sep 17 00:00:00 2001
From: Mikhail Novosyolov <m.novosyolov@rosalinux.ru>
Date: Sun, 29 May 2022 22:31:21 +0300
2023-10-16 23:43:39 +03:00
Subject: [PATCH 2/5] Yandex as default search engine
Unfortunately, Google has commercially gone away from Russia, where most users of ROSA Linux are located.
Quality of google.ru search results seems to be degradating a bit.
I understand that Google develops Chromium, and so it would be fair if they got some money from adverstisment,
but, firstly, they have themselves stopped all ads in Russia,
secondly, influnce of Google is a bad thing because they have to take part in the information war.
The patch "Functional new tab page with non-Google search engines" makes chrome://new-tab-page work.
Yandex's URL which is patched here does not allow to add new items in to the quick access list
and shows advertisment of the proprietary Yandex browser. I do not want users to install it.
A simpler solution would be changing chromium-default-config.json like
2023-02-08 22:04:13 +03:00
https://os.mos.ru/git/MOS/mos-panel-desktop/src/0f02deea4f7da5ee186433cc71a7ba0193a8f52d/kometa-std-desktop-1.1/chromium.json
but it would make Yandex.ru be the default even for not Russian users.
2023-02-08 22:04:13 +03:00
Yandex suggested ROSA to add ROSA's partner ID, also adding it.
---
2023-10-16 23:43:39 +03:00
.../search_engines/prepopulated_engines.json | 21 +++++++-------
2023-02-08 22:04:13 +03:00
.../search_engines/search_terms_data.cc | 2 +-
2023-10-16 23:43:39 +03:00
.../template_url_prepopulate_data.cc | 28 ++++++++++++-------
3 files changed, 30 insertions(+), 21 deletions(-)
2023-10-17 08:55:32 +00:00
--- a/components/search_engines/prepopulated_engines.json 2023-10-11 01:22:02.550145900 +0000
+++ b/components/search_engines/prepopulated_engines.json 2023-10-17 08:24:01.259057801 +0000
@@ -556,11 +556,11 @@
2023-02-08 22:04:13 +03:00
"keyword": "yandex.by",
"favicon_url": "https://yastatic.net/lego/_/pDu9OWAQKB0s2J9IojKpiS_Eho.ico",
"logo_url": "https://storage.ape.yandex.net/get/browser/Doodles/yandex/drawable-xxhdpi/yandex.png",
2023-08-23 11:46:25 +03:00
- "search_url": "https://yandex.by/{yandex:searchPath}?text={searchTerms}",
2023-02-08 22:04:13 +03:00
+ "search_url": "https://yandex.by/{yandex:searchPath}?text={searchTerms}&from=rosa&{yandex:referralID}",
2023-02-08 18:31:02 +00:00
"suggest_url": "https://suggest.yandex.by/suggest-ff.cgi?part={searchTerms}&{google:cursorPosition}",
"image_url": "https://yandex.by/images/search/?rpt=imageview",
"image_url_post_params": "upfile={google:imageThumbnail},original_width={google:imageOriginalWidth},original_height={google:imageOriginalHeight},prg=1",
2023-02-08 18:31:02 +00:00
- "new_tab_url": "https://www.yandex.by/chrome/newtab",
+ "new_tab_url": "chrome://new-tab-page",
2023-02-08 18:31:02 +00:00
"type": "SEARCH_ENGINE_YANDEX",
"id": 15
},
2023-10-17 08:55:32 +00:00
@@ -569,10 +569,11 @@
2023-02-08 22:04:13 +03:00
"name": "Yandex",
"keyword": "yandex.com",
"favicon_url": "https://yastatic.net/lego/_/rBTjd6UOPk5913OSn5ZQVYMTQWQ.ico",
2023-08-23 11:46:25 +03:00
- "search_url": "https://yandex.com/search/?text={searchTerms}&from=os&clid=1836588",
2023-02-08 22:04:13 +03:00
+ "search_url": "https://yandex.com/search/?text={searchTerms}&from=rosa&{yandex:referralID}",
"suggest_url": "https://suggest.yandex.com/suggest-ff.cgi?part={searchTerms}&{google:cursorPosition}&uil=en&v=3&sn=5",
"image_url": "https://yandex.com/images/search?rpt=imageview",
"image_url_post_params": "upfile={google:imageThumbnail},original_width={google:imageOriginalWidth},original_height={google:imageOriginalHeight},prg=1",
+ "new_tab_url": "chrome://new-tab-page",
"type": "SEARCH_ENGINE_YANDEX",
"id": 15
},
2023-10-17 08:55:32 +00:00
@@ -582,11 +583,11 @@
2023-02-08 22:04:13 +03:00
"keyword": "yandex.kz",
"favicon_url": "https://yastatic.net/lego/_/pDu9OWAQKB0s2J9IojKpiS_Eho.ico",
"logo_url": "https://storage.ape.yandex.net/get/browser/Doodles/yandex/drawable-xxhdpi/yandex.png",
2023-08-23 11:46:25 +03:00
- "search_url": "https://yandex.kz/{yandex:searchPath}?text={searchTerms}",
2023-02-08 22:04:13 +03:00
+ "search_url": "https://yandex.kz/{yandex:searchPath}?text={searchTerms}&from=rosa&{yandex:referralID}",
"suggest_url": "https://suggest.yandex.kz/suggest-ff.cgi?part={searchTerms}&{google:cursorPosition}",
"image_url": "https://yandex.kz/images/search/?rpt=imageview",
"image_url_post_params": "upfile={google:imageThumbnail},original_width={google:imageOriginalWidth},original_height={google:imageOriginalHeight},prg=1",
- "new_tab_url": "https://www.yandex.kz/chrome/newtab",
+ "new_tab_url": "chrome://new-tab-page",
"type": "SEARCH_ENGINE_YANDEX",
"id": 15
},
2023-10-17 08:55:32 +00:00
@@ -596,11 +597,11 @@
2023-02-08 22:04:13 +03:00
"keyword": "yandex.ru",
"favicon_url": "https://yastatic.net/lego/_/pDu9OWAQKB0s2J9IojKpiS_Eho.ico",
"logo_url": "https://storage.ape.yandex.net/get/browser/Doodles/yandex/drawable-xxhdpi/yandex.png",
2023-08-23 11:46:25 +03:00
- "search_url": "https://yandex.ru/{yandex:searchPath}?text={searchTerms}&{yandex:referralID}",
2023-02-08 22:04:13 +03:00
+ "search_url": "https://yandex.ru/{yandex:searchPath}?text={searchTerms}&from=rosa&{yandex:referralID}",
"suggest_url": "https://suggest.yandex.ru/suggest-ff.cgi?part={searchTerms}&{google:cursorPosition}",
"image_url": "https://yandex.ru/images/search/?rpt=imageview",
"image_url_post_params": "upfile={google:imageThumbnail},original_width={google:imageOriginalWidth},original_height={google:imageOriginalHeight},prg=1",
- "new_tab_url": "https://www.yandex.ru/chrome/newtab",
+ "new_tab_url": "chrome://new-tab-page",
"type": "SEARCH_ENGINE_YANDEX",
"id": 15
},
2023-10-17 08:55:32 +00:00
@@ -609,11 +610,11 @@
2023-02-08 22:04:13 +03:00
"name": "Yandex",
"keyword": "yandex.com.tr",
"favicon_url": "https://yastatic.net/lego/_/rBTjd6UOPk5913OSn5ZQVYMTQWQ.ico",
2023-08-23 11:46:25 +03:00
- "search_url": "https://www.yandex.com.tr/{yandex:searchPath}?text={searchTerms}",
2023-02-08 22:04:13 +03:00
+ "search_url": "https://www.yandex.com.tr/{yandex:searchPath}?text={searchTerms}&from=rosa&{yandex:referralID}",
"suggest_url": "https://suggest.yandex.com.tr/suggest-ff.cgi?part={searchTerms}&{google:cursorPosition}",
"image_url": "https://yandex.com.tr/gorsel/search?rpt=imageview",
"image_url_post_params": "upfile={google:imageThumbnail},original_width={google:imageOriginalWidth},original_height={google:imageOriginalHeight},prg=1",
- "new_tab_url": "https://www.yandex.com.tr/chrome/newtab",
+ "new_tab_url": "chrome://new-tab-page",
"type": "SEARCH_ENGINE_YANDEX",
"id": 15
},
2023-10-17 08:55:32 +00:00
@@ -623,7 +624,7 @@
2023-02-08 22:04:13 +03:00
"keyword": "yandex.ua",
"favicon_url": "https://yastatic.net/lego/_/pDu9OWAQKB0s2J9IojKpiS_Eho.ico",
"logo_url": "https://storage.ape.yandex.net/get/browser/Doodles/yandex/drawable-xxhdpi/yandex.png",
2023-08-23 11:46:25 +03:00
- "search_url": "https://yandex.ua/{yandex:searchPath}?text={searchTerms}",
2023-02-08 22:04:13 +03:00
+ "search_url": "https://yandex.ua/{yandex:searchPath}?text={searchTerms}&from=rosa&{yandex:referralID}",
"suggest_url": "https://suggest.yandex.ua/suggest-ff.cgi?part={searchTerms}&{google:cursorPosition}",
"image_url": "https://yandex.ua/images/search/?rpt=imageview",
"image_url_post_params": "upfile={google:imageThumbnail},original_width={google:imageOriginalWidth},original_height={google:imageOriginalHeight},prg=1",
2023-10-17 08:55:32 +00:00
--- a/components/search_engines/search_terms_data.cc 2023-10-11 01:22:02.550145900 +0000
+++ b/components/search_engines/search_terms_data.cc 2023-10-17 08:26:21.433286473 +0000
@@ -165,7 +165,7 @@
2023-08-23 11:46:25 +03:00
}
std::string SearchTermsData::GetYandexReferralID() const {
- return std::string();
+ return "2746754";
}
std::string SearchTermsData::GetMailRUReferralID() const {
2023-10-17 08:55:32 +00:00
--- a/components/search_engines/template_url_prepopulate_data.cc 2023-10-11 01:22:02.554146300 +0000
+++ b/components/search_engines/template_url_prepopulate_data.cc 2023-10-17 08:38:17.755577363 +0000
@@ -30,6 +30,7 @@
// Default (for countries with no better engine set)
2023-10-17 08:55:32 +00:00
const PrepopulatedEngine* const engines_default[] = {
+ &yandex_com,
&google,
&bing,
&yahoo,
@@ -39,12 +40,13 @@
// Engine selection by country ------------------------------------------------
// clang-format off
// United Arab Emirates
+// yandex.ru in Arab Emirates in top most popular engines... mda
const PrepopulatedEngine* const engines_AE[] = {
+ &yandex_ru,
&google,
&bing,
&yahoo,
&duckduckgo,
- &yandex_ru,
2023-10-16 23:43:39 +03:00
};
2023-10-17 08:55:32 +00:00
// Albania
@@ -157,8 +159,8 @@
// Belarus
2023-10-17 08:55:32 +00:00
const PrepopulatedEngine* const engines_BY[] = {
- &google,
&yandex_by,
+ &google,
&mail_ru,
&bing,
&duckduckgo,
@@ -436,10 +438,10 @@
// Iraq
2023-10-17 08:55:32 +00:00
const PrepopulatedEngine* const engines_IQ[] = {
+ &yandex_tr,
&google,
&bing,
&yahoo,
- &yandex_tr,
&petal_search,
};
2023-10-17 08:55:32 +00:00
@@ -526,8 +528,8 @@
// Kazakhstan
2023-10-17 08:55:32 +00:00
const PrepopulatedEngine* const engines_KZ[] = {
- &google,
&yandex_kz,
+ &google,
&mail_ru,
&bing,
&duckduckgo,
@@ -786,15 +788,18 @@
};
// Serbia
2023-10-16 23:43:39 +03:00
+ // yandex.ru in Serbia in top most popular search engines...
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=1330154#c9
2023-10-17 08:55:32 +00:00
const PrepopulatedEngine* const engines_RS[] = {
+ &yandex_ru,
&google,
&bing,
&yahoo,
&duckduckgo,
- &yandex_ru,
2023-10-16 23:43:39 +03:00
};
// Russia
2023-10-17 08:55:32 +00:00
+// keep yandex_ru on the first place
const PrepopulatedEngine* const engines_RU[] = {
&yandex_ru,
&google,
@@ -895,8 +900,8 @@
// Turkey
2023-10-17 08:55:32 +00:00
const PrepopulatedEngine* const engines_TR[] = {
- &google,
&yandex_tr,
+ &google,
&yahoo_tr,
&bing,
&duckduckgo,
@@ -1384,12 +1389,15 @@
t_urls = GetPrepopulationSetFromCountryID(
country_codes::GetCountryIDFromPrefs(prefs));
}
- if (default_search_provider_index) {
2023-02-06 01:28:11 +03:00
- const auto itr =
2023-08-23 11:46:25 +03:00
- base::ranges::find(t_urls, google.id, &TemplateURLData::prepopulate_id);
2022-06-05 17:22:16 +03:00
- *default_search_provider_index =
- itr == t_urls.end() ? 0 : std::distance(t_urls.begin(), itr);
- }
+ /* Making yandex_ru be the first in "const PrepopulatedEngine* const engines_RU[]"
+ * makes it be the first item in chrome://settings/search,
+ * but Google is still chosen by default.
2022-06-05 17:22:16 +03:00
+ * Removed code calculated the distance between 0 and Google's position
+ * and assign that position to default_search_provider_index,
+ * so that Google still was the default search engine.
+ * Instead, just use the first search engine as the default one.
+ */
2022-06-05 17:22:16 +03:00
+ if (default_search_provider_index) *default_search_provider_index = 0;
return t_urls;
}