From c9351632da5b7f86143ae0f57d5b43c1a44d6397 Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Sun, 14 Jan 2024 19:11:30 +0100 Subject: [PATCH] Update to SVR.JS 3.4.41 --- LICENSE | 2 +- index.html | 9 ++++--- licenses/index.html | 10 +++---- svr.js | 48 +++++++++++++++------------------ testdir/.personalized/FOOT.html | 2 +- tests.html | 4 +-- 6 files changed, 36 insertions(+), 39 deletions(-) diff --git a/LICENSE b/LICENSE index ad694af..f382250 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020-2023 DorianTech +Copyright (c) 2018-2024 SVR.JS Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/index.html b/index.html index 69bec33..5546b73 100644 --- a/index.html +++ b/index.html @@ -1,7 +1,7 @@ - SVR.JS 3.4.40 + SVR.JS 3.4.41 -

Welcome to SVR.JS 3.4.40

+

Welcome to SVR.JS 3.4.41



@@ -119,7 +119,10 @@

Changes:


Tests
diff --git a/licenses/index.html b/licenses/index.html index b6daaab..c308801 100644 --- a/licenses/index.html +++ b/licenses/index.html @@ -1,7 +1,7 @@ - SVR.JS 3.4.40 Licenses + SVR.JS 3.4.41 Licenses -

SVR.JS 3.4.40 Licenses

-

SVR.JS 3.4.40

+

SVR.JS 3.4.41 Licenses

+

SVR.JS 3.4.41

MIT License

- Copyright (c) 2020-2023 DorianTech
+ Copyright (c) 2018-2024 SVR.JS

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -37,7 +37,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-

Packages used by SVR.JS 3.4.40 and utilities

+

Packages used by SVR.JS 3.4.41 and utilities

License: MIT
diff --git a/svr.js b/svr.js index 77ca7e5..b0b446a 100644 --- a/svr.js +++ b/svr.js @@ -1,26 +1,17 @@ -//DorianTech HTTP Server -//Uses Content-Type and Content-Length -//Events calling: -//| -//+--request -//| -//+--connect -//| -//+--error -// -//APIs: -// - https -// - readline -// - os -// - http -// - url -// - fs -// - path -// - hexstrbase64 -// - crypto -// - svrmodpack -// - graceful-fs -// - formidable +// SVR.JS - a web server running on Node.JS + +/* + * MIT License + * + * Copyright (c) 2018-2024 SVR.JS + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + if (typeof require === "undefined") { if (typeof ActiveXObject !== "undefined" && typeof WScript !== "undefined") { var shell = new ActiveXObject("WScript.Shell"); @@ -71,7 +62,7 @@ function deleteFolderRecursive(path) { } var os = require("os"); -var version = "3.4.40"; +var version = "3.4.41"; var singlethreaded = false; if (process.versions) process.versions.svrjs = version; //Inject SVR.JS into process.versions @@ -1134,6 +1125,9 @@ function LOG(s) { flags: "a", autoClose: false }); + logFile.on("error", function(err) { + if (!s.match(/^SERVER WARNING MESSAGE(?: \[Request Id: [0-9a-f]{6}\])?: There was a problem while saving logs! Logs will not be kept in log file\. Reason: /) && !reallyExiting) serverconsole.locwarnmessage("There was a problem while saving logs! Logs will not be kept in log file. Reason: " + err.message); + }); } if (logFile.writable) { logFile.write("[" + new Date().toISOString() + "] " + s + "\r\n"); @@ -1349,7 +1343,7 @@ if (!disableMods) { } } catch (ex) { if (cluster.isPrimary || cluster.isPrimary === undefined) { - serverconsole.locwarnmessage("There was a problem while loading a \"" + modFiles[i] + "\" mod."); + serverconsole.locwarnmessage("There was a problem while loading a \"" + String(modFiles[i]).replace(/[\r\n]/g, "") + "\" mod."); serverconsole.locwarnmessage("Stack:"); serverconsole.locwarnmessage(generateErrorStack(ex)); } @@ -4143,7 +4137,7 @@ if (!cluster.isPrimary) { } } callServerError(401, undefined, undefined, ha); - serverconsole.errmessage("User " + username + " failed to log in."); + serverconsole.errmessage("User " + String(username).replace(/[\r\n]/g, "") + " failed to log in."); } else { if (bruteProtection) { if (process.send) { @@ -4357,7 +4351,7 @@ function start(init) { if (init) { for (i = 0; i < logo.length; i++) console.log(logo[i]); //Print logo console.log(); - console.log("Welcome to DorianTech SVR.JS server."); + console.log("Welcome to SVR.JS - a web server running on Node.JS"); if (version.indexOf("Nightly-") === 0) serverconsole.locwarnmessage("This version is only for test purposes and may be unstable."); if (vnum <= 57 && JSON.stringify(rewriteMap) != "[]") serverconsole.locwarnmessage("Some URL rewriting regexes will not work in Node.JS 8.x and earlier."); if (http2.__disabled__ !== undefined) serverconsole.locwarnmessage("HTTP/2 isn't supported by your Node.JS version!"); diff --git a/testdir/.personalized/FOOT.html b/testdir/.personalized/FOOT.html index dd34732..b9ef4f4 100644 --- a/testdir/.personalized/FOOT.html +++ b/testdir/.personalized/FOOT.html @@ -1,6 +1,6 @@
diff --git a/tests.html b/tests.html index 31bb41e..77b14ac 100644 --- a/tests.html +++ b/tests.html @@ -1,7 +1,7 @@ - SVR.JS 3.4.40 Tests + SVR.JS 3.4.41 Tests -

SVR.JS 3.4.40 Tests

+

SVR.JS 3.4.41 Tests

Directory

Directory (with query)