mirror of
https://github.com/pablorevilla-meshtastic/meshview.git
synced 2026-06-25 12:31:30 +02:00
fix error with QR code not loading node's role
This commit is contained in:
@@ -1041,6 +1041,7 @@ async def api_node_qr(request):
|
||||
|
||||
try:
|
||||
from meshtastic.protobuf.admin_pb2 import SharedContact
|
||||
from meshtastic.protobuf.config_pb2 import Config
|
||||
from meshtastic.protobuf.mesh_pb2 import User
|
||||
|
||||
user = User()
|
||||
@@ -1058,6 +1059,13 @@ async def api_node_qr(request):
|
||||
user.hw_model = hw_model_value
|
||||
except (AttributeError, TypeError):
|
||||
pass
|
||||
if node.role:
|
||||
try:
|
||||
role_value = getattr(Config.DeviceConfig.Role, node.role.upper(), None)
|
||||
if role_value is not None:
|
||||
user.role = role_value
|
||||
except (AttributeError, TypeError):
|
||||
pass
|
||||
|
||||
contact = SharedContact()
|
||||
contact.node_num = node_id
|
||||
@@ -1077,6 +1085,7 @@ async def api_node_qr(request):
|
||||
"node_id": node_id,
|
||||
"long_name": node.long_name,
|
||||
"short_name": node.short_name,
|
||||
"role": node.role,
|
||||
"meshtastic_url": meshtastic_url,
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user