Send to by node name or broadcast sentinel (GET-free resolution via node DB) (#9)
CI / build + unit (push) Successful in 33s
CI / build + unit (push) Successful in 33s
This commit was merged in pull request #9.
This commit is contained in:
@@ -26,7 +26,7 @@ Exposed via Traefik only (no published ports) at `http://bot.dev.kkhost.pl`.
|
||||
All API endpoints live under the `/api` prefix:
|
||||
|
||||
- `GET /api/status` — `{ connected, myNodeNum, host, port }`
|
||||
- `POST /api/send` — body `{ "text": "...", "to"?: <node number | "!b" | "broadcast"> }`, returns `{ id }`
|
||||
- `POST /api/send` — body `{ "text": "...", "to"?: <node number | node name | "!b" | "broadcast"> }`, returns `{ id }`. Numbers pass through as-is (integer in 1..0xffffffff); names resolve like `GET /api/nodes/:id` (exact long/short name, then unique substring) — unknown or ambiguous targets are a 400
|
||||
- `GET /api/channels` — the device's Meshtastic channels as `{ index, name, uplinkEnabled, downlinkEnabled }[]` (psk/keys are redacted; empty until the initial sync completes)
|
||||
- `GET /api/messages` — message history, newest first: inbound text (`dir:'rx'`, with `from`) and our sends (`dir:'tx'`, with `to` + `status`). tx records start `pending` and move to `delivered`/`failed` (with human-readable `ackError`) when the routing ACK/NACK arrives; broadcasts stay `pending` because firmware strips want_ack before TX. In-memory only, last 100, reset on every bridge reconnect
|
||||
- `GET /api/nodes` — known mesh nodes as `{ num, longName?, shortName?, hwModel?, batteryLevel?, lastHeard: number|null, position?: { lat, lon, alt? } }[]`, sorted by node number. Collected during the initial sync plus live position updates; names/hwModel/battery appear only when reported, `lastHeard` is epoch seconds (null = never heard), and `position` only when both coordinates are known
|
||||
@@ -45,7 +45,10 @@ curl http://localhost:3000/api/nodes
|
||||
curl http://localhost:3000/api/nodes/kamil
|
||||
```
|
||||
|
||||
`to` omitted, `"!b"`, or `"broadcast"` sends to the broadcast address `0xffffffff`.
|
||||
`to` omitted, `"!b"`, or `"broadcast"` (case-insensitive) sends to the
|
||||
broadcast address `0xffffffff`; anything else is a node number or name.
|
||||
DMs are unicast and wantAck-tracked via `GET /api/messages`; broadcasts stay
|
||||
pending because firmware strips want_ack before TX.
|
||||
|
||||
All sends always target channel index 2 (`testowy`) — never the primary
|
||||
channel. Override with `MESH_SEND_CHANNEL`.
|
||||
|
||||
Reference in New Issue
Block a user