From 426f7881e59002a7dcb074c1567ac292d5e01213 Mon Sep 17 00:00:00 2001 From: fullgream Date: Thu, 23 Jan 2025 19:31:47 +0300 Subject: [PATCH] Fix issue#1 --- components/_http.js | 4 ++++ components/http-redirector.js | 6 +++++- components/http-reverse.js | 6 +++++- components/http-simple.js | 6 +++++- routemap-parser.js | 2 +- routemap.txt | 2 +- 6 files changed, 21 insertions(+), 5 deletions(-) diff --git a/components/_http.js b/components/_http.js index 94d5a00..db92a1e 100644 --- a/components/_http.js +++ b/components/_http.js @@ -191,6 +191,10 @@ function simpleHTTP (staticPath, req, res, dirContentFlag = false) { } module.exports = class HTTPServer extends Component { + static type () { + return null; + } + constructor (adr, syntaxTree) { super(adr, syntaxTree); this.routelist = []; diff --git a/components/http-redirector.js b/components/http-redirector.js index 3b92367..87be100 100644 --- a/components/http-redirector.js +++ b/components/http-redirector.js @@ -7,6 +7,10 @@ function logger (...p) { } module.exports = class HTTPRedirector extends HTTPServer { + static type () { + return "redirect"; + } + constructor (adr, syntaxTree) { super(adr, syntaxTree); } @@ -23,7 +27,7 @@ module.exports = class HTTPRedirector extends HTTPServer { if (!isNotDomained) { return this .callDomain(currentDomain, this.syntax.domains[currentDomain]) - .argv("redirect", req, res); + .argv(this.syntax.domains[currentDomain].Type.type(), req, res); } return redirectPage(redirectTo, req, res); }); diff --git a/components/http-reverse.js b/components/http-reverse.js index d18e63a..0121f4d 100644 --- a/components/http-reverse.js +++ b/components/http-reverse.js @@ -7,6 +7,10 @@ function logger (...p) { } module.exports = class HTTPReverse extends HTTPServer { + static type () { + return "proxy"; + } + constructor (adr, syntaxTree) { super(adr, syntaxTree); } @@ -24,7 +28,7 @@ module.exports = class HTTPReverse extends HTTPServer { if (!isNotDomained) { return this .callDomain(currentDomain, this.syntax.domains[currentDomain]) - .argv("proxy", req, res); + .argv(this.syntax.domains[currentDomain].Type.type(), req, res); } return fetchProxy(req, res, reverseTo); }); diff --git a/components/http-simple.js b/components/http-simple.js index 99a9710..2374a05 100644 --- a/components/http-simple.js +++ b/components/http-simple.js @@ -8,6 +8,10 @@ function logger (...p) { } module.exports = class HTTPRedirector extends HTTPServer { + static type () { + return "shttp"; + } + constructor (adr, syntaxTree) { super(adr, syntaxTree); } @@ -24,7 +28,7 @@ module.exports = class HTTPRedirector extends HTTPServer { if (!isNotDomained) { return this .callDomain(currentDomain, this.syntax.domains[currentDomain]) - .argv("shttp", req, res); + .argv(this.syntax.domains[currentDomain].Type.type(), req, res); } return simpleHTTP(redirectTo, req, res, !!this.syntax.showDir); }); diff --git a/routemap-parser.js b/routemap-parser.js index c5cfbdc..0d2680a 100644 --- a/routemap-parser.js +++ b/routemap-parser.js @@ -126,7 +126,7 @@ function readInstructions (instructions, fullCode, forDomains=false) { } function logger (...p) { - return; + //return; console.debug("[DEBUG.routemap]:", ...p); } diff --git a/routemap.txt b/routemap.txt index 162186e..ff0158d 100644 --- a/routemap.txt +++ b/routemap.txt @@ -26,7 +26,7 @@ type redirectHTTP; target https://duckduckgo.com; domain localhost { - type redirectHTTP; + type revHTTP; target https://google.com; } }