don't cache js files

https://forums.ankiweb.net/t/anki-2-1-50-beta/15608/101
This commit is contained in:
Damien Elmes 2021-12-28 13:50:11 +10:00
parent c3b5902da0
commit 972c9da12e

View File

@ -173,8 +173,12 @@ def _handle_local_file_request(request: LocalFileRequest) -> Response:
mimetype = _mime_for_path(fullpath) mimetype = _mime_for_path(fullpath)
if os.path.exists(fullpath): if os.path.exists(fullpath):
if fullpath.endswith(".css"): if fullpath.endswith(".css"):
# make changes to css files immediately reflected in the webview # caching css files prevents flicker in the webview, but we want
# a short cache
max_age = 10 max_age = 10
elif fullpath.endswith(".js"):
# don't cache js files
max_age = 0
else: else:
max_age = 60 * 60 max_age = 60 * 60
return flask.send_file( return flask.send_file(