diff options
Diffstat (limited to 'server/middlewares/validators/videos/video-view.ts')
-rw-r--r-- | server/middlewares/validators/videos/video-view.ts | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/server/middlewares/validators/videos/video-view.ts b/server/middlewares/validators/videos/video-view.ts index 4927c04ad..6e2d4505d 100644 --- a/server/middlewares/validators/videos/video-view.ts +++ b/server/middlewares/validators/videos/video-view.ts | |||
@@ -1,20 +1,17 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { body, param } from 'express-validator' | 2 | import { body, param } from 'express-validator' |
3 | import { isVideoTimeValid } from '@server/helpers/custom-validators/video-view' | 3 | import { isVideoTimeValid } from '@server/helpers/custom-validators/video-view' |
4 | import { getCachedVideoDuration } from '@server/lib/video' | ||
4 | import { LocalVideoViewerModel } from '@server/models/view/local-video-viewer' | 5 | import { LocalVideoViewerModel } from '@server/models/view/local-video-viewer' |
5 | import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' | 6 | import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' |
6 | import { exists, isIdValid, isIntOrNull, toIntOrNull } from '../../../helpers/custom-validators/misc' | 7 | import { exists, isIdValid, isIntOrNull, toIntOrNull } from '../../../helpers/custom-validators/misc' |
7 | import { logger } from '../../../helpers/logger' | ||
8 | import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared' | 8 | import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared' |
9 | import { getCachedVideoDuration } from '@server/lib/video' | ||
10 | 9 | ||
11 | const getVideoLocalViewerValidator = [ | 10 | const getVideoLocalViewerValidator = [ |
12 | param('localViewerId') | 11 | param('localViewerId') |
13 | .custom(isIdValid), | 12 | .custom(isIdValid), |
14 | 13 | ||
15 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 14 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
16 | logger.debug('Checking getVideoLocalViewerValidator parameters', { parameters: req.params }) | ||
17 | |||
18 | if (areValidationErrors(req, res)) return | 15 | if (areValidationErrors(req, res)) return |
19 | 16 | ||
20 | const localViewer = await LocalVideoViewerModel.loadFullById(+req.params.localViewerId) | 17 | const localViewer = await LocalVideoViewerModel.loadFullById(+req.params.localViewerId) |
@@ -40,8 +37,6 @@ const videoViewValidator = [ | |||
40 | .custom(isIntOrNull), | 37 | .custom(isIntOrNull), |
41 | 38 | ||
42 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 39 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
43 | logger.debug('Checking videoView parameters', { parameters: req.body }) | ||
44 | |||
45 | if (areValidationErrors(req, res)) return | 40 | if (areValidationErrors(req, res)) return |
46 | if (!await doesVideoExist(req.params.videoId, res, 'only-immutable-attributes')) return | 41 | if (!await doesVideoExist(req.params.videoId, res, 'only-immutable-attributes')) return |
47 | 42 | ||