allow definition of a cache timeout in url args

This commit is contained in:
Yannik Schmidt
2021-07-06 14:28:02 +02:00
parent 0399eb7000
commit 17cdb5d4ba

View File

@@ -95,7 +95,16 @@ def sendPicture(path):
raw = flask.send_from_directory(".", path, cache_timeout=cache_timeout) raw = flask.send_from_directory(".", path, cache_timeout=cache_timeout)
response = flask.make_response(raw) response = flask.make_response(raw)
response.headers['X-ATHQ-INTERNAL-FID'] = path response.headers['X-ATHQ-INTERNAL-FID'] = path
# check for a cacheTimeout #
cacheTimeout = request.args.get("cache-timeout")
if not cacheTimeout:
cacheTimeout = request.args.get("ct")
if cacheTimeout:
response.headers['Cache-Control'] = "max-age=" + str(cacheTimeout)
return response return response
@app.route("/") @app.route("/")