From a95c6cd76f27ed4eac1b2a20e4cdfdc047210fad Mon Sep 17 00:00:00 2001 From: Fred LE MEUR Date: Tue, 18 Aug 2020 16:39:01 +0200 Subject: [PATCH 1/2] To test with virtualenv --- admin/reference_settings.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/admin/reference_settings.yml b/admin/reference_settings.yml index 9e09baf..202fffb 100644 --- a/admin/reference_settings.yml +++ b/admin/reference_settings.yml @@ -188,9 +188,9 @@ engines: # shortcut : fa # api_key : 'apikey' # required! - - name : 500px - engine : www500px - shortcut : px +# - name : 500px +# engine : www500px +# shortcut : px - name : 1x engine : www1x @@ -505,13 +505,13 @@ engines: shortcut : se categories : science - - name : spotify - engine : spotify - shortcut : stf +# - name : spotify +# engine : spotify +# shortcut : stf - - name : subtitleseeker - engine : subtitleseeker - shortcut : ss +# - name : subtitleseeker +# engine : subtitleseeker +# shortcut : ss # The language is an option. You can put any language written in english # Examples : English, French, German, Hungarian, Chinese... # language : English @@ -530,10 +530,10 @@ engines: timeout : 6.0 disabled : True - - name : swisscows - engine : swisscows - shortcut : sw - disabled : True +# - name : swisscows +# engine : swisscows +# shortcut : sw +# disabled : True - name : tokyotoshokan engine : tokyotoshokan From f858edbd5666a568ca897342f6a82d706b0bac44 Mon Sep 17 00:00:00 2001 From: Fred LE MEUR Date: Mon, 11 Jan 2021 15:49:59 +0100 Subject: [PATCH 2/2] Fix YAMLLoadWarning Hello, I intend to package searx-admin in Debian. I'd like to share this patch with upstream. https://salsa.debian.org/python-team/packages/searx-admin --- admin/config.py | 4 ++-- admin/searx_manager.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/admin/config.py b/admin/config.py index 8e07f29..8761cd8 100644 --- a/admin/config.py +++ b/admin/config.py @@ -1,5 +1,5 @@ import yaml -with open('admin/config.yml') as config_file: - configuration = yaml.load(config_file) +with open('/etc/searx-admin/config.yml') as config_file: + configuration = yaml.safe_load(config_file) diff --git a/admin/searx_manager.py b/admin/searx_manager.py index c845374..81b3162 100644 --- a/admin/searx_manager.py +++ b/admin/searx_manager.py @@ -64,11 +64,11 @@ def __init__(self, root, uwsgi_extra_args): self.uwsgi_extra_args = uwsgi_extra_args with open(REFERENCE_SETTINGS_PATH) as config_file: config = config_file.read() - self.settings = yaml.load(config) + self.settings = yaml.safe_load(config) self.engines = load_engines(self.settings['engines']) if isfile(EDITABLE_SETTINGS_PATH): with open(EDITABLE_SETTINGS_PATH) as config_file2: - self._merge_settings(yaml.load(config_file2.read())) + self._merge_settings(yaml.safe_load(config_file2.read())) else: with open(EDITABLE_SETTINGS_PATH, 'w') as outfile: outfile.write(config)