diff options
author | Adam Tauber <asciimoo@gmail.com> | 2016-10-29 23:12:24 +0200 |
---|---|---|
committer | Adam Tauber <asciimoo@gmail.com> | 2016-10-29 23:21:07 +0200 |
commit | a67a4bf2c0dc3a34db9ab2610f974b199abf120d (patch) | |
tree | 6e5f8f0b036e395bec360a65784c04bf342972d7 /searx/webapp.py | |
parent | 574d9d40d25734477b90ea482377e276ced1ec1e (diff) | |
download | searxng-a67a4bf2c0dc3a34db9ab2610f974b199abf120d.tar.gz searxng-a67a4bf2c0dc3a34db9ab2610f974b199abf120d.zip |
[enh] allow morty proxy without hmac key
Diffstat (limited to 'searx/webapp.py')
-rw-r--r-- | searx/webapp.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/searx/webapp.py b/searx/webapp.py index 860208cd2..e9c5e917a 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -253,11 +253,15 @@ def proxify(url): if not settings.get('result_proxy'): return url - h = hmac.new(settings['result_proxy']['key'], url.encode('utf-8'), hashlib.sha256).hexdigest() + url_params = dict(mortyurl=url.encode('utf-8')) + + if settings['result_proxy'].get('key'): + url_params['mortyhash'] = hmac.new(settings['result_proxy']['key'], + url.encode('utf-8'), + hashlib.sha256).hexdigest() return '{0}?{1}'.format(settings['result_proxy']['url'], - urlencode(dict(mortyurl=url.encode('utf-8'), - mortyhash=h))) + urlencode(url_params)) def image_proxify(url): |