minor changes & build
This commit is contained in:
parent
3b40cc05c3
commit
c3f7b35c99
7 changed files with 17 additions and 14 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -3,3 +3,4 @@ dist
|
|||
config.juml
|
||||
.vscode
|
||||
test
|
||||
build
|
8
package-lock.json
generated
8
package-lock.json
generated
|
@ -12,7 +12,7 @@
|
|||
"auth-header": "^1.0.0",
|
||||
"commander": "^10.0.0",
|
||||
"cors": "^2.8.5",
|
||||
"dblang": "https://jusax.de/git/attachments/c13552b7-c9f0-4f50-bcce-96a124c1c286",
|
||||
"dblang": "https://jusax.de/git/attachments/f23f8128-4fde-4ec6-a8cd-cfc5068b2cfd",
|
||||
"express": "^4.18.2",
|
||||
"juml": "https://jusax.de/git/attachments/208913c5-2851-4b86-a53d-ca99fed168cc",
|
||||
"nman": "https://jusax.de/git/attachments/5333948b-fe6b-45d2-9230-ca388f6a89bc",
|
||||
|
@ -1101,9 +1101,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/dblang": {
|
||||
"version": "0.7.0",
|
||||
"resolved": "https://jusax.de/git/attachments/c13552b7-c9f0-4f50-bcce-96a124c1c286",
|
||||
"integrity": "sha512-NU4INAcpQKMWcBE59wGO+4BRsJqEYHA+IbsQhr6OYqNUPw5a+LSAEr4coAZ9UHqewZaX10+20oJ1dkIADzzeCQ==",
|
||||
"version": "0.8.0",
|
||||
"resolved": "https://jusax.de/git/attachments/f23f8128-4fde-4ec6-a8cd-cfc5068b2cfd",
|
||||
"integrity": "sha512-hHfxa5iHD3fumMzH/LvVwB2kPUfs1TsxRdOS1veIppfgsJNUxqxPdEljd+EluWpHrPklfO3AJr2vWiZe4N0NBg==",
|
||||
"license": "UNLICENSED",
|
||||
"dependencies": {
|
||||
"gitea-release": "git+https://jusax.de/git/jusax23/gitea-release.git",
|
||||
|
|
|
@ -7,7 +7,9 @@
|
|||
"scripts": {
|
||||
"main": "tsc && node . -c config.juml",
|
||||
"debug": "tsc && node . -c config.juml -d",
|
||||
"setup": "tsc && node . -c config.juml -s"
|
||||
"setup": "tsc && node . -c config.juml -s",
|
||||
"bundleRelease": "mkdir build/bundle & esbuild src/main.ts --platform=node --bundle --minify --outfile=build/bundle/main.js",
|
||||
"build-linux-x64": "npm run bundleRelease && mkdir build/bin & pkg -t node18-linux-x64 -o build/bin/outbag-linux-x64 build/bundle/main.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -34,7 +36,7 @@
|
|||
"auth-header": "^1.0.0",
|
||||
"commander": "^10.0.0",
|
||||
"cors": "^2.8.5",
|
||||
"dblang": "https://jusax.de/git/attachments/c13552b7-c9f0-4f50-bcce-96a124c1c286",
|
||||
"dblang": "https://jusax.de/git/attachments/f23f8128-4fde-4ec6-a8cd-cfc5068b2cfd",
|
||||
"express": "^4.18.2",
|
||||
"juml": "https://jusax.de/git/attachments/208913c5-2851-4b86-a53d-ca99fed168cc",
|
||||
"nman": "https://jusax.de/git/attachments/5333948b-fe6b-45d2-9230-ca388f6a89bc",
|
||||
|
|
0
src/api/helper.ts
Normal file
0
src/api/helper.ts
Normal file
|
@ -103,9 +103,9 @@ export function checktype(data: any, type: string) {
|
|||
return true;
|
||||
} else if (type == "name" && typeof data == "string" && /^[a-zA-Z0-9\-_.]+$/.test(data)) {
|
||||
return true;
|
||||
} else if (type.startsWith("name-") && typeof data == "string" && /^[a-zA-Z0-9\-_.]+$/.test(data)) {
|
||||
} else if (typeof data == "string" && type.startsWith("name-") && /^[a-zA-Z0-9\-_.]+$/.test(data)) {
|
||||
return parseInt(type.split("-")[1]) >= data.length;
|
||||
} else if (type.startsWith("string-") && typeof data == "string") {
|
||||
} else if (typeof data == "string" && type.startsWith("string-")) {
|
||||
return parseInt(type.split("-")[1]) >= data.length;
|
||||
} else if (type == "any") {
|
||||
return true;
|
||||
|
|
|
@ -299,7 +299,7 @@ const setupFunc = async (func: () => Promise<boolean>, name: string) => {
|
|||
|
||||
export const partiellSetup = async () => {
|
||||
while (true) {
|
||||
log("Setup", "Slection:");
|
||||
log("Setup", "Selection:");
|
||||
const resp = await prompts({
|
||||
type: 'select',
|
||||
name: 'value',
|
||||
|
|
|
@ -19,11 +19,11 @@ export const addBruteforcePotantial = (ip: string) => {
|
|||
if (bruteforcedata[ip].n > maxSus) {
|
||||
log("Bruteforce Protection", "blocking ip: ", ip);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const bruteforcecheck = (ip: string) => {
|
||||
return (bruteforcedata[ip]?.n || 0) <= maxSus || uts() - (bruteforcedata[ip]?.t || uts()) > timeout;
|
||||
}
|
||||
};
|
||||
|
||||
var bruteforcedatacleaner = setInterval(async () => {
|
||||
var utst = uts();
|
||||
|
@ -40,7 +40,7 @@ addShutdownTask(() => clearInterval(bruteforcedatacleaner), 5000);
|
|||
|
||||
export interface suspectRequest extends express.Request {
|
||||
suspect?: () => void
|
||||
}
|
||||
};
|
||||
|
||||
export default (req: suspectRequest, res: express.Response, next: express.NextFunction) => {
|
||||
if (!bruteforcecheck(req.ip)) return void res.status(400).send("bruteforce");
|
||||
|
@ -48,4 +48,4 @@ export default (req: suspectRequest, res: express.Response, next: express.NextFu
|
|||
addBruteforcePotantial(req.ip);
|
||||
};
|
||||
next();
|
||||
}
|
||||
};
|
Loading…
Reference in a new issue