mirror of
https://github.com/liamcottle/reticulum-meshchat.git
synced 2026-11-29 19:36:31 -05:00
show tcp clients as connected via the tcp server interface
This commit is contained in:
parent
9abb0e25a4
commit
2490b870aa
2 changed files with 43 additions and 11 deletions
17
meshchat.py
17
meshchat.py
|
|
@ -853,6 +853,15 @@ class ReticulumMeshChat:
|
|||
|
||||
# ensure ifac_signature is hex as json_response can't serialize bytes
|
||||
for interface in interface_stats["interfaces"]:
|
||||
|
||||
# add interface hashes
|
||||
interface_instance = self.find_interface_by_name(interface["name"])
|
||||
if interface_instance is not None:
|
||||
interface["hash"] = interface_instance.get_hash().hex()
|
||||
if hasattr(interface_instance, "parent_interface") and interface_instance.parent_interface is not None:
|
||||
interface["parent_interface_name"] = str(interface_instance.parent_interface)
|
||||
interface["parent_interface_hash"] = interface_instance.parent_interface.get_hash().hex()
|
||||
|
||||
if "ifac_signature" in interface and interface["ifac_signature"]:
|
||||
interface["ifac_signature"] = interface["ifac_signature"].hex()
|
||||
|
||||
|
|
@ -1872,6 +1881,14 @@ class ReticulumMeshChat:
|
|||
.where(database.LxmfMessage.destination_hash == destination_hash)
|
||||
.count())
|
||||
|
||||
# find an interface by name
|
||||
def find_interface_by_name(self, name: str):
|
||||
for interface in RNS.Transport.interfaces:
|
||||
interface_name = str(interface)
|
||||
if name == interface_name:
|
||||
return interface
|
||||
|
||||
return None
|
||||
|
||||
# class to manage config stored in database
|
||||
class Config:
|
||||
|
|
|
|||
|
|
@ -144,17 +144,32 @@ export default {
|
|||
// add interface node
|
||||
nodes.push(node);
|
||||
|
||||
// add edge from me to interface
|
||||
edges.push({
|
||||
from: "me",
|
||||
to: entry.name,
|
||||
color: "transparent",
|
||||
length: 300,
|
||||
background: {
|
||||
enabled: true,
|
||||
color: entry.status ? "#22c55e" : "#ef4444",
|
||||
},
|
||||
});
|
||||
// add edge to interface
|
||||
if(entry.parent_interface_name){
|
||||
// add edge from parent interface to interface
|
||||
edges.push({
|
||||
from: entry.parent_interface_name,
|
||||
to: entry.name,
|
||||
color: "transparent",
|
||||
length: 300,
|
||||
background: {
|
||||
enabled: true,
|
||||
color: entry.status ? "#22c55e" : "#ef4444",
|
||||
},
|
||||
});
|
||||
} else {
|
||||
// add edge from me to interface
|
||||
edges.push({
|
||||
from: "me",
|
||||
to: entry.name,
|
||||
color: "transparent",
|
||||
length: 300,
|
||||
background: {
|
||||
enabled: true,
|
||||
color: entry.status ? "#22c55e" : "#ef4444",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue