From bf3b002190e95db257076ce26d6fb1a0e11eed49 Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Fri, 1 Sep 2023 01:13:15 +0200 Subject: [PATCH] Optimize filterHeaders and add checkHostname and checkHref --- config.json | 4 ++-- svr.js | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/config.json b/config.json index 3ce875b..7bb3448 100644 --- a/config.json +++ b/config.json @@ -3,7 +3,7 @@ "port": 80, "pubport": 80, "page404": "404.html", - "timestamp": 1693515753863, + "timestamp": 1693523365373, "blacklist": [], "nonStandardCodes": [], "enableCompression": true, @@ -91,4 +91,4 @@ "disableUnusedWorkerTermination": false, "rewriteDirtyURLs": true, "errorPages": [] -} +} \ No newline at end of file diff --git a/svr.js b/svr.js index 35d7dd1..c1f967f 100644 --- a/svr.js +++ b/svr.js @@ -1470,7 +1470,7 @@ if (!disableMods) { if (fs.existsSync("./serverSideScript.js") && fs.statSync("./serverSideScript.js").isFile()) { try { // Prepend necessary modules and variables to the custom server side script - var modhead = "var readline = require('readline');\r\nvar os = require('os');\r\nvar http = require('http');\r\nvar url = require('url');\r\nvar fs = require('fs');\r\nvar path = require('path');\r\n" + (hexstrbase64 === undefined ? "" : "var hexstrbase64 = require('../hexstrbase64/index.js');\r\n") + (crypto.__disabled__ === undefined ? "var crypto = require('crypto');\r\nvar https = require('https');\r\n" : "") + "var stream = require('stream');\r\nvar customvar1;\r\nvar customvar2;\r\nvar customvar3;\r\nvar customvar4;\r\n\r\nfunction Mod() {}\r\nMod.prototype.callback = function callback(req, res, serverconsole, responseEnd, href, ext, uobject, search, defaultpage, users, page404, head, foot, fd, elseCallback, configJSON, callServerError, getCustomHeaders, origHref, redirect, parsePostData) {\r\nreturn function () {\r\nvar disableEndElseCallbackExecute = false;\r\nfunction filterHeaders(headers){for(var jsn=JSON.stringify(headers,null,2).split('\\n'),njsn=[\"{\"],i=1;i