mirror of
https://github.com/jkingsman/Remote-Terminal-for-MeshCore.git
synced 2026-07-07 02:11:22 +02:00
Cull a bunch of unused functions
This commit is contained in:
@@ -21,6 +21,7 @@ async function fetchJson<T>(path: string, init?: RequestInit): Promise<T> {
|
||||
|
||||
export interface HealthStatus {
|
||||
radio_connected: boolean;
|
||||
radio_initializing: boolean;
|
||||
connection_info: string | null;
|
||||
}
|
||||
|
||||
@@ -267,7 +268,7 @@ export async function ensureFlightlessChannel(): Promise<Channel> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for health to show radio_connected, polling with retries.
|
||||
* Wait for health to show a fully ready radio, polling with retries.
|
||||
*/
|
||||
export async function waitForRadioConnected(
|
||||
timeoutMs: number = 30_000,
|
||||
@@ -277,19 +278,13 @@ export async function waitForRadioConnected(
|
||||
while (Date.now() < deadline) {
|
||||
try {
|
||||
const health = await getHealth();
|
||||
if (health.radio_connected) return;
|
||||
if (health.radio_connected && !health.radio_initializing) return;
|
||||
} catch {
|
||||
// Backend might be restarting
|
||||
}
|
||||
await new Promise((r) => setTimeout(r, intervalMs));
|
||||
}
|
||||
throw new Error(`Radio did not reconnect within ${timeoutMs}ms`);
|
||||
}
|
||||
|
||||
// --- Contacts sync ---
|
||||
|
||||
export function syncContacts(): Promise<{ synced: number }> {
|
||||
return fetchJson('/contacts/sync', { method: 'POST' });
|
||||
throw new Error(`Radio did not finish reconnect/setup within ${timeoutMs}ms`);
|
||||
}
|
||||
|
||||
// --- Packets / Historical decryption ---
|
||||
|
||||
Reference in New Issue
Block a user