Add Stream/Download buttons to global search results

This commit is contained in:
2026-07-07 22:00:35 +02:00
parent bfb7002c4d
commit 041b60c771
2 changed files with 66 additions and 5 deletions
+17
View File
@@ -1153,6 +1153,23 @@ def api_download_file(did):
return send_file(p, as_attachment=True, download_name=download_name)
@app.route('/api/downloads/<did>/save')
def api_download_save(did):
"""Speichern: Datei senden und aus Liste entfernen"""
d = DM.get(did)
if not d or d.get('status') != 'complete':
return jsonify({'error': 'not ready'}), 404
p = d.get('path')
if not p or not os.path.exists(p):
return jsonify({'error': 'file missing'}), 404
# Sauberer Titel als Dateiname
safe_title = re.sub(r'[^\w\-\. ]', '_', d.get('title', 'video'))[:80]
download_name = f"{safe_title}.mp4"
# Aus Liste entfernen
DM.delete(did)
return send_file(p, as_attachment=True, download_name=download_name)
@app.route('/api/downloads/<did>', methods=['DELETE'])
def api_download_delete(did):
if DM.delete(did):