minor changes to overview callbacks
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
# server/wsgi.py
|
||||
|
||||
from flask import Flask, jsonify
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route("/health")
|
||||
def health():
|
||||
return jsonify(status="ok")
|
||||
|
||||
# Optional: Test-Route
|
||||
@app.route("/")
|
||||
def index():
|
||||
return "Hello from Infoscreen‐API!"
|
||||
|
||||
# (Weitere Endpunkte, Blueprints, Datenbank-Initialisierung usw. kommen hierher)
|
||||
Reference in New Issue
Block a user