mirror of
https://github.com/jkingsman/Remote-Terminal-for-MeshCore.git
synced 2026-08-10 18:53:03 +02:00
Add contact hop data to help with debugging
This commit is contained in:
+31
-1
@@ -35,7 +35,7 @@ REPEATER_OP_DELAY_SECONDS = 5.0
|
|||||||
|
|
||||||
|
|
||||||
async def prepare_repeater_connection(mc, contact: Contact, password: str) -> None:
|
async def prepare_repeater_connection(mc, contact: Contact, password: str) -> None:
|
||||||
"""Prepare connection to a repeater by logging in.
|
"""Prepare connection to a repeater by adding to radio and logging in.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
mc: MeshCore instance
|
mc: MeshCore instance
|
||||||
@@ -45,6 +45,21 @@ async def prepare_repeater_connection(mc, contact: Contact, password: str) -> No
|
|||||||
Raises:
|
Raises:
|
||||||
HTTPException: If login fails
|
HTTPException: If login fails
|
||||||
"""
|
"""
|
||||||
|
# Add contact to radio with flood mode
|
||||||
|
logger.info("Adding repeater %s to radio", contact.public_key[:12])
|
||||||
|
contact_data = {
|
||||||
|
"public_key": contact.public_key,
|
||||||
|
"adv_name": contact.name or "",
|
||||||
|
"type": contact.type,
|
||||||
|
"flags": contact.flags,
|
||||||
|
"out_path": "",
|
||||||
|
"out_path_len": -1, # Flood mode
|
||||||
|
"adv_lat": contact.lat or 0.0,
|
||||||
|
"adv_lon": contact.lon or 0.0,
|
||||||
|
"last_advert": contact.last_advert or 0,
|
||||||
|
}
|
||||||
|
await mc.commands.add_contact(contact_data)
|
||||||
|
|
||||||
# Send login with password
|
# Send login with password
|
||||||
logger.info("Sending login to repeater %s", contact.public_key[:12])
|
logger.info("Sending login to repeater %s", contact.public_key[:12])
|
||||||
login_result = await mc.commands.send_login(contact.public_key, password)
|
login_result = await mc.commands.send_login(contact.public_key, password)
|
||||||
@@ -365,6 +380,21 @@ async def send_repeater_command(public_key: str, request: CommandRequest) -> Com
|
|||||||
|
|
||||||
# Pause message polling to prevent it from stealing our response
|
# Pause message polling to prevent it from stealing our response
|
||||||
async with pause_polling():
|
async with pause_polling():
|
||||||
|
# Add contact to radio with flood mode
|
||||||
|
logger.info("Adding repeater %s to radio", contact.public_key[:12])
|
||||||
|
contact_data = {
|
||||||
|
"public_key": contact.public_key,
|
||||||
|
"adv_name": contact.name or "",
|
||||||
|
"type": contact.type,
|
||||||
|
"flags": contact.flags,
|
||||||
|
"out_path": "",
|
||||||
|
"out_path_len": -1, # Flood mode
|
||||||
|
"adv_lat": contact.lat or 0.0,
|
||||||
|
"adv_lon": contact.lon or 0.0,
|
||||||
|
"last_advert": contact.last_advert or 0,
|
||||||
|
}
|
||||||
|
await mc.commands.add_contact(contact_data)
|
||||||
|
|
||||||
# Send the command
|
# Send the command
|
||||||
logger.info("Sending command to repeater %s: %s", contact.public_key[:12], request.command)
|
logger.info("Sending command to repeater %s: %s", contact.public_key[:12], request.command)
|
||||||
|
|
||||||
|
|||||||
+16
-16
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -13,7 +13,7 @@
|
|||||||
<link rel="shortcut icon" href="/favicon.ico" />
|
<link rel="shortcut icon" href="/favicon.ico" />
|
||||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
|
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
|
||||||
<link rel="manifest" href="/site.webmanifest" />
|
<link rel="manifest" href="/site.webmanifest" />
|
||||||
<script type="module" crossorigin src="/assets/index-CfOMUIYi.js"></script>
|
<script type="module" crossorigin src="/assets/index-BqCjcbH8.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-DZ67iE5i.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-DZ67iE5i.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
+14
-2
@@ -588,9 +588,21 @@ export function App() {
|
|||||||
{activeConversation.id}
|
{activeConversation.id}
|
||||||
{activeConversation.type === 'contact' && (() => {
|
{activeConversation.type === 'contact' && (() => {
|
||||||
const contact = contacts.find(c => c.public_key === activeConversation.id);
|
const contact = contacts.find(c => c.public_key === activeConversation.id);
|
||||||
return contact?.last_seen ? (
|
if (!contact) return null;
|
||||||
|
const parts: string[] = [];
|
||||||
|
if (contact.last_seen) {
|
||||||
|
parts.push(`Last heard: ${formatTime(contact.last_seen)}`);
|
||||||
|
}
|
||||||
|
if (contact.last_path_len === -1) {
|
||||||
|
parts.push('flood');
|
||||||
|
} else if (contact.last_path_len === 0) {
|
||||||
|
parts.push('direct');
|
||||||
|
} else if (contact.last_path_len > 0) {
|
||||||
|
parts.push(`${contact.last_path_len} hop${contact.last_path_len > 1 ? 's' : ''}`);
|
||||||
|
}
|
||||||
|
return parts.length > 0 ? (
|
||||||
<span className="ml-2 font-sans">
|
<span className="ml-2 font-sans">
|
||||||
(Last heard: {formatTime(contact.last_seen)})
|
({parts.join(', ')})
|
||||||
</span>
|
</span>
|
||||||
) : null;
|
) : null;
|
||||||
})()}
|
})()}
|
||||||
|
|||||||
Reference in New Issue
Block a user