Fix issue#1

This commit is contained in:
fullgream 2025-01-23 19:31:47 +03:00
parent 8a6ef2d403
commit 426f7881e5
6 changed files with 21 additions and 5 deletions

View File

@ -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 = [];

View File

@ -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);
});

View File

@ -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);
});

View File

@ -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);
});

View File

@ -126,7 +126,7 @@ function readInstructions (instructions, fullCode, forDomains=false) {
}
function logger (...p) {
return;
//return;
console.debug("[DEBUG.routemap]:", ...p);
}

View File

@ -26,7 +26,7 @@
type redirectHTTP;
target https://duckduckgo.com;
domain localhost {
type redirectHTTP;
type revHTTP;
target https://google.com;
}
}