1
0
Fork 0
forked from svrjs/svrjs

Update to SVR.JS 3.13.0

This commit is contained in:
Dorian Niemiec 2024-01-14 19:03:30 +01:00
parent 4928ac1d2c
commit 26214c9eb8
6 changed files with 425 additions and 552 deletions

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>SVR.JS 3.12.3</title>
<title>SVR.JS 3.13.0</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta charset="UTF-8" />
<style>
@ -12,7 +12,7 @@
</style>
</head>
<body>
<h1>Welcome to SVR.JS 3.12.3</h1>
<h1>Welcome to SVR.JS 3.13.0</h1>
<br/>
<img src="/logo.png" style="width: 256px;" />
<br/>
@ -134,8 +134,12 @@
</div>
<p>Changes:</p>
<ul>
<li>Removed all remnants of "DorianTech".</li>
<li>Fixed bug with wildcard in domain name selectors.</li>
<li>Added support for skipping URL rewriting, when the URL refers to a file or a directory.</li>
<li>Dropped support for svrmodpack.</li>
<li>Added support for 307 and 308 redirects (both in config.json and in redirect() SVR.JS API method).</li>
<li>Mitigated log file injection vulnerability for HTTP authentication.</li>
<li>Mitigated log file injection vulnerability for SVR.JS mod file names.</li>
<li>SVR.JS no longer crashes, when access to a log file is denied.</li>
</ul>
<br/>
<a href="/tests.html">Tests</a><br/>

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>SVR.JS 3.12.3 Licenses</title>
<title>SVR.JS 3.13.0 Licenses</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta charset="UTF-8" />
<style>
@ -12,8 +12,8 @@
</style>
</head>
<body>
<h1>SVR.JS 3.12.3 Licenses</h1>
<h2>SVR.JS 3.12.3</h2>
<h1>SVR.JS 3.13.0 Licenses</h1>
<h2>SVR.JS 3.13.0</h2>
<div style="display: inline-block; text-align: left; border-width: 2px; border-style: solid; border-color: gray; padding: 8px;">
MIT License<br/>
<br/>
@ -37,7 +37,7 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE<br/>
SOFTWARE.<br/>
</div>
<h2>Packages used by SVR.JS 3.12.3</h2>
<h2>Packages used by SVR.JS 3.13.0</h2>
<div style="width: 100%; background-color: #ccc; border: 1px solid green; text-align: left; margin: 10px 0;">
<div style="float: right;">License: MIT</div>
<div style="font-size: 20px;">

88
node_modules/svrmodpack/index.js generated vendored
View file

@ -1,88 +0,0 @@
var fs = require("fs");
var zlib = require("zlib");
const path = require('path');
function mkDirByPathSync(targetDir, { isRelativeToScript = false } = {}) {
const sep = path.sep;
const initDir = path.isAbsolute(targetDir) ? sep : '';
const baseDir = isRelativeToScript ? __dirname : '.';
return targetDir.split(sep).reduce((parentDir, childDir) => {
const curDir = path.resolve(baseDir, parentDir, childDir);
try {
fs.mkdirSync(curDir);
} catch (err) {
if (err.code === 'EEXIST') { // curDir already exists!
return curDir;
}
// To avoid `EISDIR` error on Mac and `EACCES`-->`ENOENT` and `EPERM` on Windows.
if (err.code === 'ENOENT') { // Throw the original parentDir error on curDir `ENOENT` failure.
throw new Error(`EACCES: permission denied, mkdir '${parentDir}'`);
}
const caughtErr = ['EACCES', 'EPERM', 'EISDIR'].indexOf(err.code) > -1;
if (!caughtErr || caughtErr && curDir === path.resolve(targetDir)) {
throw err; // Throw if it's just the last created dir.
}
}
return curDir;
}, initDir);
}
function pack(ins, out, modinfof) {
if (typeof modinfof === 'undefined') {
modinfof = 'mod.info';
}
var modinfo = JSON.parse(fs.readFileSync(modinfof));
var file = "SVR\0";
var modinfo2 = "";
modinfo2 += modinfo.name;
modinfo2 += "\0";
modinfo2 += modinfo.version;
modinfo2 += "\0";
file += modinfo2
for (var i = 0; i < ins.length; i++) {
var script = fs.readFileSync(ins[i]);
file += ins[i];
file += "\0";
file += script.toString();
file += "\0";
}
fs.writeFileSync(out, zlib.gzipSync(file));
}
function unpack(inputf, outf, modinfof) {
if (typeof outf === 'undefined') {
outf = '';
}
if (typeof modinfof === 'undefined') {
modinfof = 'mod.info';
}
try {
mkDirByPathSync(outf);
} catch (ex) {}
var script = "";
var modinfo = {};
var file = zlib.gunzipSync(fs.readFileSync(inputf)).toString();
var tokens = file.split("\0");
var files = [];
if (tokens[0] != "SVR") throw new Error("wrong signature");
modinfo.name = tokens[1];
modinfo.version = tokens[2];
for (var i = 3; i < tokens.length - 1; i += 2) {
files.push({
name: tokens[i],
content: tokens[i + 1]
});
}
fs.writeFileSync((outf + "/" + modinfof).replace(/\/\//g, "/"), JSON.stringify(modinfo, null, 2));
for (var i = 0; i < files.length; i++) {
fs.writeFileSync((outf + "/" + files[i].name).replace(/\/\//g, "/"), files[i].content);
}
}
module.exports = {pack: pack, unpack: unpack}

48
node_modules/svrmodpack/package.json generated vendored
View file

@ -1,48 +0,0 @@
{
"_from": "svrmodpack",
"_id": "svrmodpack@1.0.0",
"_inBundle": false,
"_integrity": "sha512-17SjkfDtZL3KOGjzLTT/nEZzCuvD4rz07y4UFVXfo/Xo0qTMwgICnDSIEOonaAs1GdzZe0hiJxkPYvdTKQifwg==",
"_location": "/svrmodpack",
"_phantomChildren": {},
"_requested": {
"type": "tag",
"registry": true,
"raw": "svrmodpack",
"name": "svrmodpack",
"escapedName": "svrmodpack",
"rawSpec": "",
"saveSpec": null,
"fetchSpec": "latest"
},
"_requiredBy": [
"#USER",
"/"
],
"_resolved": "https://registry.npmjs.org/svrmodpack/-/svrmodpack-1.0.0.tgz",
"_shasum": "412def1c6ff93a7a15849519411a30b3281ee822",
"_spec": "svrmodpack",
"_where": "/media/serveradmin/Server/developement",
"author": {
"name": "Dorian Niemiec",
"email": "niemiecdorian2008@gmail.com"
},
"bugs": {
"url": "https://github.com/dorian-tech/svrmodpack/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "DorianTech SVR.JS Mods packer/unpacker library ",
"homepage": "https://github.com/dorian-tech/svrmodpack#readme",
"license": "GPL-3.0-or-later",
"main": "index.js",
"name": "svrmodpack",
"repository": {
"type": "git",
"url": "git+https://github.com/dorian-tech/svrmodpack.git"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"version": "1.0.0"
}

817
svr.js

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>SVR.JS 3.12.3 Tests</title>
<title>SVR.JS 3.13.0 Tests</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta charset="UTF-8" />
<style>
@ -12,7 +12,7 @@
</style>
</head>
<body>
<h1>SVR.JS 3.12.3 Tests</h1>
<h1>SVR.JS 3.13.0 Tests</h1>
<h2>Directory (without trailing slash)</h2>
<iframe src="/testdir" width="50%" height="300px"></iframe>
<h2>Directory (with query)</h2>