From cadc78d1d4ca18daac771e8dc929056f262c1715 Mon Sep 17 00:00:00 2001 From: Anton Roslund Date: Sun, 30 Mar 2025 16:43:20 +0200 Subject: [PATCH] fix hardware stats API --- src/stats.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/stats.js b/src/stats.js index 3512251..13e7f05 100644 --- a/src/stats.js +++ b/src/stats.js @@ -1,10 +1,17 @@ +const path = require('path'); const express = require('express'); const router = express.Router(); +const protobufjs = require("protobufjs"); // create prisma db client const { PrismaClient } = require("@prisma/client"); const prisma = new PrismaClient(); +// load protobufs +const root = new protobufjs.Root(); +root.resolvePath = (origin, target) => path.join(__dirname, "protos", target); +root.loadSync('meshtastic/mqtt.proto'); +const HardwareModel = root.lookupEnum("HardwareModel"); router.get('/hardware-models', async (req, res) => { try {