1
0
Fork 0
forked from svrjs/svrjs

Implement sending data to the statistics server

This commit is contained in:
Dorian Niemiec 2024-08-26 07:01:52 +02:00
parent ef78a88a39
commit 233af94d28

View file

@ -889,8 +889,7 @@ function listeningMessage() {
serverconsole.locmessage("For CLI help, you can type \"help\""); serverconsole.locmessage("For CLI help, you can type \"help\"");
// Code for sending data to a statistics server // Code for sending data to a statistics server
// TODO: uncomment this if (!process.serverConfig.optOutOfStatisticsServer) {
/*if (!optOutOfStatisticsServer) {
if (crypto.__disabled__ !== undefined) { 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."); 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 { } else {
@ -903,7 +902,7 @@ function listeningMessage() {
const statisticsRequest = https.request(statisticsServerCollectEndpoint, { const statisticsRequest = https.request(statisticsServerCollectEndpoint, {
method: "POST", method: "POST",
headers: { 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-Type": "application/json",
"Content-Length": Buffer.byteLength(statisticsToSend) "Content-Length": Buffer.byteLength(statisticsToSend)
} }
@ -933,7 +932,7 @@ function listeningMessage() {
}); });
statisticsRequest.end(statisticsToSend); statisticsRequest.end(statisticsToSend);
} }
}*/ }
}); });
} }