diff options
author | Alexandre Flament <alex@al-f.net> | 2022-08-29 19:42:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-29 19:42:04 +0200 |
commit | 242db5311817c1f8b9ab6b428060e3eb2a4aea76 (patch) | |
tree | 221888a3ebc1350382e2643b9237d4e357f78b38 /searx/settings_defaults.py | |
parent | a7bd2b47c2a8561d09b8247f81024e87239a6a88 (diff) | |
parent | 341ad4630398ed9ad12d134aeab2f60ba85a1e82 (diff) | |
download | searxng-242db5311817c1f8b9ab6b428060e3eb2a4aea76.tar.gz searxng-242db5311817c1f8b9ab6b428060e3eb2a4aea76.zip |
Merge pull request #1708 from dalf/result_proxy_default_settings
settings.yml: set default values for result_proxy
Diffstat (limited to 'searx/settings_defaults.py')
-rw-r--r-- | searx/settings_defaults.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/searx/settings_defaults.py b/searx/settings_defaults.py index 039987569..4e06fb023 100644 --- a/searx/settings_defaults.py +++ b/searx/settings_defaults.py @@ -9,6 +9,7 @@ import numbers import errno import os import logging +from base64 import b64decode from os.path import dirname, abspath from searx.languages import language_codes as languages @@ -107,6 +108,15 @@ class SettingsDirectoryValue(SettingsValue): return super().__call__(value) +class SettingsBytesValue(SettingsValue): + """str are base64 decoded""" + + def __call__(self, value: typing.Any) -> typing.Any: + if isinstance(value, str): + value = b64decode(value) + return super().__call__(value) + + def apply_schema(settings, schema, path_list): error = False for key, value in schema.items(): @@ -205,6 +215,11 @@ SCHEMA = { 'extra_proxy_timeout': SettingsValue(int, 0), 'networks': {}, }, + 'result_proxy': { + 'url': SettingsValue((None, str), None), + 'key': SettingsBytesValue((None, bytes), None), + 'proxify_results': SettingsValue(bool, False), + }, 'plugins': SettingsValue(list, []), 'enabled_plugins': SettingsValue((None, list), None), 'checker': { |