From 0abe2194b5f20aea59cb1a04d776f04a1544aa95 Mon Sep 17 00:00:00 2001 From: Jack Kingsman Date: Sat, 7 Feb 2026 21:09:22 -0800 Subject: [PATCH] Just flood advertise when we do --- app/routers/radio.py | 12 ++++-------- frontend/src/App.tsx | 2 +- frontend/src/api.ts | 4 ++-- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/app/routers/radio.py b/app/routers/radio.py index 5eaa5ea..cbbcac1 100644 --- a/app/routers/radio.py +++ b/app/routers/radio.py @@ -134,29 +134,25 @@ async def set_private_key(update: PrivateKeyUpdate) -> dict: @router.post("/advertise") -async def send_advertisement(flood: bool = True) -> dict: - """Send a radio advertisement to announce presence on the mesh. +async def send_advertisement() -> dict: + """Send a flood advertisement to announce presence on the mesh. Manual advertisement requests always send immediately, updating the last_advert_time which affects when the next periodic/startup advert can occur. - Args: - flood: Whether to flood the advertisement (default True). - Returns: status: "ok" if sent successfully """ require_connected() - # Manual requests always send (force=True), but still update last_advert_time - logger.info("Sending advertisement (flood=%s)", flood) + logger.info("Sending flood advertisement") success = await do_send_advertisement(force=True) if not success: raise HTTPException(status_code=500, detail="Failed to send advertisement") - return {"status": "ok", "flood": flood} + return {"status": "ok"} @router.post("/reboot") diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 2fb894d..ce6d807 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -543,7 +543,7 @@ export function App() { // Send flood advertisement handler const handleAdvertise = useCallback(async () => { try { - await api.sendAdvertisement(true); + await api.sendAdvertisement(); toast.success('Advertisement sent'); } catch (err) { console.error('Failed to send advertisement:', err); diff --git a/frontend/src/api.ts b/frontend/src/api.ts index f29b069..87f22b5 100644 --- a/frontend/src/api.ts +++ b/frontend/src/api.ts @@ -76,8 +76,8 @@ export const api = { method: 'PUT', body: JSON.stringify({ private_key: privateKey }), }), - sendAdvertisement: (flood = true) => - fetchJson<{ status: string; flood: boolean }>(`/radio/advertise?flood=${flood}`, { + sendAdvertisement: () => + fetchJson<{ status: string }>('/radio/advertise', { method: 'POST', }), rebootRadio: () =>