mirror of
https://github.com/liamcottle/reticulum-meshchat.git
synced 2026-11-29 03:16:37 -05:00
add button to delete messages that failed to send
This commit is contained in:
parent
38c24f7b99
commit
6f975a06b6
2 changed files with 41 additions and 1 deletions
20
web.py
20
web.py
|
|
@ -188,6 +188,26 @@ class ReticulumWebChat:
|
|||
"lxmf_messages": lxmf_messages,
|
||||
})
|
||||
|
||||
# serve lxmf messages
|
||||
@routes.delete("/api/v1/lxmf-messages/{id}")
|
||||
async def index(request):
|
||||
|
||||
# get path params
|
||||
id = request.match_info.get("id", None)
|
||||
|
||||
# source_hash is required
|
||||
if id is None:
|
||||
return web.json_response({
|
||||
"message": "id is required",
|
||||
}, status=422)
|
||||
|
||||
# delete lxmf messages from db where id matches
|
||||
database.LxmfMessage.delete_by_id(id)
|
||||
|
||||
return web.json_response({
|
||||
"message": "ok",
|
||||
})
|
||||
|
||||
asyncio.get_event_loop().add_signal_handler(signal.SIGINT, lambda: exit(-1))
|
||||
asyncio.get_event_loop().add_signal_handler(signal.SIGTERM, lambda: exit(-1))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue