Update app.py

This commit is contained in:
dev 2026-10-30 03:22:50 +00:00
parent 6196186b22
commit fc4f7472d1

5
app.py
View File

@ -995,6 +995,9 @@ def add_security_headers(response):
response.headers["Permissions-Policy"] = "camera=(self), microphone=(self), geolocation=()"
response.headers["Cross-Origin-Opener-Policy"] = "same-origin"
response.headers["Cross-Origin-Resource-Policy"] = "same-origin"
calls_connect_origin = CALLS_BASE
calls_ws_origin = CALLS_BASE.replace("https://", "wss://").replace("http://", "ws://")
response.headers["Content-Security-Policy"] = (
"default-src 'self'; "
"base-uri 'self'; "
@ -1005,7 +1008,7 @@ def add_security_headers(response):
"media-src 'self' blob:; "
"style-src 'self' 'unsafe-inline'; "
"script-src 'self'; "
"connect-src 'self';"
f"connect-src 'self' {calls_connect_origin} {calls_ws_origin};"
)
if request.path.startswith("/static/"):
response.headers["Cache-Control"] = "public, max-age=31536000, immutable"