Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
266aadf635 | ||
|
|
22a209e654 |
@@ -0,0 +1,69 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
ci:
|
||||||
|
name: build + unit
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
# The runner provides a working docker CLI out of the box (full-dind) — no endpoint
|
||||||
|
# resolution needed, same as flight's CI.
|
||||||
|
- name: Setup Node
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 22
|
||||||
|
|
||||||
|
# Job-level dep cache via the runner's built-in cache server. continue-on-error: an
|
||||||
|
# unreachable/broken cache server must never break the run (flight convention). npm ci
|
||||||
|
# wipes node_modules, so cache npm's own tarball store instead — restoring node_modules
|
||||||
|
# would just be deleted again. No explicit save step: caches marked by the restore step
|
||||||
|
# are uploaded automatically at job end.
|
||||||
|
- name: Restore deps cache
|
||||||
|
uses: actions/cache@v4
|
||||||
|
continue-on-error: true
|
||||||
|
with:
|
||||||
|
path: $HOME/.npm
|
||||||
|
key: ${{ runner.os }}-deps-npm-${{ hashFiles('package-lock.json') }}
|
||||||
|
|
||||||
|
# Retried: the runner's outbound network/DNS is flaky (transient EAI_AGAIN seen in CI).
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
set -u
|
||||||
|
ok=0
|
||||||
|
for i in 1 2 3; do
|
||||||
|
if npm ci; then ok=1; break; fi
|
||||||
|
echo "::warning::dependency install attempt $i/3 failed (likely transient network) — retrying in 5s" >&2
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
|
[ "$ok" = "1" ] || { echo "::error::dependency install failed after 3 attempts" >&2; exit 1; }
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: npm run build
|
||||||
|
|
||||||
|
# vitest auto-appends results to $GITHUB_STEP_SUMMARY when GITHUB_ACTIONS=true — no
|
||||||
|
# extra summary step needed (same as flight relies on for its unit stage).
|
||||||
|
- name: Unit tests
|
||||||
|
run: npm test
|
||||||
|
|
||||||
|
# Verifies the production Dockerfile builds — the deploy path is `docker compose up -d --build`.
|
||||||
|
# Build only, nothing runs, so no cleanup/prune steps are needed (unlike flight's e2e stack).
|
||||||
|
# Retried: same flaky runner network as dep install.
|
||||||
|
- name: Docker image build
|
||||||
|
run: |
|
||||||
|
set -u
|
||||||
|
ok=0
|
||||||
|
for i in 1 2 3; do
|
||||||
|
if docker compose build --progress=plain; then ok=1; break; fi
|
||||||
|
echo "::warning::docker build attempt $i/3 failed (likely transient network) — retrying in 5s" >&2
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
|
[ "$ok" = "1" ] || { echo "::error::docker image build failed after 3 attempts" >&2; exit 1; }
|
||||||
@@ -1,5 +1,13 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## v0.1.2 — 2026-09-23 19:51
|
||||||
|
|
||||||
|
- Added a Gitea Actions CI pipeline (`.gitea/workflows/ci.yml`), mirroring flight's runner conventions: on push/PR to `main` (plus manual dispatch) one job runs `npm ci`, `nest build`, the vitest unit suite, and a production Docker image build — with retry loops for the runner's flaky uplink. No app code changed.
|
||||||
|
|
||||||
|
## v0.1.1 — 2026-09-23 19:38
|
||||||
|
|
||||||
|
- Fixed the default bridge port to `4403`, the meshtastic-serial-bridge's actual TCP port (the old value pointed at a closed port). Updated the `MESH_PORT` default in code, the docker-compose environment, and docs.
|
||||||
|
|
||||||
## v0.1.0 — 2026-09-23 18:54
|
## v0.1.0 — 2026-09-23 18:54
|
||||||
|
|
||||||
- New `GET /api/channels` endpoint listing the device's Meshtastic channels as `{ index, name, uplinkEnabled, downlinkEnabled }`; psk/keys are redacted and never exposed over HTTP. Channels are collected from `FromRadio.channel` frames streamed during initial sync (before `config_complete_id`) and reset on every bridge reconnect so stale data is dropped after a disconnect.
|
- New `GET /api/channels` endpoint listing the device's Meshtastic channels as `{ index, name, uplinkEnabled, downlinkEnabled }`; psk/keys are redacted and never exposed over HTTP. Channels are collected from `FromRadio.channel` frames streamed during initial sync (before `config_complete_id`) and reset on every bridge reconnect so stale data is dropped after a disconnect.
|
||||||
|
|||||||
+1
-1
@@ -49,7 +49,7 @@ Credentials are deliberately NOT stored in this file — see §1 for where they
|
|||||||
## 7. App architecture quick map
|
## 7. App architecture quick map
|
||||||
|
|
||||||
- `src/mesh/codec.ts` — framing (`extractFrames`, `frame`) + protobuf encode/decode (`decodeFromRadio`, `buildTextToRadio`); unit tests in codec.spec.ts.
|
- `src/mesh/codec.ts` — framing (`extractFrames`, `frame`) + protobuf encode/decode (`decodeFromRadio`, `buildTextToRadio`); unit tests in codec.spec.ts.
|
||||||
- `src/mesh/mesh.service.ts` — TCP connection to the bridge (MESH_HOST/MESH_PORT env, defaults 192.168.1.4:4003), buffer + frame extraction on data, FromRadio dispatch (`myInfo` → myNodeNum, `channel` → upsert into channelMap keyed by index — reset on every reconnect, `configCompleteId` → ready log, `packet` → text-message logging), fixed-interval reconnect (MESH_RECONNECT_MS, default 5 s).
|
- `src/mesh/mesh.service.ts` — TCP connection to the bridge (MESH_HOST/MESH_PORT env, defaults 192.168.1.4:4403), buffer + frame extraction on data, FromRadio dispatch (`myInfo` → myNodeNum, `channel` → upsert into channelMap keyed by index — reset on every reconnect, `configCompleteId` → ready log, `packet` → text-message logging), fixed-interval reconnect (MESH_RECONNECT_MS, default 5 s).
|
||||||
- `src/mesh/mesh.controller.ts` — `GET /status`, `POST /send`, `GET /channels` (all under the `/api` global prefix set in main.ts; Scalar docs at `/`, OpenAPI JSON at `/docs-json`).
|
- `src/mesh/mesh.controller.ts` — `GET /status`, `POST /send`, `GET /channels` (all under the `/api` global prefix set in main.ts; Scalar docs at `/`, OpenAPI JSON at `/docs-json`).
|
||||||
|
|
||||||
## 8. Finding current state (this file keeps no snapshots)
|
## 8. Finding current state (this file keeps no snapshots)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# mesh-bot
|
# mesh-bot
|
||||||
|
|
||||||
Minimal NestJS bot for Meshtastic. Long-running service that TCP-connects to a
|
Minimal NestJS bot for Meshtastic. Long-running service that TCP-connects to a
|
||||||
Meshtastic serial bridge (raw socat pipe) at `192.168.1.4:4003`, parses inbound
|
Meshtastic serial bridge (raw socat pipe) at `192.168.1.4:4403`, parses inbound
|
||||||
protobuf frames, logs received text messages, and exposes HTTP endpoints to send text.
|
protobuf frames, logs received text messages, and exposes HTTP endpoints to send text.
|
||||||
|
|
||||||
## Local run
|
## Local run
|
||||||
@@ -42,7 +42,7 @@ curl http://localhost:3000/api/channels
|
|||||||
## Env vars
|
## Env vars
|
||||||
|
|
||||||
- `MESH_HOST` (default `192.168.1.4`) — bridge host
|
- `MESH_HOST` (default `192.168.1.4`) — bridge host
|
||||||
- `MESH_PORT` (default `4003`) — bridge port
|
- `MESH_PORT` (default `4403`) — bridge port
|
||||||
- `MESH_RECONNECT_MS` (default `5000`) — reconnect interval in ms
|
- `MESH_RECONNECT_MS` (default `5000`) — reconnect interval in ms
|
||||||
- `PORT` (default `3000`) — HTTP listen port
|
- `PORT` (default `3000`) — HTTP listen port
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@ services:
|
|||||||
build: .
|
build: .
|
||||||
environment:
|
environment:
|
||||||
MESH_HOST: 192.168.1.4
|
MESH_HOST: 192.168.1.4
|
||||||
MESH_PORT: '4003'
|
MESH_PORT: '4403'
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
networks:
|
networks:
|
||||||
- dev_net
|
- dev_net
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "mesh-bot",
|
"name": "mesh-bot",
|
||||||
"version": "0.1.0",
|
"version": "0.1.2",
|
||||||
"description": "",
|
"description": "",
|
||||||
"author": "",
|
"author": "",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import {
|
|||||||
export class MeshService implements OnModuleInit, OnModuleDestroy {
|
export class MeshService implements OnModuleInit, OnModuleDestroy {
|
||||||
private readonly logger = new Logger(MeshService.name);
|
private readonly logger = new Logger(MeshService.name);
|
||||||
private readonly host = process.env.MESH_HOST ?? '192.168.1.4';
|
private readonly host = process.env.MESH_HOST ?? '192.168.1.4';
|
||||||
private readonly port = parseInt(process.env.MESH_PORT ?? '4003', 10);
|
private readonly port = parseInt(process.env.MESH_PORT ?? '4403', 10);
|
||||||
// ponytail: fixed-interval retry, no backoff — fine for single-bridge use
|
// ponytail: fixed-interval retry, no backoff — fine for single-bridge use
|
||||||
private readonly reconnectMs = parseInt(
|
private readonly reconnectMs = parseInt(
|
||||||
process.env.MESH_RECONNECT_MS ?? '5000',
|
process.env.MESH_RECONNECT_MS ?? '5000',
|
||||||
|
|||||||
Reference in New Issue
Block a user