|
|
@ -94,21 +94,20 @@ def plugin_file(plugin, path):
|
|
|
|
redis.set(full_path + ":content", result)
|
|
|
|
redis.set(full_path + ":content", result)
|
|
|
|
redis.set(full_path + ":etag", etag)
|
|
|
|
redis.set(full_path + ":etag", etag)
|
|
|
|
|
|
|
|
|
|
|
|
resp = Response(result, mimetype=mt)
|
|
|
|
# set headers
|
|
|
|
resp.headers.add('Access-Control-Allow-Origin', '*')
|
|
|
|
headers = {
|
|
|
|
resp.headers.add('ETag', etag)
|
|
|
|
'Access-Control-Allow-Origin': '*',
|
|
|
|
|
|
|
|
'ETag': etag
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# if browser does not have a cached etag -> 200
|
|
|
|
# if browser does not have a cached etag -> 200
|
|
|
|
if 'If-None-Match' not in request.headers:
|
|
|
|
if 'If-None-Match' not in request.headers:
|
|
|
|
resp.status_code = 200
|
|
|
|
status_code = 200
|
|
|
|
# then check if it is the latest etag, else -> 200
|
|
|
|
# then check if it is the latest etag, else -> 200
|
|
|
|
elif request.headers['If-None-Match'] != etag:
|
|
|
|
elif request.headers['If-None-Match'] != etag:
|
|
|
|
resp.status_code = 200
|
|
|
|
status_code = 200
|
|
|
|
# else just set whatever was predetermined
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
resp.status_code = status_code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return resp
|
|
|
|
return Response(result, mimetype=mt, headers=headers, status=status_code)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
if __name__ == '__main__':
|
|
|
|
app.run(host="0.0.0.0")
|
|
|
|
app.run(host="0.0.0.0")
|
|
|
|