diff --git a/server/main.py b/server/main.py index 75a3a88..f1ec39e 100644 --- a/server/main.py +++ b/server/main.py @@ -203,7 +203,6 @@ def get_devices_list(): return returning_value - @app.get("/admin/get/{command}") def admin_get(command: str): if command == "get_updates": @@ -247,14 +246,21 @@ async def create_upload_file(uploaded_file: UploadFile = File(...), patch: str = @app.get("/messages/get") -def get_messages(timestamp): - for position, message in enumerate(reversed(messages)): - if message["timestamp"] == timestamp: - return reversed(messages)[:position] +def get_messages(timestamp: str): + if timestamp: + for position, message in enumerate(reversed(messages)): + if float(message["timestamp"]) <= float(timestamp): + return list(reversed(list(reversed(messages))[:position])) + + if timestamp == "0": + return messages + return [] + else: + return messages[:10] -@app.get("/messages/reqister") -def get_messages(): +@app.get("/messages/register") +def register(): return [uuid.uuid4().hex[24:], messages[:9]] diff --git a/server/system.py b/server/system.py index f5287fb..d203d4a 100644 --- a/server/system.py +++ b/server/system.py @@ -76,3 +76,5 @@ if command == "clean": with open("settings.json", "w", encoding='utf-8') as file: json.dump(settings, file, indent=2) + +