From 203d74f61d60f8c1b8440e0033762f6497d9724e Mon Sep 17 00:00:00 2001 From: Mike Wichers Date: Sun, 22 Feb 2026 10:04:11 -0500 Subject: [PATCH] Add bible download route and UI button for run details - New GET /run//download_bible route serves project bible.json as attachment - Download Bible button added to run_details.html header toolbar Co-Authored-By: Claude Sonnet 4.6 --- templates/run_details.html | 3 +++ web/routes/run.py | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/templates/run_details.html b/templates/run_details.html index 7e105da..9f2c435 100644 --- a/templates/run_details.html +++ b/templates/run_details.html @@ -10,6 +10,9 @@ + + Download Bible + diff --git a/web/routes/run.py b/web/routes/run.py index 5fb5116..117b2e9 100644 --- a/web/routes/run.py +++ b/web/routes/run.py @@ -393,6 +393,27 @@ def revise_book(run_id, book_folder): return redirect(url_for('run.view_run', id=new_run.id)) +@run_bp.route('/run//download_bible') +@login_required +def download_bible(id): + run = db.session.get(Run, id) + if not run: return "Run not found", 404 + if run.project.user_id != current_user.id: return "Unauthorized", 403 + + bible_path = os.path.join(run.project.folder_path, "bible.json") + if not os.path.exists(bible_path): + return "Bible file not found", 404 + + safe_name = utils.sanitize_filename(run.project.name or "project") + download_name = f"bible_{safe_name}.json" + return send_from_directory( + os.path.dirname(bible_path), + os.path.basename(bible_path), + as_attachment=True, + download_name=download_name + ) + + @run_bp.route('/project//regenerate_artifacts', methods=['POST']) @login_required def regenerate_artifacts(run_id):