Add GET /api/channels, move endpoints under /api prefix, serve Scalar docs at / (issue #1)

- New GET /api/channels: device Meshtastic channels from FromRadio.channel
  frames during initial sync; psk/keys redacted; map reset on reconnect.
- app.setGlobalPrefix('api'): /status -> /api/status, /send -> /api/send.
- Scalar API docs at / (OpenAPI JSON at /docs-json) via @nestjs/swagger +
  @scalar/nestjs-api-reference; light swagger decorators on endpoints/body.
- MESH_RECONNECT_MS env knob (default 5000 ms).
- v0.1.0: CHANGELOG entry, README/AGENTS/ORCHESTRATOR docs sync.
This commit is contained in:
2026-09-23 19:03:00 +00:00
parent 5a33e4590a
commit a0e1c37291
11 changed files with 489 additions and 19 deletions
+2 -2
View File
@@ -12,12 +12,12 @@
## Verification
1. **Local checks** — `npm run build` (nest build) and `npm test` (vitest; no e2e suite yet). Both must pass before a PR is opened.
2. **Docker** — `docker compose build`, then after `docker compose up -d`: `curl -s -H "Host: bot.dev.kkhost.pl" http://localhost/status` returns JSON (`{ connected, myNodeNum, host, port }`). `"connected":false` is normal while the bridge/device is down — the service retries every 5 s.
2. **Docker** — `docker compose build`, then after `docker compose up -d`: `curl -s -H "Host: bot.dev.kkhost.pl" http://localhost/api/status` returns JSON (`{ connected, myNodeNum, host, port }`). `"connected":false` is normal while the bridge/device is down — the service retries every 5 s.
## API
1. **Live base URL** — `http://bot.dev.kkhost.pl` (Traefik → docker-compose stack on this host; container port 3000 via external network dev_net, no published ports).
2. **Endpoints** — `GET /status` (`{ connected, myNodeNum, host, port }`) and `POST /send` (body `{ "text": "...", "to"?: <node number | "!b" | "broadcast"> }`, returns `{ id }`). No machine-readable spec yet; keep this list in sync with the controller.
2. **Endpoints** — all under the `/api` global prefix: `GET /api/status` (`{ connected, myNodeNum, host, port }`), `POST /api/send` (body `{ "text": "...", "to"?: <node number | "!b" | "broadcast"> }`, returns `{ id }`), and `GET /api/channels` (the device's Meshtastic channels as `{ index, name, uplinkEnabled, downlinkEnabled }[]`; psk/keys redacted). Scalar API docs are served at `/` (OpenAPI JSON at `/docs-json`). Keep this list in sync with the controller.
## Other