Deploy implemented Videoreg interface and persistent theme cycle
This commit is contained in:
1 parent
6405a8d101
commit
a12eefa1de
98 files changed
+4094
-2319
No files matched your search
+1
-1
@@ -8,7 +8,7 @@ server {
|
||||
if ($videoreg_legacy != "") { return 308 $videoreg_legacy; }
|
||||
add_header X-Content-Type-Options nosniff always;
|
||||
add_header Referrer-Policy strict-origin-when-cross-origin always;
|
||||
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'; connect-src 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none'" always;
|
||||
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' https://mc.yandex.ru https://yastatic.net; style-src 'self' 'unsafe-inline'; img-src 'self' data: https://mc.yandex.ru; font-src 'self'; connect-src 'self' https://mc.yandex.ru; frame-src 'self' blob: https://mc.yandex.ru; object-src 'none'; base-uri 'self'; frame-ancestors 'self'" always;
|
||||
location /api/ { return 404; }
|
||||
location ~ /showcase/?$ { return 404; }
|
||||
location /_next/static/ { expires 1y; add_header Cache-Control "public, immutable"; }
|
||||
|
||||
@@ -9,6 +9,11 @@ import re
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
OUT = ROOT / 'web-front/out'
|
||||
CSP_MATCH = re.search(r'add_header Content-Security-Policy "([^"]+)"', (ROOT / 'deploy/nginx.conf').read_text())
|
||||
if not CSP_MATCH:
|
||||
raise RuntimeError('Preview requires the actual deployment CSP')
|
||||
CONTENT_SECURITY_POLICY = CSP_MATCH.group(1)
|
||||
|
||||
|
||||
|
||||
def resolve_public(root: Path, request_path: str):
|
||||
@@ -37,6 +42,12 @@ def legacy_destination(request_path: str):
|
||||
|
||||
|
||||
class Handler(SimpleHTTPRequestHandler):
|
||||
def end_headers(self):
|
||||
self.send_header('Content-Security-Policy', CONTENT_SECURITY_POLICY)
|
||||
self.send_header('X-Content-Type-Options', 'nosniff')
|
||||
self.send_header('Referrer-Policy', 'strict-origin-when-cross-origin')
|
||||
super().end_headers()
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, directory=str(OUT), **kwargs)
|
||||
|
||||
|
||||
Reference in new issue
Block a user