Merge branch 'fix/device-details' into development

This commit is contained in:
Josiah Baldwin
2025-06-14 12:47:45 -07:00

View File

@@ -478,7 +478,18 @@ class Session(object):
if "result" in res0: if "result" in res0:
raise exceptions.ServerError(res0["result"]) raise exceptions.ServerError(res0["result"])
if details: if details:
nodes = json.loads(res0["data"]) try:
nodes = res0["data"]
# Accept any number of nested strings, meshcentral is odd
while True:
try:
nodes = json.loads(nodes)
except TypeError:
break
except Exception as e:
print(f"Failed to parse device data: {e}")
return
for node in nodes: for node in nodes:
if node["node"].get("meshid", None): if node["node"].get("meshid", None):
node["node"]["mesh"] = mesh.Mesh(node["node"].get("meshid"), self) node["node"]["mesh"] = mesh.Mesh(node["node"].get("meshid"), self)
@@ -1969,4 +1980,4 @@ class _FileExplorerWrapper:
return await self._files.__aenter__() return await self._files.__aenter__()
async def __aexit__(self, exc_t, exc_v, exc_tb): async def __aexit__(self, exc_t, exc_v, exc_tb):
return await self._files.__aexit__(exc_t, exc_v, exc_tb) return await self._files.__aexit__(exc_t, exc_v, exc_tb)