Proxify most of images references

Create hash only when necessary
This commit is contained in:
dalf 2015-01-18 09:54:24 +01:00
parent 9154cf7930
commit 1d51512152
8 changed files with 11 additions and 11 deletions

View file

@ -214,11 +214,11 @@ def image_proxify(url):
if url.startswith('//'):
url = 'https:' + url
h = hashlib.sha256(url + settings['server']['secret_key']).hexdigest()
if not settings['server'].get('image_proxy') and not request.cookies.get('image_proxy'):
return url
h = hashlib.sha256(url + settings['server']['secret_key']).hexdigest()
return '{0}?{1}'.format(url_for('image_proxy'),
urlencode(dict(url=url, h=h)))