diff options
author | Chocobozzz <me@florianbigard.com> | 2023-07-25 15:18:10 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-07-26 08:37:50 +0200 |
commit | 97583d00235d5e8f29d9c49ca13096521e394aa4 (patch) | |
tree | 5f29ba8c8e5b2d2653a1173408151bb64f6a80a9 /server/controllers/feeds/index.ts | |
parent | 9901c8d6908a43ab4594406446eac770ee21176c (diff) | |
download | PeerTube-97583d00235d5e8f29d9c49ca13096521e394aa4.tar.gz PeerTube-97583d00235d5e8f29d9c49ca13096521e394aa4.tar.zst PeerTube-97583d00235d5e8f29d9c49ca13096521e394aa4.zip |
Add more rate limits
Diffstat (limited to 'server/controllers/feeds/index.ts')
-rw-r--r-- | server/controllers/feeds/index.ts | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/server/controllers/feeds/index.ts b/server/controllers/feeds/index.ts index e344a1448..19352318d 100644 --- a/server/controllers/feeds/index.ts +++ b/server/controllers/feeds/index.ts | |||
@@ -1,13 +1,22 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { CONFIG } from '@server/initializers/config' | ||
3 | import { buildRateLimiter } from '@server/middlewares' | ||
2 | import { commentFeedsRouter } from './comment-feeds' | 4 | import { commentFeedsRouter } from './comment-feeds' |
3 | import { videoFeedsRouter } from './video-feeds' | 5 | import { videoFeedsRouter } from './video-feeds' |
4 | import { videoPodcastFeedsRouter } from './video-podcast-feeds' | 6 | import { videoPodcastFeedsRouter } from './video-podcast-feeds' |
5 | 7 | ||
6 | const feedsRouter = express.Router() | 8 | const feedsRouter = express.Router() |
7 | 9 | ||
8 | feedsRouter.use('/', commentFeedsRouter) | 10 | const feedsRateLimiter = buildRateLimiter({ |
9 | feedsRouter.use('/', videoFeedsRouter) | 11 | windowMs: CONFIG.RATES_LIMIT.FEEDS.WINDOW_MS, |
10 | feedsRouter.use('/', videoPodcastFeedsRouter) | 12 | max: CONFIG.RATES_LIMIT.FEEDS.MAX |
13 | }) | ||
14 | |||
15 | feedsRouter.use('/feeds', feedsRateLimiter) | ||
16 | |||
17 | feedsRouter.use('/feeds', commentFeedsRouter) | ||
18 | feedsRouter.use('/feeds', videoFeedsRouter) | ||
19 | feedsRouter.use('/feeds', videoPodcastFeedsRouter) | ||
11 | 20 | ||
12 | // --------------------------------------------------------------------------- | 21 | // --------------------------------------------------------------------------- |
13 | 22 | ||