mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-03 01:42:50 +08:00
Anonymous usage ping from self-hosted gateways
On startup and once a day the gateway sends a random instance id and its version to gateway.webspeak3.de (TELEMETRY=0 turns it off, the startup log says so). The standalone store server receives it with PING_DATA_FILE set, keeps id/version/first/last seen without IPs, and serves admin-only counts. The release tag is baked into the image as WEBSPEAK3_VERSION. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
This commit is contained in:
1 parent
603cedd907
commit
cc70bc4736
8 files changed
+172
-1
No files matched your search
@@ -6,6 +6,7 @@
|
||||
// and the reverse proxy routes /api/store/* here.
|
||||
import { createServer } from "node:http";
|
||||
import { handleStore } from "./store.js";
|
||||
import { handlePing } from "./ping.js";
|
||||
|
||||
const PORT = Number(process.env.PORT ?? 8080);
|
||||
|
||||
@@ -27,6 +28,16 @@ createServer((req, res) => {
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (pathname === "/api/ping" || pathname === "/api/ping/stats") {
|
||||
handlePing(req, res, pathname).catch((err) => {
|
||||
console.error("[ping] Request failed:", err);
|
||||
if (!res.headersSent) {
|
||||
res.writeHead(500, { "Content-Type": "application/json" });
|
||||
res.end(JSON.stringify({ error: "internal" }));
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
res.writeHead(404, { "Content-Type": "application/json" });
|
||||
res.end(JSON.stringify({ error: "not_found" }));
|
||||
}).listen(PORT, () => console.log(`WebSpeak3 store listening on http://localhost:${PORT}`));
|
||||
Reference in new issue
Block a user