remove unused code from refactor
This commit is contained in:
35
web.py
35
web.py
@@ -418,41 +418,6 @@ class ReticulumWebChat:
|
||||
def on_lxmf_delivery(self, message):
|
||||
try:
|
||||
|
||||
# get message data
|
||||
message_content = message.content.decode('utf-8')
|
||||
source_hash_text = RNS.hexrep(message.source_hash, delimit=False)
|
||||
|
||||
fields = {}
|
||||
message_fields = message.get_fields()
|
||||
for field_type in message_fields:
|
||||
|
||||
value = message_fields[field_type]
|
||||
|
||||
# handle file attachments field
|
||||
if field_type == LXMF.FIELD_FILE_ATTACHMENTS:
|
||||
|
||||
# process file attachments
|
||||
file_attachments = []
|
||||
for file_attachment in value:
|
||||
file_name = file_attachment[0]
|
||||
file_bytes = base64.b64encode(file_attachment[1]).decode("utf-8")
|
||||
file_attachments.append({
|
||||
"file_name": file_name,
|
||||
"file_bytes": file_bytes,
|
||||
})
|
||||
|
||||
# add to fields
|
||||
fields["file_attachments"] = file_attachments
|
||||
|
||||
# handle image field
|
||||
if field_type == LXMF.FIELD_IMAGE:
|
||||
image_type = value[0]
|
||||
image_bytes = base64.b64encode(value[1]).decode("utf-8")
|
||||
fields["image"] = {
|
||||
"image_type": image_type,
|
||||
"image_bytes": image_bytes,
|
||||
}
|
||||
|
||||
# send received lxmf message data to all websocket clients
|
||||
asyncio.run(self.websocket_broadcast(json.dumps({
|
||||
"type": "lxmf.delivery",
|
||||
|
||||
Reference in New Issue
Block a user