aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/misc.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/misc.ts
parent9901c8d6908a43ab4594406446eac770ee21176c (diff)
downloadPeerTube-97583d00235d5e8f29d9c49ca13096521e394aa4.tar.gz
PeerTube-97583d00235d5e8f29d9c49ca13096521e394aa4.tar.zst
PeerTube-97583d00235d5e8f29d9c49ca13096521e394aa4.zip
Add more rate limits
Diffstat (limited to 'server/controllers/misc.ts')
-rw-r--r--server/controllers/misc.ts6
1 files changed, 5 insertions, 1 deletions
diff --git a/server/controllers/misc.ts b/server/controllers/misc.ts
index 163352ac5..a7dfc7867 100644
--- a/server/controllers/misc.ts
+++ b/server/controllers/misc.ts
@@ -7,7 +7,7 @@ import { HttpStatusCode } from '@shared/models'
7import { HttpNodeinfoDiasporaSoftwareNsSchema20 } from '../../shared/models/nodeinfo/nodeinfo.model' 7import { HttpNodeinfoDiasporaSoftwareNsSchema20 } from '../../shared/models/nodeinfo/nodeinfo.model'
8import { CONSTRAINTS_FIELDS, DEFAULT_THEME_NAME, PEERTUBE_VERSION, ROUTE_CACHE_LIFETIME } from '../initializers/constants' 8import { CONSTRAINTS_FIELDS, DEFAULT_THEME_NAME, PEERTUBE_VERSION, ROUTE_CACHE_LIFETIME } from '../initializers/constants'
9import { getThemeOrDefault } from '../lib/plugins/theme-utils' 9import { getThemeOrDefault } from '../lib/plugins/theme-utils'
10import { asyncMiddleware } from '../middlewares' 10import { apiRateLimiter, asyncMiddleware } from '../middlewares'
11import { cacheRoute } from '../middlewares/cache/cache' 11import { cacheRoute } from '../middlewares/cache/cache'
12import { UserModel } from '../models/user/user' 12import { UserModel } from '../models/user/user'
13import { VideoModel } from '../models/video/video' 13import { VideoModel } from '../models/video/video'
@@ -18,12 +18,14 @@ const miscRouter = express.Router()
18miscRouter.use(cors()) 18miscRouter.use(cors())
19 19
20miscRouter.use('/nodeinfo/:version.json', 20miscRouter.use('/nodeinfo/:version.json',
21 apiRateLimiter,
21 cacheRoute(ROUTE_CACHE_LIFETIME.NODEINFO), 22 cacheRoute(ROUTE_CACHE_LIFETIME.NODEINFO),
22 asyncMiddleware(generateNodeinfo) 23 asyncMiddleware(generateNodeinfo)
23) 24)
24 25
25// robots.txt service 26// robots.txt service
26miscRouter.get('/robots.txt', 27miscRouter.get('/robots.txt',
28 apiRateLimiter,
27 cacheRoute(ROUTE_CACHE_LIFETIME.ROBOTS), 29 cacheRoute(ROUTE_CACHE_LIFETIME.ROBOTS),
28 (_, res: express.Response) => { 30 (_, res: express.Response) => {
29 res.type('text/plain') 31 res.type('text/plain')
@@ -33,12 +35,14 @@ miscRouter.get('/robots.txt',
33) 35)
34 36
35miscRouter.all('/teapot', 37miscRouter.all('/teapot',
38 apiRateLimiter,
36 getCup, 39 getCup,
37 asyncMiddleware(serveIndexHTML) 40 asyncMiddleware(serveIndexHTML)
38) 41)
39 42
40// security.txt service 43// security.txt service
41miscRouter.get('/security.txt', 44miscRouter.get('/security.txt',
45 apiRateLimiter,
42 (_, res: express.Response) => { 46 (_, res: express.Response) => {
43 return res.redirect(HttpStatusCode.MOVED_PERMANENTLY_301, '/.well-known/security.txt') 47 return res.redirect(HttpStatusCode.MOVED_PERMANENTLY_301, '/.well-known/security.txt')
44 } 48 }