diff --git a/app.py b/app.py index 891e78b..5b46d96 100644 --- a/app.py +++ b/app.py @@ -1227,8 +1227,7 @@ def submission_detail(sub_id: int):
- - + {"".join([f'' if row['status'] == 'published' else ''])}
@@ -1301,6 +1300,34 @@ def submission_detail(sub_id: int): """ +@app.route("/submission//unpublish", methods=["POST"]) +def submission_unpublish(sub_id: int): + """Unpublish a submission - set status back to 'new' and clear published_at.""" + db = get_db() + row = db.execute("SELECT id, status FROM submissions WHERE id = ?", (sub_id,)).fetchone() + if not row: + return jsonify({"error": "Nicht gefunden"}), 404 + if row["status"] != "published": + return jsonify({"error": "Beitrag ist nicht veroffentlicht"}), 400 + db.execute("UPDATE submissions SET status='new', published_at=NULL WHERE id=?", (sub_id,)) + db.commit() + return jsonify({"ok": True, "new_status": "new"}) + @app.route("/submission//done", methods=["POST"]) def submission_done(sub_id: int): """Mark a submission as done/bearbeitet.""" @@ -2515,6 +2555,15 @@ def api_submit(): db.commit() sub_id = db.execute("SELECT last_insert_rowid()").fetchone()[0] + # Auto-summarize via LLM (only if no halle was provided by user) + if not halle_valid and text and len(text.strip()) > 20: + import threading + threading.Thread( + target=auto_process_bg, + args=(DB_PATH, sub_id), + daemon=True, + ).start() + return jsonify({ 'ok': True, 'message': f'Beitrag #{sub_id} erfolgreich übermittelt! 🎲', @@ -2643,6 +2692,9 @@ def public_detail(sub_id: int): +
+ Beitrags-ID: #{sub_id} \u2014 Bei Fragen oder Löschwunsch bitte diese ID angeben. +
"""