From 62986a9ddccf6ddba97cd998aa085af8be5d0fca Mon Sep 17 00:00:00 2001 From: tigro Date: Tue, 27 Jun 2023 11:20:04 +0300 Subject: [PATCH] set Yandex as default search provider --- SOURCES/use_yandex_search_as_default.py | 44 +++++++++++++++++++++++++ SPECS/firefox.spec | 13 ++++++-- 2 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 SOURCES/use_yandex_search_as_default.py diff --git a/SOURCES/use_yandex_search_as_default.py b/SOURCES/use_yandex_search_as_default.py new file mode 100644 index 0000000..f456af3 --- /dev/null +++ b/SOURCES/use_yandex_search_as_default.py @@ -0,0 +1,44 @@ +import json +import sys +import datetime + +YANDEX_SECTION = json.loads(''' + { + "appliesTo": [ + { + "default": "yes", + "included": { + "everywhere": true + } + } + ], + "id": "a0e7f96a-14e0-4d56-9f54-e0c7e49fd306", + "last_modified": 1679065511545, + "schema": 1639069022290, + "webExtension": { + "id": "yandex@search.mozilla.org" + } + } +''') + +search_config = None +with open(sys.argv[1]) as f: + search_config = json.load(f) + +inserted = False +for engine in search_config["data"]: + if engine["webExtension"]["id"] == "yandex@search.mozilla.org": + inserted = True + engine = YANDEX_SECTION + else: + for applies in engine["appliesTo"]: + if "default" in applies and applies["default"] == "yes": + applies["default"] = "no" + +if not inserted: + search_config["data"] = [YANDEX_SECTION] + search_config["data"] + +search_config["timestamp"] = int( datetime.datetime.now().timestamp() ) * 1000 + +with open(sys.argv[1], 'w') as f: + json.dump(search_config, f, indent=2) diff --git a/SPECS/firefox.spec b/SPECS/firefox.spec index 2044217..7516f22 100644 --- a/SPECS/firefox.spec +++ b/SPECS/firefox.spec @@ -201,7 +201,7 @@ end} Summary: Mozilla Firefox Web browser Name: firefox Version: 102.9.0 -Release: 3%{?dist}.inferit +Release: 3%{?dist}.inferit.1 URL: https://www.mozilla.org/firefox/ License: MPLv1.1 or GPLv2+ or LGPLv2+ @@ -266,7 +266,10 @@ Source402: nspr-4.34.0-3.el8_1.src.rpm # MSVSphere added Russian Trusted Root CA Source500: rootca_ssl_rsa2022.cer Source501: policies.json - +# apply script from ROSA to set Yandex provides +# as default search provider for Firefox +# https://abf.rosalinux.ru/import/firefox/raw/rosa2023.1/use_yandex_search_as_default.py +Source502: use_yandex_search_as_default.py # Build patches Patch3: mozilla-build-arm.patch Patch25: rhbz-1219542-s390-build.patch @@ -707,6 +710,9 @@ echo "use_rustts %{?use_rustts}" %endif %endif +# set Yandex search provider by default +python3 %{SOURCE502} services/settings/dumps/main/search-config.json + %{__rm} -f .mozconfig @@ -1462,6 +1468,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Tue Jun 27 2023 Arkady L. Shane - 102.9.0-3.inferit.3 +- set Yandex as default search provider + * Mon Apr 03 2023 Sergey Cherevko - 102.3.0-6.inferit.2 - Changed https to http on start page http://msvsphere.ru