aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/feeds/index.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-07-25 15:18:10 +0200
committerChocobozzz <me@florianbigard.com>2023-07-26 08:37:50 +0200
commit97583d00235d5e8f29d9c49ca13096521e394aa4 (patch)
tree5f29ba8c8e5b2d2653a1173408151bb64f6a80a9 /server/controllers/feeds/index.ts
parent9901c8d6908a43ab4594406446eac770ee21176c (diff)
downloadPeerTube-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.ts15
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 @@
1import express from 'express' 1import express from 'express'
2import { CONFIG } from '@server/initializers/config'
3import { buildRateLimiter } from '@server/middlewares'
2import { commentFeedsRouter } from './comment-feeds' 4import { commentFeedsRouter } from './comment-feeds'
3import { videoFeedsRouter } from './video-feeds' 5import { videoFeedsRouter } from './video-feeds'
4import { videoPodcastFeedsRouter } from './video-podcast-feeds' 6import { videoPodcastFeedsRouter } from './video-podcast-feeds'
5 7
6const feedsRouter = express.Router() 8const feedsRouter = express.Router()
7 9
8feedsRouter.use('/', commentFeedsRouter) 10const feedsRateLimiter = buildRateLimiter({
9feedsRouter.use('/', videoFeedsRouter) 11 windowMs: CONFIG.RATES_LIMIT.FEEDS.WINDOW_MS,
10feedsRouter.use('/', videoPodcastFeedsRouter) 12 max: CONFIG.RATES_LIMIT.FEEDS.MAX
13})
14
15feedsRouter.use('/feeds', feedsRateLimiter)
16
17feedsRouter.use('/feeds', commentFeedsRouter)
18feedsRouter.use('/feeds', videoFeedsRouter)
19feedsRouter.use('/feeds', videoPodcastFeedsRouter)
11 20
12// --------------------------------------------------------------------------- 21// ---------------------------------------------------------------------------
13 22