update
This commit is contained in:
parent
4aa55cd35e
commit
3324bb731c
@ -203,7 +203,6 @@ def get_devices_list():
|
|||||||
return returning_value
|
return returning_value
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@app.get("/admin/get/{command}")
|
@app.get("/admin/get/{command}")
|
||||||
def admin_get(command: str):
|
def admin_get(command: str):
|
||||||
if command == "get_updates":
|
if command == "get_updates":
|
||||||
@ -247,14 +246,21 @@ async def create_upload_file(uploaded_file: UploadFile = File(...), patch: str =
|
|||||||
|
|
||||||
|
|
||||||
@app.get("/messages/get")
|
@app.get("/messages/get")
|
||||||
def get_messages(timestamp):
|
def get_messages(timestamp: str):
|
||||||
for position, message in enumerate(reversed(messages)):
|
if timestamp:
|
||||||
if message["timestamp"] == timestamp:
|
for position, message in enumerate(reversed(messages)):
|
||||||
return reversed(messages)[:position]
|
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")
|
@app.get("/messages/register")
|
||||||
def get_messages():
|
def register():
|
||||||
return [uuid.uuid4().hex[24:], messages[:9]]
|
return [uuid.uuid4().hex[24:], messages[:9]]
|
||||||
|
|
||||||
|
|
||||||
|
@ -76,3 +76,5 @@ if command == "clean":
|
|||||||
|
|
||||||
with open("settings.json", "w", encoding='utf-8') as file:
|
with open("settings.json", "w", encoding='utf-8') as file:
|
||||||
json.dump(settings, file, indent=2)
|
json.dump(settings, file, indent=2)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user