Send to by node name or broadcast sentinel (GET-free resolution via node DB) #9

Merged
kamilkrzywda merged 1 commits from feat/send-to-names into main 2026-09-24 16:47:52 +02:00
Owner

What

POST /api/send — to now accepts a node number, a long/short name (resolved through the in-memory node DB), or an explicit broadcast sentinel. Omitted to still means broadcast.

{ "text": "hello", "to": "Kamil SP8MK/P" }   // DM by name → resolved to its node number
{ "text": "hi all", "to": "!b" }               // explicit broadcast (also: "broadcast", omitted, or 4294967295)

Details

  • New MeshService.resolveDest(to?) — resolution order: undefined/"" → broadcast; number / numeric string → node number (must be integer in 1..0xffffffff); "!b"/"broadcast" (case-insensitive) → broadcast; anything else → existing node() lookup (exact num → exact long/short name → unique substring)
  • Unknown names → 400 no node matching '<to>'; invalid numbers → 400 invalid node number '<n>' (tightening: previously any finite number passed through — 42.5, negatives and >0xffffffff are now rejected)
  • DM vs broadcast semantics documented in Swagger: DMs are unicast wantAck-tracked via GET /api/messages; broadcasts stay pending because firmware strips want_ack pre-TX
  • All sends still ride channel index 2 (testowy, MESH_SEND_CHANNEL) regardless of type — modern firmware PKI handles unicast encryption/channel anyway

Verification

  • npm run build ✓
  • npm test — 24/24 passed (was 22, +2: sentinel/number/name resolution; unknown-name + invalid-number rejections)
  • v0.4.0, CHANGELOG entry added
## What `POST /api/send` — `to` now accepts a **node number, a long/short name** (resolved through the in-memory node DB), or an explicit broadcast sentinel. Omitted `to` still means broadcast. ```json { "text": "hello", "to": "Kamil SP8MK/P" } // DM by name → resolved to its node number { "text": "hi all", "to": "!b" } // explicit broadcast (also: "broadcast", omitted, or 4294967295) ``` ## Details - New `MeshService.resolveDest(to?)` — resolution order: undefined/"" → broadcast; number / numeric string → node number (must be integer in 1..0xffffffff); "!b"/"broadcast" (case-insensitive) → broadcast; anything else → existing `node()` lookup (exact num → exact long/short name → unique substring) - Unknown names → 400 `no node matching '<to>'`; invalid numbers → 400 `invalid node number '<n>'` (tightening: previously any finite number passed through — 42.5, negatives and >0xffffffff are now rejected) - DM vs broadcast semantics documented in Swagger: DMs are unicast wantAck-tracked via GET /api/messages; broadcasts stay pending because firmware strips want_ack pre-TX - All sends still ride channel index 2 (testowy, MESH_SEND_CHANNEL) regardless of type — modern firmware PKI handles unicast encryption/channel anyway ## Verification - `npm run build` ✓ - `npm test` — 24/24 passed (was 22, +2: sentinel/number/name resolution; unknown-name + invalid-number rejections) - v0.4.0, CHANGELOG entry added
kamilkrzywda added 1 commit 2026-09-24 16:46:51 +02:00
Send to by node name or broadcast sentinel
CI / build + unit (pull_request) Successful in 59s
597710f726
kamilkrzywda merged commit f640f6658c into main 2026-09-24 16:47:52 +02:00
kamilkrzywda deleted branch feat/send-to-names 2026-09-24 16:47:52 +02:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: OpenCode/MeshBot#9