forked from svrjs/svrjs
Update to SVR.JS 3.15.6
This commit is contained in:
parent
effc654f05
commit
d44ee67e57
5 changed files with 65 additions and 13 deletions
|
@ -58,5 +58,6 @@
|
||||||
"exposeModsInErrorPages": true,
|
"exposeModsInErrorPages": true,
|
||||||
"disableTrailingSlashRedirects": false,
|
"disableTrailingSlashRedirects": false,
|
||||||
"environmentVariables": {},
|
"environmentVariables": {},
|
||||||
"allowDoubleSlashes": false
|
"allowDoubleSlashes": false,
|
||||||
|
"optOutOfStatisticsServer": false
|
||||||
}
|
}
|
||||||
|
|
10
index.html
10
index.html
|
@ -1,7 +1,7 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>SVR.JS 3.15.5</title>
|
<title>SVR.JS 3.15.6</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<style>
|
<style>
|
||||||
|
@ -76,7 +76,7 @@
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Welcome to SVR.JS 3.15.5</h1>
|
<h1>Welcome to SVR.JS 3.15.6</h1>
|
||||||
<br />
|
<br />
|
||||||
<img src="/logo.png" style="width: 224px; max-width: 100%;" />
|
<img src="/logo.png" style="width: 224px; max-width: 100%;" />
|
||||||
<br />
|
<br />
|
||||||
|
@ -143,12 +143,14 @@
|
||||||
"exposeModsInErrorPages": true,
|
"exposeModsInErrorPages": true,
|
||||||
"disableTrailingSlashRedirects": false,
|
"disableTrailingSlashRedirects": false,
|
||||||
"environmentVariables": {},
|
"environmentVariables": {},
|
||||||
"allowDoubleSlashes": false
|
"allowDoubleSlashes": false,
|
||||||
|
"optOutOfStatisticsServer": false
|
||||||
}</pre>
|
}</pre>
|
||||||
</code>
|
</code>
|
||||||
<p>Changes:</p>
|
<p>Changes:</p>
|
||||||
<ul style="display: inline-block; margin: 0;">
|
<ul style="display: inline-block; margin: 0;">
|
||||||
<li>Lifted PBKDF2 restrictions on Bun 1.1.13 and later.</li>
|
<li>Added new config.json property - optOutOfStatisticsServer.</li>
|
||||||
|
<li>Implemented sending data to the statistics server, so that SVR.JS can measure the popularity of the web server.</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>
|
<p>
|
||||||
<a href="/tests.html">Tests</a><br />
|
<a href="/tests.html">Tests</a><br />
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>SVR.JS 3.15.5 Licenses</title>
|
<title>SVR.JS 3.15.6 Licenses</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<style>
|
<style>
|
||||||
|
@ -76,8 +76,8 @@
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>SVR.JS 3.15.5 Licenses</h1>
|
<h1>SVR.JS 3.15.6 Licenses</h1>
|
||||||
<h2>SVR.JS 3.15.5</h2>
|
<h2>SVR.JS 3.15.6</h2>
|
||||||
<div style="display: inline-block; text-align: left; border-width: 2px; border-style: solid; border-color: gray; padding: 8px;">
|
<div style="display: inline-block; text-align: left; border-width: 2px; border-style: solid; border-color: gray; padding: 8px;">
|
||||||
MIT License<br/>
|
MIT License<br/>
|
||||||
<br/>
|
<br/>
|
||||||
|
@ -101,7 +101,7 @@
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE<br/>
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE<br/>
|
||||||
SOFTWARE.<br/>
|
SOFTWARE.<br/>
|
||||||
</div>
|
</div>
|
||||||
<h2>Packages used by SVR.JS 3.15.5</h2>
|
<h2>Packages used by SVR.JS 3.15.6</h2>
|
||||||
<div style="width: 100%; max-width: 1280px; margin: auto">
|
<div style="width: 100%; max-width: 1280px; margin: auto">
|
||||||
<div style="width: 100%; background-color: #ccc; background-color: rgba(200, 200, 200, 0.3); border: 1px solid green; text-align: left; margin: 10px 0;">
|
<div style="width: 100%; background-color: #ccc; background-color: rgba(200, 200, 200, 0.3); border: 1px solid green; text-align: left; margin: 10px 0;">
|
||||||
<div style="float: right;">License: MIT</div>
|
<div style="float: right;">License: MIT</div>
|
||||||
|
|
53
svr.js
53
svr.js
|
@ -69,7 +69,7 @@ function deleteFolderRecursive(path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var os = require("os");
|
var os = require("os");
|
||||||
var version = "3.15.5";
|
var version = "3.15.6";
|
||||||
var singlethreaded = false;
|
var singlethreaded = false;
|
||||||
|
|
||||||
if (process.versions) process.versions.svrjs = version; // Inject SVR.JS into process.versions
|
if (process.versions) process.versions.svrjs = version; // Inject SVR.JS into process.versions
|
||||||
|
@ -1202,6 +1202,7 @@ var wwwrootPostfixesVHost = [];
|
||||||
var wwwrootPostfixPrefixesVHost = [];
|
var wwwrootPostfixPrefixesVHost = [];
|
||||||
var allowDoubleSlashes = false;
|
var allowDoubleSlashes = false;
|
||||||
var allowPostfixDoubleSlashes = false;
|
var allowPostfixDoubleSlashes = false;
|
||||||
|
var optOutOfStatisticsServer = false;
|
||||||
|
|
||||||
// Get properties from config.json
|
// Get properties from config.json
|
||||||
if (configJSON.blacklist != undefined) rawBlockList = configJSON.blacklist;
|
if (configJSON.blacklist != undefined) rawBlockList = configJSON.blacklist;
|
||||||
|
@ -1259,7 +1260,7 @@ if (configJSON.wwwrootPostfixesVHost != undefined) wwwrootPostfixesVHost = confi
|
||||||
if (configJSON.wwwrootPostfixPrefixesVHost != undefined) wwwrootPostfixPrefixesVHost = configJSON.wwwrootPostfixPrefixesVHost;
|
if (configJSON.wwwrootPostfixPrefixesVHost != undefined) wwwrootPostfixPrefixesVHost = configJSON.wwwrootPostfixPrefixesVHost;
|
||||||
if (configJSON.allowDoubleSlashes != undefined) allowDoubleSlashes = configJSON.allowDoubleSlashes;
|
if (configJSON.allowDoubleSlashes != undefined) allowDoubleSlashes = configJSON.allowDoubleSlashes;
|
||||||
if (configJSON.allowPostfixDoubleSlashes != undefined) allowPostfixDoubleSlashes = configJSON.allowPostfixDoubleSlashes;
|
if (configJSON.allowPostfixDoubleSlashes != undefined) allowPostfixDoubleSlashes = configJSON.allowPostfixDoubleSlashes;
|
||||||
|
if (configJSON.optOutOfStatisticsServer != undefined) optOutOfStatisticsServer = configJSON.optOutOfStatisticsServer;
|
||||||
var wwwrootError = null;
|
var wwwrootError = null;
|
||||||
try {
|
try {
|
||||||
if (cluster.isPrimary || cluster.isPrimary === undefined) process.chdir(configJSON.wwwroot != undefined ? configJSON.wwwroot : __dirname);
|
if (cluster.isPrimary || cluster.isPrimary === undefined) process.chdir(configJSON.wwwroot != undefined ? configJSON.wwwroot : __dirname);
|
||||||
|
@ -5063,6 +5064,52 @@ function listeningMessage() {
|
||||||
if (!(secure && disableNonEncryptedServer) && !listenToLocalhost) serverconsole.locmessage("* http://" + domain + (pubport == 80 ? "" : (":" + pubport)));
|
if (!(secure && disableNonEncryptedServer) && !listenToLocalhost) serverconsole.locmessage("* http://" + domain + (pubport == 80 ? "" : (":" + pubport)));
|
||||||
}
|
}
|
||||||
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
|
||||||
|
if (!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 {
|
||||||
|
var statisticsToSend = JSON.stringify({
|
||||||
|
version: version,
|
||||||
|
runtime: process.isBun ? "Bun" : "Node.js",
|
||||||
|
runtimeVersion: process.isBun ? process.versions.bun : process.version,
|
||||||
|
mods: modInfos
|
||||||
|
});
|
||||||
|
var statisticsRequest = https.request("https://statistics.svrjs.org/collect.svr", {
|
||||||
|
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"),
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
"Content-Length": Buffer.byteLength(statisticsToSend)
|
||||||
|
}
|
||||||
|
}, function (res) {
|
||||||
|
var statusCode = res.statusCode;
|
||||||
|
var data = "";
|
||||||
|
res.on("data", function (chunk) {
|
||||||
|
data += chunk.toString();
|
||||||
|
});
|
||||||
|
res.on("end", function () {
|
||||||
|
try {
|
||||||
|
var parsedJson = {};
|
||||||
|
try {
|
||||||
|
parsedJson = JSON.parse(data);
|
||||||
|
} catch (err) {
|
||||||
|
throw new Error("JSON parse error (response parsing failed).");
|
||||||
|
}
|
||||||
|
if (parsedJson.status != statusCode) throw new Error("Status code mismatch");
|
||||||
|
if (statusCode != 200) throw new Error(parsedJson.message);
|
||||||
|
} catch (err) {
|
||||||
|
serverconsole.locwarnmessage("There was a problem, when sending data to statistics server! Reason: " + err.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
statisticsRequest.on("error", function (err) {
|
||||||
|
serverconsole.locwarnmessage("There was a problem, when sending data to statistics server! Reason: " + err.message);
|
||||||
|
});
|
||||||
|
statisticsRequest.end(statisticsToSend);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5098,6 +5145,7 @@ function start(init) {
|
||||||
}
|
}
|
||||||
if (secure && configJSON.enableOCSPStapling && ocsp._errored) serverconsole.locwarnmessage("Can't load OCSP module. OCSP stapling will be disabled. OCSP stapling is a security feature that improves the performance and security of HTTPS connections by caching the certificate status response. If you require this feature, consider updating your Node.JS version or checking for any issues with the 'ocsp' module.");
|
if (secure && configJSON.enableOCSPStapling && ocsp._errored) serverconsole.locwarnmessage("Can't load OCSP module. OCSP stapling will be disabled. OCSP stapling is a security feature that improves the performance and security of HTTPS connections by caching the certificate status response. If you require this feature, consider updating your Node.JS version or checking for any issues with the 'ocsp' module.");
|
||||||
if (disableMods) serverconsole.locwarnmessage("SVR.JS is running without mods and server-side JavaScript enabled. Web applications may not work as expected");
|
if (disableMods) serverconsole.locwarnmessage("SVR.JS is running without mods and server-side JavaScript enabled. Web applications may not work as expected");
|
||||||
|
if (optOutOfStatisticsServer) serverconsole.locmessage("SVR.JS is configured to opt out of sending data to the statistics server.");
|
||||||
console.log();
|
console.log();
|
||||||
|
|
||||||
// Display mod and server-side JavaScript errors
|
// Display mod and server-side JavaScript errors
|
||||||
|
@ -5791,6 +5839,7 @@ function saveConfig() {
|
||||||
if (configJSONobj.disableTrailingSlashRedirects === undefined) configJSONobj.disableTrailingSlashRedirects = false;
|
if (configJSONobj.disableTrailingSlashRedirects === undefined) configJSONobj.disableTrailingSlashRedirects = false;
|
||||||
if (configJSONobj.environmentVariables === undefined) configJSONobj.environmentVariables = {};
|
if (configJSONobj.environmentVariables === undefined) configJSONobj.environmentVariables = {};
|
||||||
if (configJSONobj.allowDoubleSlashes === undefined) configJSONobj.allowDoubleSlashes = false;
|
if (configJSONobj.allowDoubleSlashes === undefined) configJSONobj.allowDoubleSlashes = false;
|
||||||
|
if (configJSONobj.optOutOfStatisticsServer === undefined) configJSONobj.optOutOfStatisticsServer = false;
|
||||||
|
|
||||||
var configString = JSON.stringify(configJSONobj, null, 2) + "\n";
|
var configString = JSON.stringify(configJSONobj, null, 2) + "\n";
|
||||||
fs.writeFileSync(__dirname + "/config.json", configString);
|
fs.writeFileSync(__dirname + "/config.json", configString);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>SVR.JS 3.15.5 Tests</title>
|
<title>SVR.JS 3.15.6 Tests</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<style>
|
<style>
|
||||||
|
@ -76,7 +76,7 @@
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>SVR.JS 3.15.5 Tests</h1>
|
<h1>SVR.JS 3.15.6 Tests</h1>
|
||||||
<h2>Directory (without trailing slash)</h2>
|
<h2>Directory (without trailing slash)</h2>
|
||||||
<iframe src="/testdir" width="75%" height="300px"></iframe>
|
<iframe src="/testdir" width="75%" height="300px"></iframe>
|
||||||
<h2>Directory (with query)</h2>
|
<h2>Directory (with query)</h2>
|
||||||
|
|
Reference in a new issue