diff options
author | Chocobozzz <me@florianbigard.com> | 2023-06-20 14:17:34 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-06-20 14:17:34 +0200 |
commit | e915cde30ec47258a2beeec5ca748c928b59858c (patch) | |
tree | f5692ab20c534a61487f3bd471bb6105ed58d88a /server/controllers/api/metrics.ts | |
parent | 923e41fa4f342019298b46e407ea1f0207f74205 (diff) | |
download | PeerTube-e915cde30ec47258a2beeec5ca748c928b59858c.tar.gz PeerTube-e915cde30ec47258a2beeec5ca748c928b59858c.tar.zst PeerTube-e915cde30ec47258a2beeec5ca748c928b59858c.zip |
Fix runner api rate limit bypass
Diffstat (limited to 'server/controllers/api/metrics.ts')
-rw-r--r-- | server/controllers/api/metrics.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/server/controllers/api/metrics.ts b/server/controllers/api/metrics.ts index f66173875..909963fa7 100644 --- a/server/controllers/api/metrics.ts +++ b/server/controllers/api/metrics.ts | |||
@@ -1,11 +1,13 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { CONFIG } from '@server/initializers/config' | ||
2 | import { OpenTelemetryMetrics } from '@server/lib/opentelemetry/metrics' | 3 | import { OpenTelemetryMetrics } from '@server/lib/opentelemetry/metrics' |
3 | import { HttpStatusCode, PlaybackMetricCreate } from '@shared/models' | 4 | import { HttpStatusCode, PlaybackMetricCreate } from '@shared/models' |
4 | import { addPlaybackMetricValidator, asyncMiddleware } from '../../middlewares' | 5 | import { addPlaybackMetricValidator, apiRateLimiter, asyncMiddleware } from '../../middlewares' |
5 | import { CONFIG } from '@server/initializers/config' | ||
6 | 6 | ||
7 | const metricsRouter = express.Router() | 7 | const metricsRouter = express.Router() |
8 | 8 | ||
9 | metricsRouter.use(apiRateLimiter) | ||
10 | |||
9 | metricsRouter.post('/playback', | 11 | metricsRouter.post('/playback', |
10 | asyncMiddleware(addPlaybackMetricValidator), | 12 | asyncMiddleware(addPlaybackMetricValidator), |
11 | addPlaybackMetric | 13 | addPlaybackMetric |