fix(web): revalidate app assets and rename compose example
This commit is contained in:
1 parent
eff4b0149d
commit
1b08854b25
6 files changed
+25
-10
No files matched your search
@@ -397,13 +397,17 @@ border-color:#3a2c22;color:#f3e9dc}button{background:#e9b97c;color:#2a1a10}}
|
||||
}:
|
||||
content_type += "; charset=utf-8"
|
||||
payload = target.read_bytes()
|
||||
vendor_root = (STATIC_ROOT / "vendor").resolve()
|
||||
try:
|
||||
target.relative_to(vendor_root)
|
||||
cache_control = "public, max-age=86400"
|
||||
except ValueError:
|
||||
# 应用自身的 JS/CSS/HTML 每次重新校验,保证升级后浏览器立刻拿到新版。
|
||||
cache_control = "no-cache"
|
||||
self.send_response(HTTPStatus.OK)
|
||||
self.send_header("Content-Type", content_type)
|
||||
self.send_header("Content-Length", str(len(payload)))
|
||||
self.send_header(
|
||||
"Cache-Control",
|
||||
"no-cache" if target.name == "index.html" else "public, max-age=3600",
|
||||
)
|
||||
self.send_header("Cache-Control", cache_control)
|
||||
self._security_headers()
|
||||
self.end_headers()
|
||||
if method != "HEAD":
|
||||
|
||||
Reference in new issue
Block a user