Phase 8: TypeScript migration, i18n rewrite, Activity Tree, Projects API, Heartbeats

This commit is contained in:
Rose
2026-04-29 11:50:00 +02:00
parent c705fad626
commit 255914c9f1
43 changed files with 17948 additions and 6899 deletions

View File

@@ -60,6 +60,27 @@ class Handler(BaseHTTPRequestHandler):
})
print(f'[webui] {record}', flush=True)
def do_OPTIONS(self) -> None:
"""Handle CORS preflight requests."""
self._req_t0 = time.time()
try:
parsed = urlparse(self.path)
origin = self.headers.get('Origin', '')
# Set CORS headers for preflight
self.send_response(204)
self.send_header('Access-Control-Allow-Origin', origin or '*')
self.send_header('Access-Control-Allow-Methods', 'GET,POST,PUT,DELETE,PATCH,OPTIONS')
self.send_header('Access-Control-Allow-Headers', 'Content-Type,Authorization,X-Requested-With')
self.send_header('Access-Control-Max-Age', '86400')
self.send_header('Vary', 'Origin')
self.send_header('X-Content-Type-Options', 'nosniff')
self.send_header('X-Frame-Options', 'DENY')
self.end_headers()
except Exception as e:
print(f'[webui] ERROR OPTIONS {self.path}\n' + traceback.format_exc(), flush=True)
self.send_response(500)
self.end_headers()
def do_GET(self) -> None:
self._req_t0 = time.time()
try: