From 1183059d8b4dff2b3bd14e07e2b900709d98b258 Mon Sep 17 00:00:00 2001 From: Claus Lohmar Date: Wed, 22 Jul 2026 05:24:21 +0000 Subject: [PATCH] fix: add no-cache headers + remove debug console.logs - Cache-Control/Pragma/Expires headers prevent browser caching of JS-heavy pages (fixes stale code after updates) - Removed debug console.log statements from upload handlers --- frontend/app.py | 4 ++++ frontend/templates/index.html | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/frontend/app.py b/frontend/app.py index 06dbb0b..6f08985 100644 --- a/frontend/app.py +++ b/frontend/app.py @@ -47,6 +47,10 @@ async def log_requests(request: Request, call_next): logger.info("→ %s %s (body %s bytes)", request.method, request.url.path, cl) try: response = await call_next(request) + # Prevent browser caching (especially important for JS-heavy pages) + response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate" + response.headers["Pragma"] = "no-cache" + response.headers["Expires"] = "0" return response except Exception: logger.exception("← %s %s FAILED", request.method, request.url.path) diff --git a/frontend/templates/index.html b/frontend/templates/index.html index d91b2f9..d2a8abd 100644 --- a/frontend/templates/index.html +++ b/frontend/templates/index.html @@ -71,7 +71,6 @@ function toggleSourceInput(e) { function setPhase(label, pct, isSpinner) { const el = document.getElementById('phase-label'); const fill = document.getElementById('progress-fill'); - console.log('[setPhase] el:', !!el, 'fill:', !!fill, 'label:', label, 'pct:', pct); if (el) el.innerHTML = (isSpinner ? ' ' : '') + label; } @@ -135,8 +134,8 @@ async function handleUpload(formData) { xhr.timeout = 7200000; // 2 hour timeout for very large uploads xhr.upload.addEventListener('progress', (e) => { - console.log('[upload] progress', e.loaded, e.total, e.lengthComputable); if (e.lengthComputable) { + const pct = Math.round((e.loaded / e.total) * 100); setPhase('Uploading source file... ' + (e.loaded / (1024**3)).toFixed(1) + ' GiB', pct, false); } else { // Fallback: show bytes uploaded even without total @@ -145,7 +144,6 @@ async function handleUpload(formData) { }); xhr.addEventListener('loadstart', () => { - console.log('[upload] loadstart'); setPhase('Uploading source file...', 0, true); });