minor changes to overview callbacks

This commit is contained in:
2025-06-04 17:05:59 +00:00
parent 6ab9ceed4b
commit 138c5b1e8c
2 changed files with 4 additions and 20 deletions

View File

@@ -13,7 +13,7 @@ import os
from server.models import Client
mqtt_thread_started = False
SCREENSHOT_DIR = "/workspace/received-screenshots"
SCREENSHOT_DIR = "received-screenshots"
def ensure_mqtt_running():
global mqtt_thread_started
@@ -23,12 +23,12 @@ def ensure_mqtt_running():
mqtt_thread_started = True
def get_latest_screenshot(client_uuid):
prefix = f"client_{client_uuid}_"
prefix = f"{client_uuid}_"
try:
files = [f for f in os.listdir(SCREENSHOT_DIR) if f.startswith(prefix)]
files = [f for f in os.listdir('..', SCREENSHOT_DIR) if f.startswith(prefix)]
if not files:
return "/assets/placeholder.png"
latest = max(files, key=lambda x: os.path.getmtime(os.path.join(SCREENSHOT_DIR, x)))
latest = max(files, key=lambda x: os.path.getmtime(os.path.join('.', SCREENSHOT_DIR, x)))
return f"/received-screenshots/{latest}"
except Exception:
return "/assets/placeholder.png"