1
0
Fork 0
forked from svrjs/svrjs

Update to SVR.JS 3.7.5

This commit is contained in:
Dorian Niemiec 2023-08-29 15:34:17 +02:00
parent 750a312b2f
commit 55262f73c5
5 changed files with 69 additions and 65 deletions

View file

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2020 DorianTech S.A. Copyright (c) 2020-2023 DorianTech
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View file

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>SVR.JS 3.7.4</title> <title>SVR.JS 3.7.5</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>
@ -12,7 +12,7 @@
</style> </style>
</head> </head>
<body> <body>
<h1>Welcome to SVR.JS 3.7.4</h1> <h1>Welcome to SVR.JS 3.7.5</h1>
<br/> <br/>
<img src="/logo.png" style="width: 256px;" /> <img src="/logo.png" style="width: 256px;" />
<br/> <br/>
@ -42,7 +42,7 @@
&nbsp;&nbsp;"rewriteMap": [<br/> &nbsp;&nbsp;"rewriteMap": [<br/>
&nbsp;&nbsp;&nbsp;&nbsp;{<br/> &nbsp;&nbsp;&nbsp;&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"definingRegex": "/\\/invoke500\\/\\?/",<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"definingRegex": "/\\/invoke500\\/\\?/",<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"replacements": dorians[<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"replacements": [<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"regex": "/\\/invoke500\\/\\?/",<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"regex": "/\\/invoke500\\/\\?/",<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"replacement": "/invoke500.svr?"<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"replacement": "/invoke500.svr?"<br/>
@ -110,7 +110,8 @@
</div> </div>
<p>Changes:</p> <p>Changes:</p>
<ul> <ul>
<li>Added reverse DNS lookup support.</li> <li>Fixed non-working blacklist.</li>
<li>Updated SVR.JS license.</li>
</ul> </ul>
<p>Bugs:</p> <p>Bugs:</p>
<ul> <ul>

View file

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>SVR.JS 3.7.4 Licenses</title> <title>SVR.JS 3.7.5 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>
@ -12,12 +12,12 @@
</style> </style>
</head> </head>
<body> <body>
<h1>SVR.JS 3.7.4 Licenses</h1> <h1>SVR.JS 3.7.5 Licenses</h1>
<h2>SVR.JS 3.7.4</h2> <h2>SVR.JS 3.7.5</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/>
Copyright (c) 2020 DorianTech S.A.<br/> Copyright (c) 2020-2023 DorianTech<br/>
<br/> <br/>
Permission is hereby granted, free of charge, to any person obtaining a copy<br/> Permission is hereby granted, free of charge, to any person obtaining a copy<br/>
of this software and associated documentation files (the "Software"), to deal<br/> of this software and associated documentation files (the "Software"), to deal<br/>
@ -37,7 +37,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.7.4 and utilities</h2> <h2>Packages used by SVR.JS 3.7.5 and utilities</h2>
<div style="width: 100%; background-color: #ccc; border: 1px solid green; text-align: left; margin: 10px 0;"> <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="float: right;">License: MIT</div>
<div style="font-size: 20px;"> <div style="font-size: 20px;">

25
svr.js
View file

@ -15,7 +15,7 @@
/* /*
* MIT License * MIT License
* *
* Copyright (c) 2020 DorianTech S.A. * Copyright (c) 2020-2023 DorianTech
* *
* 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: * 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:
* *
@ -81,7 +81,7 @@ function deleteFolderRecursive(path) {
} }
var os = require("os"); var os = require("os");
var version = "3.7.4"; var version = "3.7.5";
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
@ -666,6 +666,9 @@ function ipBlockList(rawBlockList) {
// Function to add an IP or CIDR block to the block list // Function to add an IP or CIDR block to the block list
instance.add = function (rawValue) { instance.add = function (rawValue) {
// Add to raw block list
instance.raw.push(rawValue);
// Initialize variables // Initialize variables
var beginIndex = instance.prepared.length; var beginIndex = instance.prepared.length;
var cidrIndex = instance.cidrs.length; var cidrIndex = instance.cidrs.length;
@ -1061,15 +1064,15 @@ var blacklist = ipBlockList(rawBlackList);
var nonStandardCodes = []; var nonStandardCodes = [];
nonStandardCodesRaw.forEach(function (nonStandardCodeRaw) { nonStandardCodesRaw.forEach(function (nonStandardCodeRaw) {
var nO = {}; var newObject = {};
Object.keys(nonStandardCodeRaw).forEach(function (nsKey) { Object.keys(nonStandardCodeRaw).forEach(function (nsKey) {
if (nsKey != "users") { if (nsKey != "users") {
nO[nsKey] = nonStandardCodeRaw[nsKey]; newObject[nsKey] = nonStandardCodeRaw[nsKey];
} else { } else {
nO["users"] = ipBlockList(nonStandardCodeRaw.users); newObject["users"] = ipBlockList(nonStandardCodeRaw.users);
} }
}); });
nonStandardCodes.push(nO); nonStandardCodes.push(newObject);
}); });
var customHeaders = (configJSON.customHeaders == undefined ? {} : JSON.parse(JSON.stringify(configJSON.customHeaders))); var customHeaders = (configJSON.customHeaders == undefined ? {} : JSON.parse(JSON.stringify(configJSON.customHeaders)));
@ -1163,13 +1166,13 @@ if (secure) {
cert = fs.readFileSync((configJSON.cert[0] != "/" && !configJSON.cert.match(/^[A-Z0-9]:\\/)) ? __dirname + "/" + configJSON.cert : configJSON.cert).toString(); cert = fs.readFileSync((configJSON.cert[0] != "/" && !configJSON.cert.match(/^[A-Z0-9]:\\/)) ? __dirname + "/" + configJSON.cert : configJSON.cert).toString();
var sniNames = Object.keys(sni); var sniNames = Object.keys(sni);
var sniCredentials = []; var sniCredentials = [];
for (var i = 0; i < sniNames.length; i++) { sniNames.forEach(function (sniName) {
sniCredentials.push({ sniCredentials.push({
name: sniNames[i], name: sniName,
cert: fs.readFileSync((sni[sniNames[i]].cert[0] != "/" && !sni[sniNames[i]].cert.match(/^[A-Z0-9]:\\/)) ? __dirname + "/" + sni[sniNames[i]].cert : sni[sniNames[i]].cert).toString(), cert: fs.readFileSync((sni[sniName].cert[0] != "/" && !sni[sniName].cert.match(/^[A-Z0-9]:\\/)) ? __dirname + "/" + sni[sniName].cert : sni[sniName].cert).toString(),
key: fs.readFileSync((sni[sniNames[i]].key[0] != "/" && !sni[sniNames[i]].key.match(/^[A-Z0-9]:\\/)) ? __dirname + "/" + sni[sniNames[i]].key : sni[sniNames[i]].key).toString() key: fs.readFileSync((sni[sniName].key[0] != "/" && !sni[sniName].key.match(/^[A-Z0-9]:\\/)) ? __dirname + "/" + sni[sniName].key : sni[sniName].key).toString()
});
}); });
}
} }
var logFile = undefined; var logFile = undefined;

View file

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>SVR.JS 3.7.4 Tests</title> <title>SVR.JS 3.7.5 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>
@ -12,7 +12,7 @@
</style> </style>
</head> </head>
<body> <body>
<h1>SVR.JS 3.7.4 Tests</h1> <h1>SVR.JS 3.7.5 Tests</h1>
<h2>Directory</h2> <h2>Directory</h2>
<iframe src="/testdir" width="50%" height="300px"></iframe> <iframe src="/testdir" width="50%" height="300px"></iframe>
<h2>Directory (with query)</h2> <h2>Directory (with query)</h2>