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