From 7376050da765a015aa28124e7a9c64b119757ed0 Mon Sep 17 00:00:00 2001 From: "Khoa.vo" Date: Tue, 30 Dec 2025 19:41:57 +0700 Subject: [PATCH] fix: Restore missing code in delete_image and get_gallery --- app.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app.py b/app.py index ca41d22..7843aae 100644 --- a/app.py +++ b/app.py @@ -761,7 +761,14 @@ def delete_image(): if os.path.exists(filepath): try: send2trash(filepath) + return jsonify({'success': True, 'source': resolved_source}) + except Exception as e: + return jsonify({'error': str(e)}), 500 + else: + return jsonify({'error': 'File not found'}), 404 +@app.route('/gallery') +def get_gallery(): # List all images in the chosen source directory, sorted by modification time (newest first) source_param = (request.args.get('source') or 'generated').lower() base_dir = UPLOADS_DIR if source_param == 'uploads' else GENERATED_DIR