From 233af94d288929bda24f5894618b03c35415ec76 Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Mon, 26 Aug 2024 07:01:52 +0200 Subject: [PATCH] Implement sending data to the statistics server --- src/index.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/index.js b/src/index.js index 38449d4..e90373d 100644 --- a/src/index.js +++ b/src/index.js @@ -889,8 +889,7 @@ function listeningMessage() { serverconsole.locmessage("For CLI help, you can type \"help\""); // Code for sending data to a statistics server - // TODO: uncomment this - /*if (!optOutOfStatisticsServer) { + if (!process.serverConfig.optOutOfStatisticsServer) { if (crypto.__disabled__ !== undefined) { serverconsole.locwarnmessage("Sending data to statistics server is disabled, because the server only supports HTTPS, and your Node.JS version doesn't have crypto support."); } else { @@ -903,7 +902,7 @@ function listeningMessage() { const statisticsRequest = https.request(statisticsServerCollectEndpoint, { method: "POST", headers: { - "User-Agent": (exposeServerVersion ? "SVR.JS/" + version + " (" + getOS() + "; " + (process.isBun ? ("Bun/v" + process.versions.bun + "; like Node.JS/" + process.version) : ("Node.JS/" + process.version)) + ")" : "SVR.JS"), + "User-Agent": generateServerString(true), "Content-Type": "application/json", "Content-Length": Buffer.byteLength(statisticsToSend) } @@ -933,7 +932,7 @@ function listeningMessage() { }); statisticsRequest.end(statisticsToSend); } - }*/ + } }); }