mirror of
https://github.com/searx/searx
synced 2025-08-30 22:16:19 +00:00
[enh] allow morty proxy without hmac key
This commit is contained in:
@@ -253,11 +253,15 @@ def proxify(url):
|
|||||||
if not settings.get('result_proxy'):
|
if not settings.get('result_proxy'):
|
||||||
return url
|
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'],
|
return '{0}?{1}'.format(settings['result_proxy']['url'],
|
||||||
urlencode(dict(mortyurl=url.encode('utf-8'),
|
urlencode(url_params))
|
||||||
mortyhash=h)))
|
|
||||||
|
|
||||||
|
|
||||||
def image_proxify(url):
|
def image_proxify(url):
|
||||||
|
Reference in New Issue
Block a user