File server.ts
has 1109 lines of code (exceeds 250 allowed). Consider refactoring. Open
"use strict";
/**
* Import interfaces
*/
import IWindow from "../../interfaces/IWindow";
- Create a ticketCreate a ticket
Function Proxy
has 261 lines of code (exceeds 25 allowed). Consider refactoring. Open
public Proxy(result, headers, request, response, depth = 5) {
try {
if (
this.Settings.XAccelRedirect &&
result.Data.link.indexOf(".css") === -1
- Create a ticketCreate a ticket
Function Proxy
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
public Proxy(result, headers, request, response, depth = 5) {
try {
if (
this.Settings.XAccelRedirect &&
result.Data.link.indexOf(".css") === -1
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function doProxy
has 148 lines of code (exceeds 25 allowed). Consider refactoring. Open
const doProxy = () => {
if (this.proxyShit[result.Data.link]) {
redirectProxy();
} else {
const url = URL.parse(result.Data.link);
- Create a ticketCreate a ticket
Function Respond
has 137 lines of code (exceeds 25 allowed). Consider refactoring. Open
public Respond(result, headers, request, response) {
try {
headers["Cache-Control"] = "no-cache";
let resp = "";
switch (result.Params.Transport) {
- Create a ticketCreate a ticket
Function processor
has 126 lines of code (exceeds 25 allowed). Consider refactoring. Open
public processor(data, params, request, headers) {
return new Promise((resolve, reject) => {
this.decode(data, this.Settings.Password).then(
(_data: any) => {
if (
- Create a ticketCreate a ticket
Function listenr
has 115 lines of code (exceeds 25 allowed). Consider refactoring. Open
public listenr(request, response) {
this.AcceptEncoding = request.headers["accept-encoding"] || "";
const headers = Object.assign({}, baseHeaders);
- Create a ticketCreate a ticket
Function req
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
const req = (options.port === 443 ? HTTPS : HTTP).request(options, (res) => {
clearTimeout(proxyConnectionTimeout);
res.on("error", (_err) => {
redirectProxy();
- Create a ticketCreate a ticket
Function Respond
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public Respond(result, headers, request, response) {
try {
headers["Cache-Control"] = "no-cache";
let resp = "";
switch (result.Params.Transport) {
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Server
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
export default class Server extends Transport {
/**
* Get choice ID
* @param choiceType
- Create a ticketCreate a ticket
Function download
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
public download(data, headers, request, depth = 3) {
return new Promise((resolve, reject) => {
const url = URL.parse(data.link);
url.port = url.port || url.protocol === "https:" ? 443 : 80;
- Create a ticketCreate a ticket
Function encodeSync
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public encodeSync(data: any, password: string) {
if (
this.cryptoModule === "" ||
this.cryptoModule === "base64salt"
) {
- Create a ticketCreate a ticket
Function preprocessor
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public preprocessor(request) {
return new Promise((resolve, reject) => {
const data = [];
/**
* Get data from url
- Create a ticketCreate a ticket
Function encodeSync
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public encodeSync(data: any, password: string) {
if (
this.cryptoModule === "" ||
this.cryptoModule === "base64salt"
) {
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function redirectProxy
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
const redirectProxy = () => {
if (
result.Data.link.indexOf(".css") === -1 &&
result.Data.link.indexOf("yandex") === -1
) {
- Create a ticketCreate a ticket
Function decodeSync
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public decodeSync(data: any, password: string) {
try {
let dec = decodeURIComponent(global.escape(Buffer.from(data, "base64").toString("utf8"))).split("@");
dec.shift();
dec = JSON.parse(dec.join("@"));
- Create a ticketCreate a ticket
Function listenr
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public listenr(request, response) {
this.AcceptEncoding = request.headers["accept-encoding"] || "";
const headers = Object.assign({}, baseHeaders);
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function responceError
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public responceError(id, request, response, headers, e?, ...data) {
this.ErrorHandler(e, id, data);
if (request.headers["x-real-404"]) {
const url = URL.parse(request.headers["x-real-404"]);
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
} else if (
(
res.statusCode === 301 ||
res.statusCode === 302
) &&
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if (e) {
doRedirect();
} else {
response.writeHead(this.Settings.SuccessResponseCode, JSON.parse(_headers));
FS.createReadStream(CachePathBody).pipe(response);
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if (!response.answered) {
response.answered = true;
FS.readFile(CachePathHeaders, "utf-8", (e, _headers) => {
try {
if (e) {
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if (
this.Settings.MaxProxySize &&
res.headers["content-length"] &&
parseInt(res.headers["content-length"], 10) > this.Settings.MaxProxySize &&
result.Data.link.indexOf(".css") === -1 &&
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if (
this.listners["proxy"]
) {
new Promise(
(_resolve) => {
- Create a ticketCreate a ticket
Function getHostFromHeaderXRealHost
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public getHostFromHeaderXRealHost(request, params) {
if (request.headers["x-real-host"]) {
let origin;
if (request.headers["x-real-host"].indexOf("http") === -1) {
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this function. Open
return data;
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return null;
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return dec;
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return false;
- Create a ticketCreate a ticket
Function getHostFromHeaderOrigin
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public getHostFromHeaderOrigin(request, params) {
if (request.headers.origin) {
let origin;
if (request.headers.origin.indexOf("http") === -1) {
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function responceError
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public responceError(id, request, response, headers, e?, ...data) {
this.ErrorHandler(e, id, data);
if (request.headers["x-real-404"]) {
const url = URL.parse(request.headers["x-real-404"]);
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function decodeSync
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public decodeSync(data: any, password: string) {
try {
let dec = decodeURIComponent(global.escape(Buffer.from(data, "base64").toString("utf8"))).split("@");
dec.shift();
dec = JSON.parse(dec.join("@"));
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getHostFromHeaderHost
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public getHostFromHeaderHost(request, params) {
if (request.headers.host) {
let origin;
if (request.headers.host.indexOf("http") === -1) {
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getHostFromParamsReferer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public getHostFromParamsReferer(request, params) {
if (params.Refferer) {
let origin;
if (params.Refferer.indexOf("http") === -1) {
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getHostFromHeaderReferer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public getHostFromHeaderReferer(request, params) {
if (request.headers.referer) {
let origin;
if (request.headers.referer.indexOf("http") === -1) {
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"