add commands to websocket data

This commit is contained in:
liamcottle 2024-04-29 03:52:42 +12:00
parent ce02611cb8
commit e58f39bc07

17
web.py
View file

@ -136,6 +136,23 @@ def lxmf_delivery(message):
"image_bytes": image_bytes,
})
# handle commands field
if field_type == LXMF.FIELD_COMMANDS:
# process commands
commands = []
for command in value:
command_string = command[0]
commands.append({
"command_string": command_string,
})
# add to fields
fields.append({
"type": "commands",
"commands": commands,
})
# send received lxmf message data to all websocket clients
websocket_broadcast(json.dumps({
"type": "lxmf.delivery",