mirror of
https://github.com/liamcottle/reticulum-meshchat.git
synced 2026-04-28 00:20:48 +00:00
no need to check for existing of route param
This commit is contained in:
parent
ab71517f4a
commit
e34a843077
1 changed files with 2 additions and 14 deletions
16
web.py
16
web.py
|
|
@ -169,17 +169,11 @@ class ReticulumWebChat:
|
|||
async def index(request):
|
||||
|
||||
# get path params
|
||||
destination_hash = request.match_info.get("destination_hash", None)
|
||||
destination_hash = request.match_info.get("destination_hash", "")
|
||||
|
||||
# get source hash from local lxmf destination
|
||||
source_hash = self.local_lxmf_destination.hash.hex()
|
||||
|
||||
# destination_hash is required
|
||||
if destination_hash is None:
|
||||
return web.json_response({
|
||||
"message": "destination_hash is required",
|
||||
}, status=422)
|
||||
|
||||
# get lxmf messages from db where "source to destination" or "destination to source" and ordered by oldest to newest
|
||||
db_lxmf_messages = (database.LxmfMessage.select()
|
||||
.where((database.LxmfMessage.source_hash == source_hash) & (database.LxmfMessage.destination_hash == destination_hash))
|
||||
|
|
@ -215,17 +209,11 @@ class ReticulumWebChat:
|
|||
async def index(request):
|
||||
|
||||
# get path params
|
||||
destination_hash = request.match_info.get("destination_hash", None)
|
||||
destination_hash = request.match_info.get("destination_hash", "")
|
||||
|
||||
# get source hash from local lxmf destination
|
||||
source_hash = self.local_lxmf_destination.hash.hex()
|
||||
|
||||
# destination_hash is required
|
||||
if destination_hash is None:
|
||||
return web.json_response({
|
||||
"message": "destination_hash is required",
|
||||
}, status=422)
|
||||
|
||||
# delete lxmf messages from db where "source to destination" or "destination to source"
|
||||
(database.LxmfMessage.delete()
|
||||
.where((database.LxmfMessage.source_hash == source_hash) & (database.LxmfMessage.destination_hash == destination_hash))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue