|
|
|
@ -83,10 +83,10 @@ def _cache_file(path, query):
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
digest = hashlib.sha1(("%s %s" % (path, query)).encode("utf-8")).hexdigest()
|
|
|
|
|
digest_number = ord(digest[0])
|
|
|
|
|
expiry_interval = 60*(30+digest_number)
|
|
|
|
|
digest_number = ord(digest[0].upper())
|
|
|
|
|
expiry_interval = 60*(digest_number+10)
|
|
|
|
|
|
|
|
|
|
timestamp = "%010d" % (int(time.time())//1000/expiry_interval*expiry_interval)
|
|
|
|
|
timestamp = "%010d" % (int(time.time())//expiry_interval*expiry_interval)
|
|
|
|
|
filename = os.path.join(PROXY_CACHEDIR, timestamp, path, query)
|
|
|
|
|
|
|
|
|
|
return filename
|
|
|
|
@ -241,6 +241,8 @@ def proxy(path):
|
|
|
|
|
content = response.content
|
|
|
|
|
else:
|
|
|
|
|
content = "{}"
|
|
|
|
|
else:
|
|
|
|
|
print("cache found")
|
|
|
|
|
|
|
|
|
|
content = add_translations(content, lang)
|
|
|
|
|
|
|
|
|
|