Fix api rate limit
This commit is contained in:
parent
3cac8a756f
commit
02596be702
|
@ -96,10 +96,8 @@ describe('Test application behind a reverse proxy', function () {
|
|||
it('Should rate limit logins', async function () {
|
||||
const user = { username: 'root', password: 'fail' }
|
||||
|
||||
for (let i = 0; i < 20; i++) {
|
||||
try {
|
||||
await server.login.login({ user, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
|
||||
} catch {}
|
||||
for (let i = 0; i < 18; i++) {
|
||||
await server.login.login({ user, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
|
||||
}
|
||||
|
||||
await server.login.login({ user, expectedStatus: HttpStatusCode.TOO_MANY_REQUESTS_429 })
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import express from 'express'
|
||||
import { FileStorage, HttpStatusCode, UserExportRequest, UserExportRequestResult, UserExportState } from '@peertube/peertube-models'
|
||||
import {
|
||||
apiRateLimiter,
|
||||
asyncMiddleware,
|
||||
authenticate,
|
||||
userExportDeleteValidator,
|
||||
|
@ -16,8 +15,6 @@ import { CONFIG } from '@server/initializers/config.js'
|
|||
|
||||
const userExportsRouter = express.Router()
|
||||
|
||||
userExportsRouter.use(apiRateLimiter)
|
||||
|
||||
userExportsRouter.post('/:userId/exports/request',
|
||||
authenticate,
|
||||
asyncMiddleware(userExportRequestValidator),
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import express from 'express'
|
||||
import {
|
||||
apiRateLimiter,
|
||||
asyncMiddleware,
|
||||
authenticate
|
||||
} from '../../../middlewares/index.js'
|
||||
|
@ -20,8 +19,6 @@ import { saveInTransactionWithRetries } from '@server/helpers/database-utils.js'
|
|||
|
||||
const userImportRouter = express.Router()
|
||||
|
||||
userImportRouter.use(apiRateLimiter)
|
||||
|
||||
userImportRouter.post('/:userId/imports/import-resumable',
|
||||
authenticate,
|
||||
asyncMiddleware(userImportRequestResumableInitValidator),
|
||||
|
|
Loading…
Reference in New Issue