Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,4 @@ GH_APP_CLIENT_ID=
GH_APP_CLIENT_SECRET=
REDIS_URL=
DATABASE_URL=
MQTT_URL=
MQTT_USERNAME=
MQTT_PASSWORD=
MQTT_ROOT_TOPIC=
UPDATER_MANIFEST_URL=
11 changes: 0 additions & 11 deletions buf.yaml

This file was deleted.

8 changes: 0 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@
"build": "prisma generate && tsc"
},
"dependencies": {
"@buf/meshtastic_api.bufbuild_es": "1.7.2-20240110092216-3a147af14302.1",
"@buf/meshtastic_api.connectrpc_es": "1.3.0-20240110092216-3a147af14302.1",
"@bufbuild/protobuf": "^1.7.2",
"@connectrpc/connect": "^1.3.0",
"@connectrpc/connect-express": "^1.3.0",
"@meshtastic/js": "2.2.23-0",
"@octokit/auth-app": "^6.0.3",
"@prisma/client": "5.22.0",
"@tinyhttp/app": "2.2.3",
Expand All @@ -25,11 +19,9 @@
"@tinyhttp/favicon": "^3.0.0",
"@tinyhttp/logger": "^2.0.0",
"add": "^2.0.6",
"mqtt": "^5.3.5",
"octokit": "^3.1.2",
"pnpm": "^8.15.3",
"redis": "^4.6.13",
"sub-events": "^1.9.0",
"ts-pattern": "^5.0.8",
"typescript": "^5.3.3"
},
Expand Down
535 changes: 0 additions & 535 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-- Purge stored gateway coordinates.
--
-- These were never the gateway's own position. The row was keyed on
-- packet.gatewayId, but the coordinates came from the POSITION_APP payload of
-- the packet being relayed, whose origin is packet.packet.from -- so each row
-- held the last known position of some *other* node that the gateway happened
-- to forward, at full precision (degrees * 1e7, ~1cm). Every row was served
-- publicly and unauthenticated by GET /mqtt and the gatewayStream RPC.
--
-- The following migration drops these tables outright, which makes this
-- statement redundant on a successful deploy. It is kept deliberately: Prisma
-- applies migrations in order and halts on the first failure, so if the DROP
-- fails for any reason the coordinates have already been cleared.
UPDATE "Gateway" SET "latitude" = NULL, "longitude" = NULL;
13 changes: 13 additions & 0 deletions prisma/migrations/20260811000100_drop_mqtt_tables/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
-- Drop the MQTT-derived tables.
--
-- The MQTT ingest, the GET /mqtt endpoint and the gatewayStream RPC have all
-- been removed, so nothing writes or reads these tables. They were the only two
-- models in the schema.
--
-- This is irreversible. It destroys the stored coordinates for good -- which is
-- the point, see the preceding migration -- and takes the per-channel message
-- counters with them.
--
-- Channel is dropped first: it carries the foreign key to Gateway.
DROP TABLE IF EXISTS "Channel";
DROP TABLE IF EXISTS "Gateway";
18 changes: 18 additions & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema

// The MQTT subsystem that read and wrote these models is gone, and the
// migrations in this directory drop both tables on deploy. The models are kept
// here for one release regardless, because `prisma generate` exits 1 on a schema
// with no models and this project's build runs it. Emptying the schema in the
// same change would break the build, and the drop would then never reach
// production.
//
// So between this deploy and the follow-up, the schema deliberately describes
// two tables that no longer exist. Nothing reads them -- no code imports the
// generated client. Do not run `prisma migrate dev` against a deployed database
// in that window: it would read the missing tables as drift and try to recreate
// them.
//
// FOLLOW-UP, once the drop migration has been applied: delete this file and the
// migrations directory, drop the `prisma` and `@prisma/client` dependencies and
// the `prisma generate` / `prisma migrate deploy` steps from package.json, and
// remove DATABASE_URL from the environment.

generator client {
provider = "prisma-client-js"
}
Expand Down
34 changes: 0 additions & 34 deletions protobufs/gateway/v1/gateway.proto

This file was deleted.

14 changes: 0 additions & 14 deletions protobufs/gateway/v1/gateway_service.proto

This file was deleted.

16 changes: 0 additions & 16 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
import { GatewayService } from "@buf/meshtastic_api.connectrpc_es/protobufs/gateway/v1/gateway_service_connect.js";
import { expressConnectMiddleware } from "@connectrpc/connect-express";
import { App } from "@tinyhttp/app";
import { cors } from "@tinyhttp/cors";
import { config } from "@tinyhttp/dotenv";
import { favicon } from "@tinyhttp/favicon";
import { logger } from "@tinyhttp/logger";
import { RegisterMqttClient } from "./lib/index.js";
import {
DeviceLinksRoutes,
EventFirmwareIconRoutes,
EventFirmwareRoutes,
FirmwareRoutes,
GithubRoutes,
MqttRoutes,
ResourceRoutes,
UpdaterRoutes,
} from "./routes/index.js";
import { Gateway } from "./services/index.js";

export const app = new App();
config();
RegisterMqttClient();
app
.use(logger())
.use(favicon("static/favicon.ico"))
Expand Down Expand Up @@ -67,15 +61,6 @@
res.setHeader("content-type", "application/octet-stream");
res.send(data.body);
});
})
.use(async (req, res, next) => {
return expressConnectMiddleware({
routes: (router) => {
router.service(GatewayService, new Gateway());
},
connect: true,
// @ts-ignore
})(req, res, next);
});

/**
Expand All @@ -88,6 +73,5 @@
EventFirmwareRoutes();
EventFirmwareIconRoutes();
UpdaterRoutes();
MqttRoutes();

app.listen(Number.parseInt(process.env.PORT ?? "4000"));

Check notice on line 77 in src/index.ts

View workflow job for this annotation

GitHub Actions / quality

lint/correctness/useParseIntRadix

Missing radix parameter
2 changes: 0 additions & 2 deletions src/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
export * as GitHub from "./github.js";
export { RegisterMqttClient } from "./mqtt.js";
export { prisma } from "./prisma.js";
export { redis } from "./redis.js";
export * as Hardware from "./resource.js";
Loading
Loading