URLs in Playlist inline bearbeiten (Edit-Button + Modal)
- Neue Route POST /admin/<site>/update-playlist-item/<screen> - Bearbeiten-Button (✎) für URL-Items in admin.html + priority.html - Modal mit URL + Zoom-Feld, Validierung und Speichern - Grid um Edit-Spalte erweitert (28px|1fr|90px|80px|40px|50px|32px)
This commit is contained in:
39
app.py
39
app.py
@@ -1575,6 +1575,45 @@ def save_playlist(site, screen):
|
||||
return "", 204
|
||||
|
||||
|
||||
# -------------------------------------------------
|
||||
# Admin: Playlist-Item bearbeiten (URL + Zoom)
|
||||
# -------------------------------------------------
|
||||
@app.route("/admin/<site>/update-playlist-item/<screen>", methods=["POST"])
|
||||
@site_access_required
|
||||
def update_playlist_item(site, screen):
|
||||
"""Aktualisiert URL und Zoom eines einzelnen Playlist-Items."""
|
||||
data = request.get_json()
|
||||
old_name = data.get("old_name")
|
||||
new_url = data.get("new_url", "").strip()
|
||||
zoom = data.get("zoom", 1.0)
|
||||
|
||||
if not is_url(new_url):
|
||||
return jsonify({"error": "Ungültige URL"}), 400
|
||||
|
||||
try:
|
||||
zoom = float(zoom)
|
||||
if zoom <= 0:
|
||||
zoom = 1.0
|
||||
except (ValueError, TypeError):
|
||||
zoom = 1.0
|
||||
|
||||
config = load_config()
|
||||
|
||||
if screen == "priority":
|
||||
playlist = config.setdefault("priority", {}).setdefault("playlist", [])
|
||||
else:
|
||||
playlist = config["sites"][site]["screens"][screen].setdefault("playlist", [])
|
||||
|
||||
for i, item in enumerate(playlist):
|
||||
name = playlist_item_name(item)
|
||||
if name == old_name:
|
||||
playlist[i] = {"url": new_url, "zoom": zoom}
|
||||
save_config(config)
|
||||
return jsonify({"success": True})
|
||||
|
||||
return jsonify({"error": "Item nicht gefunden"}), 404
|
||||
|
||||
|
||||
# -------------------------------------------------
|
||||
# Change-Password (für First-Login / Reset)
|
||||
# -------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user