Inbox injection endpoint: POST /api/messages + MCP inject_message (#12) (#18)
CI / build + unit (push) Successful in 1m14s

This commit was merged in pull request #18.
This commit is contained in:
2026-09-25 01:51:50 +02:00
parent 0571c7095e
commit 756086d107
10 changed files with 253 additions and 7 deletions
+8 -2
View File
@@ -115,14 +115,20 @@ export async function loadHwModelNames(): Promise<Map<number, string>> {
return hwModelNames;
}
/** Random non-zero uint32 packet id. */
export function randomPacketId(): number {
let id = Math.floor(Math.random() * 0x100000000) >>> 0;
if (id === 0) id = 1; // non-zero uint32
return id;
}
export async function buildTextToRadio(
to: number,
text: string,
channelIndex: number,
): Promise<{ bytes: Uint8Array; id: number }> {
const P = await loadProto();
let id = Math.floor(Math.random() * 0x100000000) >>> 0;
if (id === 0) id = 1; // non-zero uint32
const id = randomPacketId();
const meshPacket = create(P.Mesh.MeshPacketSchema, {
to,
id,