fix: Restore missing code in delete_image and get_gallery
This commit is contained in:
parent
931eb72b14
commit
7376050da7
1 changed files with 7 additions and 0 deletions
7
app.py
7
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue