fix: Aktiv-Haken zeigt gespeicherten Status statt Zeitfenster
Die Admin-Ansicht hat der Checkbox das Ergebnis von is_item_active() uebergeben. Ausserhalb des Zeitfensters erschien ein zeitgesteuerter Eintrag dadurch als deaktiviert, und beim naechsten Speichern der Reihenfolge schrieb der Client diesen Anzeigezustand als enabled=false zurueck - der Eintrag war danach dauerhaft stillgelegt. Die Checkbox spiegelt jetzt das gespeicherte enabled-Flag. Der Live-Zustand steckt in einem neuen Feld active und faerbt nur noch das Zeit-Badge (grau, wenn das Fenster gerade zu ist). Der Player filtert entsprechend ueber beide Felder. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
26
app.py
26
app.py
@@ -51,7 +51,7 @@ CONFIG_FILE = os.path.join(BASE_DIR, "config.json") # Persistente Konfiguration
|
|||||||
USERS_FILE = os.path.join(BASE_DIR, "users.json") # User-Datenbank
|
USERS_FILE = os.path.join(BASE_DIR, "users.json") # User-Datenbank
|
||||||
HISTORY_FILE = os.path.join(BASE_DIR, "history.json") # Aktivitätsverlauf
|
HISTORY_FILE = os.path.join(BASE_DIR, "history.json") # Aktivitätsverlauf
|
||||||
|
|
||||||
APP_VERSION = "6.2.4"
|
APP_VERSION = "6.2.5"
|
||||||
UPLOAD_EXTENSIONS = {".jpg", ".jpeg", ".png", ".mp4"}
|
UPLOAD_EXTENSIONS = {".jpg", ".jpeg", ".png", ".mp4"}
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
@@ -446,7 +446,8 @@ def load_priority_files(site):
|
|||||||
"type": "url",
|
"type": "url",
|
||||||
"size": "URL",
|
"size": "URL",
|
||||||
"zoom": url_data.get("zoom", 1.0),
|
"zoom": url_data.get("zoom", 1.0),
|
||||||
"enabled": is_item_active(item),
|
"enabled": item.get("enabled", True) if isinstance(item, dict) else True,
|
||||||
|
"active": is_item_active(item),
|
||||||
"passthrough": item.get("passthrough_params", False) if isinstance(item, dict) else False,
|
"passthrough": item.get("passthrough_params", False) if isinstance(item, dict) else False,
|
||||||
"schedule": item.get("schedule") if isinstance(item, dict) else None
|
"schedule": item.get("schedule") if isinstance(item, dict) else None
|
||||||
})
|
})
|
||||||
@@ -469,7 +470,8 @@ def load_priority_files(site):
|
|||||||
"name": item_name,
|
"name": item_name,
|
||||||
"type": ftype,
|
"type": ftype,
|
||||||
"size": size,
|
"size": size,
|
||||||
"enabled": is_item_active(item),
|
"enabled": item.get("enabled", True) if isinstance(item, dict) else True,
|
||||||
|
"active": is_item_active(item),
|
||||||
"schedule": item.get("schedule") if isinstance(item, dict) else None
|
"schedule": item.get("schedule") if isinstance(item, dict) else None
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -1255,7 +1257,8 @@ def player(site, screen):
|
|||||||
if is_url(item):
|
if is_url(item):
|
||||||
url_data = normalize_url(item)
|
url_data = normalize_url(item)
|
||||||
if url_data:
|
if url_data:
|
||||||
normal_files.append({"kind": "url", "url": url_data["url"], "zoom": url_data.get("zoom", 1.0), "enabled": is_item_active(item), "passthrough": item.get("passthrough_params", False) if isinstance(item, dict) else False, "schedule": item.get("schedule") if isinstance(item, dict) else None})
|
normal_files.append({"kind": "url", "url": url_data["url"], "zoom": url_data.get("zoom", 1.0), "enabled": item.get("enabled", True) if isinstance(item, dict) else True,
|
||||||
|
"active": is_item_active(item), "passthrough": item.get("passthrough_params", False) if isinstance(item, dict) else False, "schedule": item.get("schedule") if isinstance(item, dict) else None})
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if item_name and os.path.exists(os.path.join(folder, item_name)) and allowed_file(item_name):
|
if item_name and os.path.exists(os.path.join(folder, item_name)) and allowed_file(item_name):
|
||||||
@@ -1285,7 +1288,8 @@ def player(site, screen):
|
|||||||
if is_url(item):
|
if is_url(item):
|
||||||
url_data = normalize_url(item)
|
url_data = normalize_url(item)
|
||||||
if url_data:
|
if url_data:
|
||||||
prio_files.append({"kind": "url", "url": url_data["url"], "zoom": url_data.get("zoom", 1.0), "enabled": is_item_active(item), "passthrough": item.get("passthrough_params", False) if isinstance(item, dict) else False, "schedule": item.get("schedule") if isinstance(item, dict) else None})
|
prio_files.append({"kind": "url", "url": url_data["url"], "zoom": url_data.get("zoom", 1.0), "enabled": item.get("enabled", True) if isinstance(item, dict) else True,
|
||||||
|
"active": is_item_active(item), "passthrough": item.get("passthrough_params", False) if isinstance(item, dict) else False, "schedule": item.get("schedule") if isinstance(item, dict) else None})
|
||||||
continue
|
continue
|
||||||
|
|
||||||
file_path = os.path.join(priority_dir(site), item_name)
|
file_path = os.path.join(priority_dir(site), item_name)
|
||||||
@@ -1298,8 +1302,10 @@ def player(site, screen):
|
|||||||
"player.html",
|
"player.html",
|
||||||
site=site,
|
site=site,
|
||||||
screen=screen,
|
screen=screen,
|
||||||
normal_files=[item for item in normal_files if item.get("enabled", True)],
|
normal_files=[item for item in normal_files
|
||||||
prio_files=[item for item in prio_files if item.get("enabled", True)],
|
if item.get("enabled", True) and item.get("active", True)],
|
||||||
|
prio_files=[item for item in prio_files
|
||||||
|
if item.get("enabled", True) and item.get("active", True)],
|
||||||
interval=screen_cfg.get("interval", 10),
|
interval=screen_cfg.get("interval", 10),
|
||||||
newsticker_text=screen_cfg.get("newsticker_text", ""),
|
newsticker_text=screen_cfg.get("newsticker_text", ""),
|
||||||
newsticker_enabled=screen_cfg.get("newsticker_enabled", False),
|
newsticker_enabled=screen_cfg.get("newsticker_enabled", False),
|
||||||
@@ -1495,7 +1501,8 @@ def admin(site):
|
|||||||
"type": "url",
|
"type": "url",
|
||||||
"size": "URL",
|
"size": "URL",
|
||||||
"zoom": url_data.get("zoom", 1.0),
|
"zoom": url_data.get("zoom", 1.0),
|
||||||
"enabled": is_item_active(item),
|
"enabled": item.get("enabled", True) if isinstance(item, dict) else True,
|
||||||
|
"active": is_item_active(item),
|
||||||
"passthrough": item.get("passthrough_params", False) if isinstance(item, dict) else False,
|
"passthrough": item.get("passthrough_params", False) if isinstance(item, dict) else False,
|
||||||
"schedule": schedule
|
"schedule": schedule
|
||||||
})
|
})
|
||||||
@@ -1519,7 +1526,8 @@ def admin(site):
|
|||||||
"name": item_name,
|
"name": item_name,
|
||||||
"type": ftype,
|
"type": ftype,
|
||||||
"size": size,
|
"size": size,
|
||||||
"enabled": is_item_active(item),
|
"enabled": item.get("enabled", True) if isinstance(item, dict) else True,
|
||||||
|
"active": is_item_active(item),
|
||||||
"schedule": schedule
|
"schedule": schedule
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -251,7 +251,7 @@
|
|||||||
title="URL: {{ file.name }}{% if file.zoom %} (Zoom: {{ file.zoom }}x){% endif %}"
|
title="URL: {{ file.name }}{% if file.zoom %} (Zoom: {{ file.zoom }}x){% endif %}"
|
||||||
{% endif %}>
|
{% endif %}>
|
||||||
{{ file.name }}{% if file.type == "url" and file.zoom != 1.0 %} <strong style="color: #DA002D;">[{{ file.zoom }}x]</strong>{% endif %}{% if file.type == "url" %}{% if file.get('passthrough', False) %} <i class="ti ti-link" style="color:#6c757d;" title="Query-Parameter werden übergeben"></i>{% else %} <i class="ti ti-link-off" style="color:#adb5bd;" title="Query-Parameter werden nicht übergeben"></i>{% endif %}{% endif %}
|
{{ file.name }}{% if file.type == "url" and file.zoom != 1.0 %} <strong style="color: #DA002D;">[{{ file.zoom }}x]</strong>{% endif %}{% if file.type == "url" %}{% if file.get('passthrough', False) %} <i class="ti ti-link" style="color:#6c757d;" title="Query-Parameter werden übergeben"></i>{% else %} <i class="ti ti-link-off" style="color:#adb5bd;" title="Query-Parameter werden nicht übergeben"></i>{% endif %}{% endif %}
|
||||||
{% if file.schedule %}<span class="badge bg-info text-white ms-1" title="{{ file.schedule | schedule_text }}">Zeit</span>{% endif %}
|
{% if file.schedule %}<span class="badge ms-1 {% if file.active %}bg-info text-white{% else %}bg-secondary-lt{% endif %}" title="{{ file.schedule | schedule_text }}{% if not file.active %} — laeuft gerade nicht{% endif %}">Zeit</span>{% endif %}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<!-- Typ-Badge -->
|
<!-- Typ-Badge -->
|
||||||
|
|||||||
@@ -153,7 +153,7 @@
|
|||||||
title="URL: {{ file.name }}{% if file.zoom %} (Zoom: {{ file.zoom }}x){% endif %}"
|
title="URL: {{ file.name }}{% if file.zoom %} (Zoom: {{ file.zoom }}x){% endif %}"
|
||||||
{% endif %}>
|
{% endif %}>
|
||||||
{{ file.name }}{% if file.type == "url" and file.zoom != 1.0 %} <strong style="color: #DA002D;">[{{ file.zoom }}x]</strong>{% endif %}{% if file.type == "url" %}{% if file.get('passthrough', False) %} <i class="ti ti-link" style="color:#6c757d;" title="Query-Parameter werden übergeben"></i>{% else %} <i class="ti ti-link-off" style="color:#adb5bd;" title="Query-Parameter werden nicht übergeben"></i>{% endif %}{% endif %}
|
{{ file.name }}{% if file.type == "url" and file.zoom != 1.0 %} <strong style="color: #DA002D;">[{{ file.zoom }}x]</strong>{% endif %}{% if file.type == "url" %}{% if file.get('passthrough', False) %} <i class="ti ti-link" style="color:#6c757d;" title="Query-Parameter werden übergeben"></i>{% else %} <i class="ti ti-link-off" style="color:#adb5bd;" title="Query-Parameter werden nicht übergeben"></i>{% endif %}{% endif %}
|
||||||
{% if file.schedule %}<span class="badge bg-info text-white ms-1" title="{{ file.schedule | schedule_text }}">Zeit</span>{% endif %}
|
{% if file.schedule %}<span class="badge ms-1 {% if file.active %}bg-info text-white{% else %}bg-secondary-lt{% endif %}" title="{{ file.schedule | schedule_text }}{% if not file.active %} — laeuft gerade nicht{% endif %}">Zeit</span>{% endif %}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
{% if file.type == "image" %}
|
{% if file.type == "image" %}
|
||||||
|
|||||||
Reference in New Issue
Block a user