diff options
author | Chocobozzz <me@florianbigard.com> | 2020-02-04 10:52:05 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-02-04 10:52:05 +0100 |
commit | 9a11f73392928c81d4a478191e126d3ec754f781 (patch) | |
tree | eea4d172970fc25d1d22ebe56e00c852466e484c | |
parent | 7cd1b12c19d0589d1d692ed0571ca0800f028aea (diff) | |
download | PeerTube-9a11f73392928c81d4a478191e126d3ec754f781.tar.gz PeerTube-9a11f73392928c81d4a478191e126d3ec754f781.tar.zst PeerTube-9a11f73392928c81d4a478191e126d3ec754f781.zip |
Upgrade express-rate-limit
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | server/controllers/api/index.ts | 4 | ||||
-rw-r--r-- | server/controllers/api/users/index.ts | 2 | ||||
-rw-r--r-- | yarn.lock | 8 |
4 files changed, 6 insertions, 10 deletions
diff --git a/package.json b/package.json index 0a5484d2a..cec311a18 100644 --- a/package.json +++ b/package.json | |||
@@ -95,7 +95,7 @@ | |||
95 | "deep-object-diff": "^1.1.0", | 95 | "deep-object-diff": "^1.1.0", |
96 | "express": "^4.12.4", | 96 | "express": "^4.12.4", |
97 | "express-oauth-server": "^2.0.0", | 97 | "express-oauth-server": "^2.0.0", |
98 | "express-rate-limit": "^4.0.4", | 98 | "express-rate-limit": "^5.0.0", |
99 | "express-validator": "^6.4.0", | 99 | "express-validator": "^6.4.0", |
100 | "flat": "^5.0.0", | 100 | "flat": "^5.0.0", |
101 | "fluent-ffmpeg": "^2.1.0", | 101 | "fluent-ffmpeg": "^2.1.0", |
diff --git a/server/controllers/api/index.ts b/server/controllers/api/index.ts index 6138a32de..7bec6c527 100644 --- a/server/controllers/api/index.ts +++ b/server/controllers/api/index.ts | |||
@@ -1,5 +1,4 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import * as RateLimit from 'express-rate-limit' | ||
3 | import { configRouter } from './config' | 2 | import { configRouter } from './config' |
4 | import { jobsRouter } from './jobs' | 3 | import { jobsRouter } from './jobs' |
5 | import { oauthClientsRouter } from './oauth-clients' | 4 | import { oauthClientsRouter } from './oauth-clients' |
@@ -15,6 +14,7 @@ import { overviewsRouter } from './overviews' | |||
15 | import { videoPlaylistRouter } from './video-playlist' | 14 | import { videoPlaylistRouter } from './video-playlist' |
16 | import { CONFIG } from '../../initializers/config' | 15 | import { CONFIG } from '../../initializers/config' |
17 | import { pluginRouter } from './plugins' | 16 | import { pluginRouter } from './plugins' |
17 | import * as RateLimit from 'express-rate-limit' | ||
18 | 18 | ||
19 | const apiRouter = express.Router() | 19 | const apiRouter = express.Router() |
20 | 20 | ||
@@ -24,8 +24,6 @@ apiRouter.use(cors({ | |||
24 | credentials: true | 24 | credentials: true |
25 | })) | 25 | })) |
26 | 26 | ||
27 | // FIXME: https://github.com/nfriedly/express-rate-limit/issues/138 | ||
28 | // @ts-ignore | ||
29 | const apiRateLimiter = RateLimit({ | 27 | const apiRateLimiter = RateLimit({ |
30 | windowMs: CONFIG.RATES_LIMIT.API.WINDOW_MS, | 28 | windowMs: CONFIG.RATES_LIMIT.API.WINDOW_MS, |
31 | max: CONFIG.RATES_LIMIT.API.MAX | 29 | max: CONFIG.RATES_LIMIT.API.MAX |
diff --git a/server/controllers/api/users/index.ts b/server/controllers/api/users/index.ts index b960e80c1..0b7012537 100644 --- a/server/controllers/api/users/index.ts +++ b/server/controllers/api/users/index.ts | |||
@@ -53,8 +53,6 @@ import { Hooks } from '@server/lib/plugins/hooks' | |||
53 | 53 | ||
54 | const auditLogger = auditLoggerFactory('users') | 54 | const auditLogger = auditLoggerFactory('users') |
55 | 55 | ||
56 | // FIXME: https://github.com/nfriedly/express-rate-limit/issues/138 | ||
57 | // @ts-ignore | ||
58 | const loginRateLimiter = RateLimit({ | 56 | const loginRateLimiter = RateLimit({ |
59 | windowMs: CONFIG.RATES_LIMIT.LOGIN.WINDOW_MS, | 57 | windowMs: CONFIG.RATES_LIMIT.LOGIN.WINDOW_MS, |
60 | max: CONFIG.RATES_LIMIT.LOGIN.MAX | 58 | max: CONFIG.RATES_LIMIT.LOGIN.MAX |
@@ -2282,10 +2282,10 @@ express-oauth-server@^2.0.0: | |||
2282 | express "^4.13.3" | 2282 | express "^4.13.3" |
2283 | oauth2-server "3.0.0" | 2283 | oauth2-server "3.0.0" |
2284 | 2284 | ||
2285 | express-rate-limit@^4.0.4: | 2285 | express-rate-limit@^5.0.0: |
2286 | version "4.0.4" | 2286 | version "5.0.0" |
2287 | resolved "https://registry.yarnpkg.com/express-rate-limit/-/express-rate-limit-4.0.4.tgz#a495338ae9e58c856b66d1346ec0d86f43ba2e43" | 2287 | resolved "https://registry.yarnpkg.com/express-rate-limit/-/express-rate-limit-5.0.0.tgz#9a6f4cacc388c1a1da7ba2f65db69f7395e9b04e" |
2288 | integrity sha512-DLRj2vMO7Xgai8qWKU9O6ZztF2bdDmfFNFi9k3G9BPzJ+7MG7eWaaBikbe0eBpNGSxU8JziwW0PQKG78aNWa6g== | 2288 | integrity sha512-dhT57wqxfqmkOi4HM7NuT4Gd7gbUgSK2ocG27Y6lwm8lbOAw9XQfeANawGq8wLDtlGPO1ZgDj0HmKsykTxfFAg== |
2289 | 2289 | ||
2290 | express-validator@^6.4.0: | 2290 | express-validator@^6.4.0: |
2291 | version "6.4.0" | 2291 | version "6.4.0" |