diff --git a/app.py b/app.py index 32706fd..7911d7e 100644 --- a/app.py +++ b/app.py @@ -226,6 +226,10 @@ class Handler(BaseHTTPRequestHandler): if STATIC_DIR.resolve() not in target.parents or not target.is_file(): target = STATIC_DIR / "index.html" body = target.read_bytes() + if target.name == "index.html": + # Versioned URLs, so no cache (a home-screen app's included) can serve an old client. + for asset in (b"/static/app.js", b"/static/styles.css"): + body = body.replace(asset + b'"', asset + b"?v=" + VERSION.encode() + b'"') self.send_response(HTTPStatus.OK) self.send_header("Content-Type", mimetypes.guess_type(target.name)[0] or "application/octet-stream") self.send_header("Content-Length", str(len(body)))