Add bible download route and UI button for run details
- New GET /run/<id>/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 <noreply@anthropic.com>
This commit is contained in:
@@ -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/<int:id>/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/<int:run_id>/regenerate_artifacts', methods=['POST'])
|
||||
@login_required
|
||||
def regenerate_artifacts(run_id):
|
||||
|
||||
Reference in New Issue
Block a user