From fa287261d0b42541129057a1b93680fae2b550cb Mon Sep 17 00:00:00 2001 From: Mike Johnston Date: Mon, 9 Feb 2026 22:20:16 -0500 Subject: [PATCH] prevent cache --- app.py | 7 ++++++- templates/index.html | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index 6cb66e6..ac19ee7 100644 --- a/app.py +++ b/app.py @@ -221,7 +221,12 @@ def preview_video(file_id): if not os.path.exists(output_path): return jsonify({'error': 'File not found'}), 404 - return send_file(output_path, mimetype='video/mp4') + response = send_file(output_path, mimetype='video/mp4') + # Prevent caching + response.headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, max-age=0' + response.headers['Pragma'] = 'no-cache' + response.headers['Expires'] = '0' + return response except Exception as e: return jsonify({'error': str(e)}), 500 diff --git a/templates/index.html b/templates/index.html index 4dbfbb5..f7a286e 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1253,9 +1253,9 @@ throw new Error(data.error || 'Processing failed'); } - // Load processed video preview + // Load processed video preview with cache-busting const processedVideoPreview = document.getElementById('processed-video-preview'); - processedVideoPreview.src = `/preview/${currentFileId}`; + processedVideoPreview.src = `/preview/${currentFileId}?t=${Date.now()}`; // Show download section document.getElementById('edit-section').classList.add('hidden');