From ea13fbecbe23a8db094ecc4ff9d648b6e72f54a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Tiek=C3=B6tter?= Date: Sat, 30 Oct 2021 23:11:10 +0200 Subject: [PATCH 1/4] [mod] searx.tiekoetter.com MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Source code of the SearXNG instance https://searx.tiekoetter.com The master branch is tested before being pushed (see update commit). The test branch can be unstable and/or updated rapidly; Use at your own risk! Signed-off-by: Léon Tiekötter --- .github/FUNDING.yml | 2 ++ searx/infopage/de/donate.md | 5 +++++ searx/infopage/en/donate.md | 5 +++++ searx/settings.yml | 5 +++++ searx/templates/simple/base.html | 3 +++ tests/robot/settings_robot.yml | 5 +++++ 6 files changed, 25 insertions(+) create mode 100644 .github/FUNDING.yml create mode 100644 searx/infopage/de/donate.md create mode 100644 searx/infopage/en/donate.md diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000000..4dcf598903e --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: [tiekoettercom] +custom: https://www.tiekoetter.com/donate/ diff --git a/searx/infopage/de/donate.md b/searx/infopage/de/donate.md new file mode 100644 index 00000000000..555c8451011 --- /dev/null +++ b/searx/infopage/de/donate.md @@ -0,0 +1,5 @@ +# Spenden + +## An Tiekoetter.com spenden + +Tiekoetter.com unterstützen: [https://www.tiekoetter.com/spenden](https://www.tiekoetter.com/spenden) diff --git a/searx/infopage/en/donate.md b/searx/infopage/en/donate.md new file mode 100644 index 00000000000..2863fa6026b --- /dev/null +++ b/searx/infopage/en/donate.md @@ -0,0 +1,5 @@ +# Donate + +## Donate to Tiekoetter.com + +Support Tiekoetter.com: [https://www.tiekoetter.com/en/donate](https://www.tiekoetter.com/en/donate/) diff --git a/searx/settings.yml b/searx/settings.yml index b37134b88f9..3ed374c4dd4 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -12,6 +12,8 @@ general: contact_url: false # record stats enable_metrics: true + legal_name: "" + legal_url: brand: new_issue_url: https://github.com/searxng/searxng/issues/new @@ -25,6 +27,9 @@ brand: # links: # Uptime: https://uptime.searxng.org/history/darmarit-org # About: "https://searxng.org" + website_name: "" + website_url: + donate_url: search: # Filter results. 0: None, 1: Moderate, 2: Strict diff --git a/searx/templates/simple/base.html b/searx/templates/simple/base.html index 4aeab383a0a..68792fb73f8 100644 --- a/searx/templates/simple/base.html +++ b/searx/templates/simple/base.html @@ -72,6 +72,9 @@ {% if get_setting('brand.public_instances') %} | {{ _('Public instances') }} {% endif %} + {% if get_setting('brand.website_url') and get_setting('brand.website_name') %} | {{ get_setting('brand.website_name') }}{% endif %} + {% if get_setting('brand.donate_url') %} | {{ _('Donate') }}{% endif %} + {% if get_setting('general.legal_url') and get_setting('general.legal_name') %} | {{ get_setting('general.legal_name') }}{% endif %} {% if get_setting('general.privacypolicy_url') %} | {{ _('Privacy policy') }} {% endif %} diff --git a/tests/robot/settings_robot.yml b/tests/robot/settings_robot.yml index ddf14bcbed7..d9d361166cd 100644 --- a/tests/robot/settings_robot.yml +++ b/tests/robot/settings_robot.yml @@ -1,6 +1,8 @@ general: debug: false instance_name: "searx_test" + legal_name: "test_legal" + legal_url: http://example.org/legal brand: git_url: https://github.com/searxng/searxng @@ -10,6 +12,9 @@ brand: docs_url: https://docs.searxng.org public_instances: https://searx.space wiki_url: https://github.com/searxng/searxng/wiki + website_name: "test_website1" + website_url: http://example.org/website1 + donate_url: http://example.org/website2 search: language: "all" From ff7270ea16bd1e8d5449cb1f81df598988f06941 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Tiek=C3=B6tter?= Date: Wed, 27 Apr 2022 16:47:50 +0200 Subject: [PATCH 2/4] [mod] wikipedia engine: use wikiless instance Use wikiless instance wikiless.tiekoetter.com instead of wikipedia.org Use the hostname replace toggle to enable / disable Wikiless. --- searx/engines/wikipedia.py | 9 +++++++++ searx/preferences.py | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/searx/engines/wikipedia.py b/searx/engines/wikipedia.py index 187915d65f1..18332bca958 100644 --- a/searx/engines/wikipedia.py +++ b/searx/engines/wikipedia.py @@ -54,6 +54,7 @@ """ +import re import urllib.parse import babel @@ -186,9 +187,17 @@ def response(resp): _network.raise_for_httperror(resp) + from searx.preferences import hostname_replace_choice # pylint: disable=import-outside-toplevel + api_result = resp.json() title = utils.html_to_text(api_result.get('titles', {}).get('display') or api_result.get('title')) wikipedia_link = api_result['content_urls']['desktop']['page'] + if hostname_replace_choice == "on": + wikipedia_link = ( + re.sub(r'(.*\.)wikipedia\.org', 'https://wikiless.tiekoetter.com', wikipedia_link) + + "?lang=" + + api_result['content_urls']['desktop']['page'][8:10] + ) if "list" in display_type or api_result.get('type') != 'standard': # show item in the result list if 'list' is in the display options or it diff --git a/searx/preferences.py b/searx/preferences.py index 18c3f08d817..f25be2e61b9 100644 --- a/searx/preferences.py +++ b/searx/preferences.py @@ -510,8 +510,17 @@ def parse_encoded_data(self, input_data: str): dict_data[x] = y[0] self.parse_dict(dict_data) + hostname_replace_choice = "off" + def parse_dict(self, input_data: Dict[str, str]): """parse preferences from request (``flask.request.form``)""" + + global hostname_replace_choice # pylint: disable=global-variable-undefined + if 'hostname_replace' in ','.join(self.plugins.enabled): + hostname_replace_choice = "on" + else: + hostname_replace_choice = "off" + for user_setting_name, user_setting in input_data.items(): if user_setting_name in self.key_value_settings: if self.key_value_settings[user_setting_name].locked: From 69e7524fc9e380e22e76fbea2f8bc18b7288c303 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Tiek=C3=B6tter?= Date: Sat, 23 Jul 2022 21:05:37 +0200 Subject: [PATCH 3/4] [mod] disable Tor network check Prevent unexpected crashes due to the Tor proxy not responding in time. --- searx/network/network.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/searx/network/network.py b/searx/network/network.py index 453c8d2fc06..b709188f5ae 100644 --- a/searx/network/network.py +++ b/searx/network/network.py @@ -303,13 +303,6 @@ def get_network(name=None): def check_network_configuration(): async def check(): exception_count = 0 - for network in NETWORKS.values(): - if network.using_tor_proxy: - try: - await network.get_client() - except Exception: # pylint: disable=broad-except - network._logger.exception('Error') # pylint: disable=protected-access - exception_count += 1 return exception_count future = asyncio.run_coroutine_threadsafe(check(), get_loop()) From 9a0375b16d4e74cfd2d13d54a7176636b32f7cde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Tiek=C3=B6tter?= Date: Fri, 4 Feb 2022 18:59:29 +0100 Subject: [PATCH 4/4] [mod] Custom searx_version display searx_version is replaced by searx_version_custom and displays the latest upstream commit with the latest fork commit. --- searx/templates/simple/base.html | 4 ++-- searx/templates/simple/new_issue.html | 2 +- searx/version.py | 30 +++++++++++++++++++++++++++ searx/webapp.py | 5 +++-- 4 files changed, 36 insertions(+), 5 deletions(-) diff --git a/searx/templates/simple/base.html b/searx/templates/simple/base.html index 68792fb73f8..b470f76e88c 100644 --- a/searx/templates/simple/base.html +++ b/searx/templates/simple/base.html @@ -4,7 +4,7 @@ - + @@ -65,7 +65,7 @@