Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

Commit

Permalink
remove: old ratelimiting that didn't work properly anyways
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Moore committed Sep 30, 2023
1 parent 5f09cb0 commit 5dc3aa4
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 81 deletions.
61 changes: 0 additions & 61 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
"cssnano": "^6.0.1",
"escape-html": "^1.0.3",
"express": "^4.18.2",
"express-brute": "^1.0.1",
"express-busboy": "^10.1.0",
"ffmpeg-static": "^5.2.0",
"fs-extra": "^11.1.1",
Expand All @@ -84,7 +83,6 @@
"@types/bcrypt": "^5.0.0",
"@types/escape-html": "^1.0.1",
"@types/express": "^4.17.13",
"@types/express-brute": "^1.0.1",
"@types/express-busboy": "^8.0.0",
"@types/ffmpeg-static": "^3.0.0",
"@types/fs-extra": "^9.0.12",
Expand Down
18 changes: 0 additions & 18 deletions src/ass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,24 +59,6 @@ app.disable('x-powered-by');
app.set('trust proxy', isProxied);
app.set('view engine', 'pug');

// Rate limiting using express-brute
// ! Notice !
// The rate limiting used here is very trivial and should be used with caution.
// I plan to improve this in the future somehow (possibly with redis, who knows).
// - tycrek, 2022-08-18
// todo: fix this eventually
import ExpressBrute from 'express-brute';
const bruteforce = new ExpressBrute(new ExpressBrute.MemoryStore(), {
freeRetries: 50,
minWait: 50, // 50ms
maxWait: 500, // 500ms
lifetime: 5, // 5 seconds
failCallback: (_req, res, _next, _nextValidRequestDate) => res.sendStatus(429),
});

// Routes to protect
app.get(['/'], bruteforce.prevent, (_req, _res, next) => next());

// Express logger middleware
// app.use(log.middleware());

Expand Down

0 comments on commit 5dc3aa4

Please sign in to comment.