aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/videos
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-08-17 14:58:40 +0200
committerChocobozzz <me@florianbigard.com>2022-08-17 14:58:40 +0200
commita85d530384761a0af833caac9b38b9834517c9fa (patch)
tree5407dbcc32b6324067632d4c99f25a6b7d851230 /server/middlewares/validators/videos
parent2ec349aa857b0bd8f26de5cd78981d60c9b98a69 (diff)
downloadPeerTube-a85d530384761a0af833caac9b38b9834517c9fa.tar.gz
PeerTube-a85d530384761a0af833caac9b38b9834517c9fa.tar.zst
PeerTube-a85d530384761a0af833caac9b38b9834517c9fa.zip
Remove unnecessary logs
Diffstat (limited to 'server/middlewares/validators/videos')
-rw-r--r--server/middlewares/validators/videos/video-blacklist.ts9
-rw-r--r--server/middlewares/validators/videos/video-captions.ts7
-rw-r--r--server/middlewares/validators/videos/video-channel-sync.ts3
-rw-r--r--server/middlewares/validators/videos/video-channels.ts13
-rw-r--r--server/middlewares/validators/videos/video-comments.ts14
-rw-r--r--server/middlewares/validators/videos/video-files.ts13
-rw-r--r--server/middlewares/validators/videos/video-imports.ts8
-rw-r--r--server/middlewares/validators/videos/video-live.ts12
-rw-r--r--server/middlewares/validators/videos/video-ownership-changes.ts5
-rw-r--r--server/middlewares/validators/videos/video-playlists.ts23
-rw-r--r--server/middlewares/validators/videos/video-rates.ts7
-rw-r--r--server/middlewares/validators/videos/video-shares.ts3
-rw-r--r--server/middlewares/validators/videos/video-source.ts3
-rw-r--r--server/middlewares/validators/videos/video-stats.ts7
-rw-r--r--server/middlewares/validators/videos/video-studio.ts3
-rw-r--r--server/middlewares/validators/videos/video-transcoding.ts3
-rw-r--r--server/middlewares/validators/videos/video-view.ts7
-rw-r--r--server/middlewares/validators/videos/videos.ts14
18 files changed, 5 insertions, 149 deletions
diff --git a/server/middlewares/validators/videos/video-blacklist.ts b/server/middlewares/validators/videos/video-blacklist.ts
index f065f101c..6b9aea07c 100644
--- a/server/middlewares/validators/videos/video-blacklist.ts
+++ b/server/middlewares/validators/videos/video-blacklist.ts
@@ -3,15 +3,12 @@ import { body, query } from 'express-validator'
3import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' 3import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
4import { isBooleanValid, toBooleanOrNull, toIntOrNull } from '../../../helpers/custom-validators/misc' 4import { isBooleanValid, toBooleanOrNull, toIntOrNull } from '../../../helpers/custom-validators/misc'
5import { isVideoBlacklistReasonValid, isVideoBlacklistTypeValid } from '../../../helpers/custom-validators/video-blacklist' 5import { isVideoBlacklistReasonValid, isVideoBlacklistTypeValid } from '../../../helpers/custom-validators/video-blacklist'
6import { logger } from '../../../helpers/logger'
7import { areValidationErrors, doesVideoBlacklistExist, doesVideoExist, isValidVideoIdParam } from '../shared' 6import { areValidationErrors, doesVideoBlacklistExist, doesVideoExist, isValidVideoIdParam } from '../shared'
8 7
9const videosBlacklistRemoveValidator = [ 8const videosBlacklistRemoveValidator = [
10 isValidVideoIdParam('videoId'), 9 isValidVideoIdParam('videoId'),
11 10
12 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 11 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
13 logger.debug('Checking blacklistRemove parameters.', { parameters: req.params })
14
15 if (areValidationErrors(req, res)) return 12 if (areValidationErrors(req, res)) return
16 if (!await doesVideoExist(req.params.videoId, res)) return 13 if (!await doesVideoExist(req.params.videoId, res)) return
17 if (!await doesVideoBlacklistExist(res.locals.videoAll.id, res)) return 14 if (!await doesVideoBlacklistExist(res.locals.videoAll.id, res)) return
@@ -32,8 +29,6 @@ const videosBlacklistAddValidator = [
32 .custom(isVideoBlacklistReasonValid), 29 .custom(isVideoBlacklistReasonValid),
33 30
34 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 31 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
35 logger.debug('Checking videosBlacklistAdd parameters', { parameters: req.params })
36
37 if (areValidationErrors(req, res)) return 32 if (areValidationErrors(req, res)) return
38 if (!await doesVideoExist(req.params.videoId, res)) return 33 if (!await doesVideoExist(req.params.videoId, res)) return
39 34
@@ -57,8 +52,6 @@ const videosBlacklistUpdateValidator = [
57 .custom(isVideoBlacklistReasonValid).withMessage('Should have a valid reason'), 52 .custom(isVideoBlacklistReasonValid).withMessage('Should have a valid reason'),
58 53
59 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 54 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
60 logger.debug('Checking videosBlacklistUpdate parameters', { parameters: req.params })
61
62 if (areValidationErrors(req, res)) return 55 if (areValidationErrors(req, res)) return
63 if (!await doesVideoExist(req.params.videoId, res)) return 56 if (!await doesVideoExist(req.params.videoId, res)) return
64 if (!await doesVideoBlacklistExist(res.locals.videoAll.id, res)) return 57 if (!await doesVideoBlacklistExist(res.locals.videoAll.id, res)) return
@@ -78,8 +71,6 @@ const videosBlacklistFiltersValidator = [
78 .isEmpty().withMessage('Should have a valid search'), 71 .isEmpty().withMessage('Should have a valid search'),
79 72
80 (req: express.Request, res: express.Response, next: express.NextFunction) => { 73 (req: express.Request, res: express.Response, next: express.NextFunction) => {
81 logger.debug('Checking videos blacklist filters query', { parameters: req.query })
82
83 if (areValidationErrors(req, res)) return 74 if (areValidationErrors(req, res)) return
84 75
85 return next() 76 return next()
diff --git a/server/middlewares/validators/videos/video-captions.ts b/server/middlewares/validators/videos/video-captions.ts
index fd6dd151a..72b2febc3 100644
--- a/server/middlewares/validators/videos/video-captions.ts
+++ b/server/middlewares/validators/videos/video-captions.ts
@@ -3,7 +3,6 @@ import { body, param } from 'express-validator'
3import { UserRight } from '@shared/models' 3import { UserRight } from '@shared/models'
4import { isVideoCaptionFile, isVideoCaptionLanguageValid } from '../../../helpers/custom-validators/video-captions' 4import { isVideoCaptionFile, isVideoCaptionLanguageValid } from '../../../helpers/custom-validators/video-captions'
5import { cleanUpReqFiles } from '../../../helpers/express-utils' 5import { cleanUpReqFiles } from '../../../helpers/express-utils'
6import { logger } from '../../../helpers/logger'
7import { CONSTRAINTS_FIELDS, MIMETYPES } from '../../../initializers/constants' 6import { CONSTRAINTS_FIELDS, MIMETYPES } from '../../../initializers/constants'
8import { 7import {
9 areValidationErrors, 8 areValidationErrors,
@@ -30,8 +29,6 @@ const addVideoCaptionValidator = [
30 ), 29 ),
31 30
32 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 31 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
33 logger.debug('Checking addVideoCaption parameters', { parameters: req.body })
34
35 if (areValidationErrors(req, res)) return cleanUpReqFiles(req) 32 if (areValidationErrors(req, res)) return cleanUpReqFiles(req)
36 if (!await doesVideoExist(req.params.videoId, res)) return cleanUpReqFiles(req) 33 if (!await doesVideoExist(req.params.videoId, res)) return cleanUpReqFiles(req)
37 34
@@ -50,8 +47,6 @@ const deleteVideoCaptionValidator = [
50 .custom(isVideoCaptionLanguageValid).not().isEmpty().withMessage('Should have a valid caption language'), 47 .custom(isVideoCaptionLanguageValid).not().isEmpty().withMessage('Should have a valid caption language'),
51 48
52 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 49 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
53 logger.debug('Checking deleteVideoCaption parameters', { parameters: req.params })
54
55 if (areValidationErrors(req, res)) return 50 if (areValidationErrors(req, res)) return
56 if (!await doesVideoExist(req.params.videoId, res)) return 51 if (!await doesVideoExist(req.params.videoId, res)) return
57 if (!await doesVideoCaptionExist(res.locals.videoAll, req.params.captionLanguage, res)) return 52 if (!await doesVideoCaptionExist(res.locals.videoAll, req.params.captionLanguage, res)) return
@@ -68,8 +63,6 @@ const listVideoCaptionsValidator = [
68 isValidVideoIdParam('videoId'), 63 isValidVideoIdParam('videoId'),
69 64
70 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 65 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
71 logger.debug('Checking listVideoCaptions parameters', { parameters: req.params })
72
73 if (areValidationErrors(req, res)) return 66 if (areValidationErrors(req, res)) return
74 if (!await doesVideoExist(req.params.videoId, res, 'only-video')) return 67 if (!await doesVideoExist(req.params.videoId, res, 'only-video')) return
75 68
diff --git a/server/middlewares/validators/videos/video-channel-sync.ts b/server/middlewares/validators/videos/video-channel-sync.ts
index 18d8d74d2..7e5b12471 100644
--- a/server/middlewares/validators/videos/video-channel-sync.ts
+++ b/server/middlewares/validators/videos/video-channel-sync.ts
@@ -1,7 +1,6 @@
1import * as express from 'express' 1import * as express from 'express'
2import { body, param } from 'express-validator' 2import { body, param } from 'express-validator'
3import { isUrlValid } from '@server/helpers/custom-validators/activitypub/misc' 3import { isUrlValid } from '@server/helpers/custom-validators/activitypub/misc'
4import { logger } from '@server/helpers/logger'
5import { CONFIG } from '@server/initializers/config' 4import { CONFIG } from '@server/initializers/config'
6import { VideoChannelSyncModel } from '@server/models/video/video-channel-sync' 5import { VideoChannelSyncModel } from '@server/models/video/video-channel-sync'
7import { HttpStatusCode, VideoChannelSyncCreate } from '@shared/models' 6import { HttpStatusCode, VideoChannelSyncCreate } from '@shared/models'
@@ -27,8 +26,6 @@ export const videoChannelSyncValidator = [
27 .isInt(), 26 .isInt(),
28 27
29 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 28 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
30 logger.debug('Checking videoChannelSync parameters', { parameters: req.body })
31
32 if (areValidationErrors(req, res)) return 29 if (areValidationErrors(req, res)) return
33 30
34 const body: VideoChannelSyncCreate = req.body 31 const body: VideoChannelSyncCreate = req.body
diff --git a/server/middlewares/validators/videos/video-channels.ts b/server/middlewares/validators/videos/video-channels.ts
index ad1415691..8338b24fc 100644
--- a/server/middlewares/validators/videos/video-channels.ts
+++ b/server/middlewares/validators/videos/video-channels.ts
@@ -12,7 +12,6 @@ import {
12 isVideoChannelSupportValid, 12 isVideoChannelSupportValid,
13 isVideoChannelUsernameValid 13 isVideoChannelUsernameValid
14} from '../../../helpers/custom-validators/video-channels' 14} from '../../../helpers/custom-validators/video-channels'
15import { logger } from '../../../helpers/logger'
16import { ActorModel } from '../../../models/actor/actor' 15import { ActorModel } from '../../../models/actor/actor'
17import { VideoChannelModel } from '../../../models/video/video-channel' 16import { VideoChannelModel } from '../../../models/video/video-channel'
18import { areValidationErrors, checkUserQuota, doesVideoChannelNameWithHostExist } from '../shared' 17import { areValidationErrors, checkUserQuota, doesVideoChannelNameWithHostExist } from '../shared'
@@ -31,8 +30,6 @@ export const videoChannelsAddValidator = [
31 .custom(isVideoChannelSupportValid), 30 .custom(isVideoChannelSupportValid),
32 31
33 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 32 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
34 logger.debug('Checking videoChannelsAdd parameters', { parameters: req.body })
35
36 if (areValidationErrors(req, res)) return 33 if (areValidationErrors(req, res)) return
37 34
38 const actor = await ActorModel.loadLocalByName(req.body.name) 35 const actor = await ActorModel.loadLocalByName(req.body.name)
@@ -72,8 +69,6 @@ export const videoChannelsUpdateValidator = [
72 .custom(isBooleanValid).withMessage('Should have a valid bulkVideosSupportUpdate boolean field'), 69 .custom(isBooleanValid).withMessage('Should have a valid bulkVideosSupportUpdate boolean field'),
73 70
74 (req: express.Request, res: express.Response, next: express.NextFunction) => { 71 (req: express.Request, res: express.Response, next: express.NextFunction) => {
75 logger.debug('Checking videoChannelsUpdate parameters', { parameters: req.body })
76
77 if (areValidationErrors(req, res)) return 72 if (areValidationErrors(req, res)) return
78 73
79 return next() 74 return next()
@@ -82,8 +77,6 @@ export const videoChannelsUpdateValidator = [
82 77
83export const videoChannelsRemoveValidator = [ 78export const videoChannelsRemoveValidator = [
84 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 79 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
85 logger.debug('Checking videoChannelsRemove parameters', { parameters: req.params })
86
87 if (!await checkVideoChannelIsNotTheLastOne(res.locals.videoChannel, res)) return 80 if (!await checkVideoChannelIsNotTheLastOne(res.locals.videoChannel, res)) return
88 81
89 return next() 82 return next()
@@ -95,8 +88,6 @@ export const videoChannelsNameWithHostValidator = [
95 .exists(), 88 .exists(),
96 89
97 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 90 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
98 logger.debug('Checking videoChannelsNameWithHostValidator parameters', { parameters: req.params })
99
100 if (areValidationErrors(req, res)) return 91 if (areValidationErrors(req, res)) return
101 92
102 if (!await doesVideoChannelNameWithHostExist(req.params.nameWithHost, res)) return 93 if (!await doesVideoChannelNameWithHostExist(req.params.nameWithHost, res)) return
@@ -147,8 +138,6 @@ export const videoChannelsListValidator = [
147 .not().isEmpty(), 138 .not().isEmpty(),
148 139
149 (req: express.Request, res: express.Response, next: express.NextFunction) => { 140 (req: express.Request, res: express.Response, next: express.NextFunction) => {
150 logger.debug('Checking video channels search query', { parameters: req.query })
151
152 if (areValidationErrors(req, res)) return 141 if (areValidationErrors(req, res)) return
153 142
154 return next() 143 return next()
@@ -164,8 +153,6 @@ export const videoChannelImportVideosValidator = [
164 .custom(isIdValid), 153 .custom(isIdValid),
165 154
166 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 155 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
167 logger.debug('Checking videoChannelImport parameters', { parameters: req.body })
168
169 if (areValidationErrors(req, res)) return 156 if (areValidationErrors(req, res)) return
170 157
171 const body: VideosImportInChannelCreate = req.body 158 const body: VideosImportInChannelCreate = req.body
diff --git a/server/middlewares/validators/videos/video-comments.ts b/server/middlewares/validators/videos/video-comments.ts
index b2a39617b..69062701b 100644
--- a/server/middlewares/validators/videos/video-comments.ts
+++ b/server/middlewares/validators/videos/video-comments.ts
@@ -43,8 +43,6 @@ const listVideoCommentsValidator = [
43 .custom(exists), 43 .custom(exists),
44 44
45 (req: express.Request, res: express.Response, next: express.NextFunction) => { 45 (req: express.Request, res: express.Response, next: express.NextFunction) => {
46 logger.debug('Checking listVideoCommentsValidator parameters.', { parameters: req.query })
47
48 if (areValidationErrors(req, res)) return 46 if (areValidationErrors(req, res)) return
49 47
50 return next() 48 return next()
@@ -55,8 +53,6 @@ const listVideoCommentThreadsValidator = [
55 isValidVideoIdParam('videoId'), 53 isValidVideoIdParam('videoId'),
56 54
57 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 55 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
58 logger.debug('Checking listVideoCommentThreads parameters.', { parameters: req.params })
59
60 if (areValidationErrors(req, res)) return 56 if (areValidationErrors(req, res)) return
61 if (!await doesVideoExist(req.params.videoId, res, 'only-video')) return 57 if (!await doesVideoExist(req.params.videoId, res, 'only-video')) return
62 58
@@ -73,8 +69,6 @@ const listVideoThreadCommentsValidator = [
73 .custom(isIdValid), 69 .custom(isIdValid),
74 70
75 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 71 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
76 logger.debug('Checking listVideoThreadComments parameters.', { parameters: req.params })
77
78 if (areValidationErrors(req, res)) return 72 if (areValidationErrors(req, res)) return
79 if (!await doesVideoExist(req.params.videoId, res, 'only-video')) return 73 if (!await doesVideoExist(req.params.videoId, res, 'only-video')) return
80 if (!await doesVideoCommentThreadExist(req.params.threadId, res.locals.onlyVideo, res)) return 74 if (!await doesVideoCommentThreadExist(req.params.threadId, res.locals.onlyVideo, res)) return
@@ -92,8 +86,6 @@ const addVideoCommentThreadValidator = [
92 .custom(isValidVideoCommentText), 86 .custom(isValidVideoCommentText),
93 87
94 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 88 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
95 logger.debug('Checking addVideoCommentThread parameters.', { parameters: req.params, body: req.body })
96
97 if (areValidationErrors(req, res)) return 89 if (areValidationErrors(req, res)) return
98 if (!await doesVideoExist(req.params.videoId, res)) return 90 if (!await doesVideoExist(req.params.videoId, res)) return
99 91
@@ -114,8 +106,6 @@ const addVideoCommentReplyValidator = [
114 body('text').custom(isValidVideoCommentText), 106 body('text').custom(isValidVideoCommentText),
115 107
116 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 108 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
117 logger.debug('Checking addVideoCommentReply parameters.', { parameters: req.params, body: req.body })
118
119 if (areValidationErrors(req, res)) return 109 if (areValidationErrors(req, res)) return
120 if (!await doesVideoExist(req.params.videoId, res)) return 110 if (!await doesVideoExist(req.params.videoId, res)) return
121 111
@@ -136,8 +126,6 @@ const videoCommentGetValidator = [
136 .custom(isIdValid), 126 .custom(isIdValid),
137 127
138 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 128 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
139 logger.debug('Checking videoCommentGetValidator parameters.', { parameters: req.params })
140
141 if (areValidationErrors(req, res)) return 129 if (areValidationErrors(req, res)) return
142 if (!await doesVideoExist(req.params.videoId, res, 'id')) return 130 if (!await doesVideoExist(req.params.videoId, res, 'id')) return
143 if (!await doesVideoCommentExist(req.params.commentId, res.locals.videoId, res)) return 131 if (!await doesVideoCommentExist(req.params.commentId, res.locals.videoId, res)) return
@@ -153,8 +141,6 @@ const removeVideoCommentValidator = [
153 .custom(isIdValid), 141 .custom(isIdValid),
154 142
155 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 143 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
156 logger.debug('Checking removeVideoCommentValidator parameters.', { parameters: req.params })
157
158 if (areValidationErrors(req, res)) return 144 if (areValidationErrors(req, res)) return
159 if (!await doesVideoExist(req.params.videoId, res)) return 145 if (!await doesVideoExist(req.params.videoId, res)) return
160 if (!await doesVideoCommentExist(req.params.commentId, res.locals.videoAll, res)) return 146 if (!await doesVideoCommentExist(req.params.commentId, res.locals.videoAll, res)) return
diff --git a/server/middlewares/validators/videos/video-files.ts b/server/middlewares/validators/videos/video-files.ts
index b44c997e3..92c5b9483 100644
--- a/server/middlewares/validators/videos/video-files.ts
+++ b/server/middlewares/validators/videos/video-files.ts
@@ -1,17 +1,14 @@
1import express from 'express' 1import express from 'express'
2import { param } from 'express-validator'
3import { isIdValid } from '@server/helpers/custom-validators/misc'
2import { MVideo } from '@server/types/models' 4import { MVideo } from '@server/types/models'
3import { HttpStatusCode } from '@shared/models' 5import { HttpStatusCode } from '@shared/models'
4import { logger } from '../../../helpers/logger'
5import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared' 6import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared'
6import { isIdValid } from '@server/helpers/custom-validators/misc'
7import { param } from 'express-validator'
8 7
9const videoFilesDeleteWebTorrentValidator = [ 8const videoFilesDeleteWebTorrentValidator = [
10 isValidVideoIdParam('id'), 9 isValidVideoIdParam('id'),
11 10
12 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 11 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
13 logger.debug('Checking videoFilesDeleteWebTorrent parameters', { parameters: req.params })
14
15 if (areValidationErrors(req, res)) return 12 if (areValidationErrors(req, res)) return
16 if (!await doesVideoExist(req.params.id, res)) return 13 if (!await doesVideoExist(req.params.id, res)) return
17 14
@@ -44,8 +41,6 @@ const videoFilesDeleteWebTorrentFileValidator = [
44 .custom(isIdValid), 41 .custom(isIdValid),
45 42
46 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 43 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
47 logger.debug('Checking videoFilesDeleteWebTorrentFile parameters', { parameters: req.params })
48
49 if (areValidationErrors(req, res)) return 44 if (areValidationErrors(req, res)) return
50 if (!await doesVideoExist(req.params.id, res)) return 45 if (!await doesVideoExist(req.params.id, res)) return
51 46
@@ -78,8 +73,6 @@ const videoFilesDeleteHLSValidator = [
78 isValidVideoIdParam('id'), 73 isValidVideoIdParam('id'),
79 74
80 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 75 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
81 logger.debug('Checking videoFilesDeleteHLS parameters', { parameters: req.params })
82
83 if (areValidationErrors(req, res)) return 76 if (areValidationErrors(req, res)) return
84 if (!await doesVideoExist(req.params.id, res)) return 77 if (!await doesVideoExist(req.params.id, res)) return
85 78
@@ -112,8 +105,6 @@ const videoFilesDeleteHLSFileValidator = [
112 .custom(isIdValid), 105 .custom(isIdValid),
113 106
114 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 107 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
115 logger.debug('Checking videoFilesDeleteHLSFile parameters', { parameters: req.params })
116
117 if (areValidationErrors(req, res)) return 108 if (areValidationErrors(req, res)) return
118 if (!await doesVideoExist(req.params.id, res)) return 109 if (!await doesVideoExist(req.params.id, res)) return
119 110
diff --git a/server/middlewares/validators/videos/video-imports.ts b/server/middlewares/validators/videos/video-imports.ts
index 0ab9e6e6f..f295b1885 100644
--- a/server/middlewares/validators/videos/video-imports.ts
+++ b/server/middlewares/validators/videos/video-imports.ts
@@ -39,8 +39,6 @@ const videoImportAddValidator = getCommonVideoEditAttributes().concat([
39 ), 39 ),
40 40
41 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 41 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
42 logger.debug('Checking videoImportAddValidator parameters', { parameters: req.body })
43
44 const user = res.locals.oauth.token.User 42 const user = res.locals.oauth.token.User
45 const torrentFile = req.files?.['torrentfile'] ? req.files['torrentfile'][0] : undefined 43 const torrentFile = req.files?.['torrentfile'] ? req.files['torrentfile'][0] : undefined
46 44
@@ -98,8 +96,6 @@ const getMyVideoImportsValidator = [
98 .custom(isIdValid), 96 .custom(isIdValid),
99 97
100 (req: express.Request, res: express.Response, next: express.NextFunction) => { 98 (req: express.Request, res: express.Response, next: express.NextFunction) => {
101 logger.debug('Checking getMyVideoImportsValidator parameters', { parameters: req.params })
102
103 if (areValidationErrors(req, res)) return 99 if (areValidationErrors(req, res)) return
104 100
105 return next() 101 return next()
@@ -111,8 +107,6 @@ const videoImportDeleteValidator = [
111 .custom(isIdValid), 107 .custom(isIdValid),
112 108
113 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 109 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
114 logger.debug('Checking videoImportDeleteValidator parameters', { parameters: req.params })
115
116 if (areValidationErrors(req, res)) return 110 if (areValidationErrors(req, res)) return
117 111
118 if (!await doesVideoImportExist(parseInt(req.params.id), res)) return 112 if (!await doesVideoImportExist(parseInt(req.params.id), res)) return
@@ -134,8 +128,6 @@ const videoImportCancelValidator = [
134 .custom(isIdValid), 128 .custom(isIdValid),
135 129
136 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 130 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
137 logger.debug('Checking videoImportCancelValidator parameters', { parameters: req.params })
138
139 if (areValidationErrors(req, res)) return 131 if (areValidationErrors(req, res)) return
140 132
141 if (!await doesVideoImportExist(parseInt(req.params.id), res)) return 133 if (!await doesVideoImportExist(parseInt(req.params.id), res)) return
diff --git a/server/middlewares/validators/videos/video-live.ts b/server/middlewares/validators/videos/video-live.ts
index a330d70a1..328760dde 100644
--- a/server/middlewares/validators/videos/video-live.ts
+++ b/server/middlewares/validators/videos/video-live.ts
@@ -6,6 +6,7 @@ import { isLocalLiveVideoAccepted } from '@server/lib/moderation'
6import { Hooks } from '@server/lib/plugins/hooks' 6import { Hooks } from '@server/lib/plugins/hooks'
7import { VideoModel } from '@server/models/video/video' 7import { VideoModel } from '@server/models/video/video'
8import { VideoLiveModel } from '@server/models/video/video-live' 8import { VideoLiveModel } from '@server/models/video/video-live'
9import { VideoLiveSessionModel } from '@server/models/video/video-live-session'
9import { 10import {
10 HttpStatusCode, 11 HttpStatusCode,
11 LiveVideoCreate, 12 LiveVideoCreate,
@@ -28,14 +29,11 @@ import {
28 isValidVideoIdParam 29 isValidVideoIdParam
29} from '../shared' 30} from '../shared'
30import { getCommonVideoEditAttributes } from './videos' 31import { getCommonVideoEditAttributes } from './videos'
31import { VideoLiveSessionModel } from '@server/models/video/video-live-session'
32 32
33const videoLiveGetValidator = [ 33const videoLiveGetValidator = [
34 isValidVideoIdParam('videoId'), 34 isValidVideoIdParam('videoId'),
35 35
36 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 36 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
37 logger.debug('Checking videoLiveGetValidator parameters', { parameters: req.params })
38
39 if (areValidationErrors(req, res)) return 37 if (areValidationErrors(req, res)) return
40 if (!await doesVideoExist(req.params.videoId, res, 'all')) return 38 if (!await doesVideoExist(req.params.videoId, res, 'all')) return
41 39
@@ -79,8 +77,6 @@ const videoLiveAddValidator = getCommonVideoEditAttributes().concat([
79 .custom(isLiveLatencyModeValid), 77 .custom(isLiveLatencyModeValid),
80 78
81 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 79 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
82 logger.debug('Checking videoLiveAddValidator parameters', { parameters: req.body })
83
84 if (areValidationErrors(req, res)) return cleanUpReqFiles(req) 80 if (areValidationErrors(req, res)) return cleanUpReqFiles(req)
85 81
86 if (CONFIG.LIVE.ENABLED !== true) { 82 if (CONFIG.LIVE.ENABLED !== true) {
@@ -163,8 +159,6 @@ const videoLiveUpdateValidator = [
163 .custom(isLiveLatencyModeValid), 159 .custom(isLiveLatencyModeValid),
164 160
165 (req: express.Request, res: express.Response, next: express.NextFunction) => { 161 (req: express.Request, res: express.Response, next: express.NextFunction) => {
166 logger.debug('Checking videoLiveUpdateValidator parameters', { parameters: req.body })
167
168 if (areValidationErrors(req, res)) return 162 if (areValidationErrors(req, res)) return
169 163
170 const body: LiveVideoUpdate = req.body 164 const body: LiveVideoUpdate = req.body
@@ -197,8 +191,6 @@ const videoLiveUpdateValidator = [
197 191
198const videoLiveListSessionsValidator = [ 192const videoLiveListSessionsValidator = [
199 (req: express.Request, res: express.Response, next: express.NextFunction) => { 193 (req: express.Request, res: express.Response, next: express.NextFunction) => {
200 logger.debug('Checking videoLiveListSessionsValidator parameters', { parameters: req.params })
201
202 // Check the user can manage the live 194 // Check the user can manage the live
203 const user = res.locals.oauth.token.User 195 const user = res.locals.oauth.token.User
204 if (!checkUserCanManageVideo(user, res.locals.videoAll, UserRight.GET_ANY_LIVE, res)) return 196 if (!checkUserCanManageVideo(user, res.locals.videoAll, UserRight.GET_ANY_LIVE, res)) return
@@ -211,8 +203,6 @@ const videoLiveFindReplaySessionValidator = [
211 isValidVideoIdParam('videoId'), 203 isValidVideoIdParam('videoId'),
212 204
213 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 205 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
214 logger.debug('Checking videoLiveFindReplaySessionValidator parameters', { parameters: req.params })
215
216 if (areValidationErrors(req, res)) return 206 if (areValidationErrors(req, res)) return
217 if (!await doesVideoExist(req.params.videoId, res, 'id')) return 207 if (!await doesVideoExist(req.params.videoId, res, 'id')) return
218 208
diff --git a/server/middlewares/validators/videos/video-ownership-changes.ts b/server/middlewares/validators/videos/video-ownership-changes.ts
index e73196f5b..3eca78c25 100644
--- a/server/middlewares/validators/videos/video-ownership-changes.ts
+++ b/server/middlewares/validators/videos/video-ownership-changes.ts
@@ -2,7 +2,6 @@ import express from 'express'
2import { param } from 'express-validator' 2import { param } from 'express-validator'
3import { isIdValid } from '@server/helpers/custom-validators/misc' 3import { isIdValid } from '@server/helpers/custom-validators/misc'
4import { checkUserCanTerminateOwnershipChange } from '@server/helpers/custom-validators/video-ownership' 4import { checkUserCanTerminateOwnershipChange } from '@server/helpers/custom-validators/video-ownership'
5import { logger } from '@server/helpers/logger'
6import { AccountModel } from '@server/models/account/account' 5import { AccountModel } from '@server/models/account/account'
7import { MVideoWithAllFiles } from '@server/types/models' 6import { MVideoWithAllFiles } from '@server/types/models'
8import { HttpStatusCode, UserRight, VideoChangeOwnershipAccept, VideoChangeOwnershipStatus, VideoState } from '@shared/models' 7import { HttpStatusCode, UserRight, VideoChangeOwnershipAccept, VideoChangeOwnershipStatus, VideoState } from '@shared/models'
@@ -20,8 +19,6 @@ const videosChangeOwnershipValidator = [
20 isValidVideoIdParam('videoId'), 19 isValidVideoIdParam('videoId'),
21 20
22 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 21 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
23 logger.debug('Checking changeOwnership parameters', { parameters: req.params })
24
25 if (areValidationErrors(req, res)) return 22 if (areValidationErrors(req, res)) return
26 if (!await doesVideoExist(req.params.videoId, res)) return 23 if (!await doesVideoExist(req.params.videoId, res)) return
27 24
@@ -44,8 +41,6 @@ const videosTerminateChangeOwnershipValidator = [
44 .custom(isIdValid), 41 .custom(isIdValid),
45 42
46 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 43 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
47 logger.debug('Checking changeOwnership parameters', { parameters: req.params })
48
49 if (areValidationErrors(req, res)) return 44 if (areValidationErrors(req, res)) return
50 if (!await doesChangeVideoOwnershipExist(req.params.id, res)) return 45 if (!await doesChangeVideoOwnershipExist(req.params.id, res)) return
51 46
diff --git a/server/middlewares/validators/videos/video-playlists.ts b/server/middlewares/validators/videos/video-playlists.ts
index 42e6646f9..6d4b8a6f1 100644
--- a/server/middlewares/validators/videos/video-playlists.ts
+++ b/server/middlewares/validators/videos/video-playlists.ts
@@ -29,7 +29,6 @@ import {
29} from '../../../helpers/custom-validators/video-playlists' 29} from '../../../helpers/custom-validators/video-playlists'
30import { isVideoImageValid } from '../../../helpers/custom-validators/videos' 30import { isVideoImageValid } from '../../../helpers/custom-validators/videos'
31import { cleanUpReqFiles } from '../../../helpers/express-utils' 31import { cleanUpReqFiles } from '../../../helpers/express-utils'
32import { logger } from '../../../helpers/logger'
33import { CONSTRAINTS_FIELDS } from '../../../initializers/constants' 32import { CONSTRAINTS_FIELDS } from '../../../initializers/constants'
34import { VideoPlaylistElementModel } from '../../../models/video/video-playlist-element' 33import { VideoPlaylistElementModel } from '../../../models/video/video-playlist-element'
35import { MVideoPlaylist } from '../../../types/models/video/video-playlist' 34import { MVideoPlaylist } from '../../../types/models/video/video-playlist'
@@ -48,8 +47,6 @@ const videoPlaylistsAddValidator = getCommonPlaylistEditAttributes().concat([
48 .custom(isVideoPlaylistNameValid), 47 .custom(isVideoPlaylistNameValid),
49 48
50 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 49 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
51 logger.debug('Checking videoPlaylistsAddValidator parameters', { parameters: req.body })
52
53 if (areValidationErrors(req, res)) return cleanUpReqFiles(req) 50 if (areValidationErrors(req, res)) return cleanUpReqFiles(req)
54 51
55 const body: VideoPlaylistCreate = req.body 52 const body: VideoPlaylistCreate = req.body
@@ -76,8 +73,6 @@ const videoPlaylistsUpdateValidator = getCommonPlaylistEditAttributes().concat([
76 .custom(isVideoPlaylistNameValid), 73 .custom(isVideoPlaylistNameValid),
77 74
78 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 75 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
79 logger.debug('Checking videoPlaylistsUpdateValidator parameters', { parameters: req.body })
80
81 if (areValidationErrors(req, res)) return cleanUpReqFiles(req) 76 if (areValidationErrors(req, res)) return cleanUpReqFiles(req)
82 77
83 if (!await doesVideoPlaylistExist(req.params.playlistId, res, 'all')) return cleanUpReqFiles(req) 78 if (!await doesVideoPlaylistExist(req.params.playlistId, res, 'all')) return cleanUpReqFiles(req)
@@ -118,8 +113,6 @@ const videoPlaylistsDeleteValidator = [
118 isValidPlaylistIdParam('playlistId'), 113 isValidPlaylistIdParam('playlistId'),
119 114
120 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 115 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
121 logger.debug('Checking videoPlaylistsDeleteValidator parameters', { parameters: req.params })
122
123 if (areValidationErrors(req, res)) return 116 if (areValidationErrors(req, res)) return
124 117
125 if (!await doesVideoPlaylistExist(req.params.playlistId, res)) return 118 if (!await doesVideoPlaylistExist(req.params.playlistId, res)) return
@@ -142,8 +135,6 @@ const videoPlaylistsGetValidator = (fetchType: VideoPlaylistFetchType) => {
142 isValidPlaylistIdParam('playlistId'), 135 isValidPlaylistIdParam('playlistId'),
143 136
144 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 137 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
145 logger.debug('Checking videoPlaylistsGetValidator parameters', { parameters: req.params })
146
147 if (areValidationErrors(req, res)) return 138 if (areValidationErrors(req, res)) return
148 139
149 if (!await doesVideoPlaylistExist(req.params.playlistId, res, fetchType)) return 140 if (!await doesVideoPlaylistExist(req.params.playlistId, res, fetchType)) return
@@ -189,8 +180,6 @@ const videoPlaylistsSearchValidator = [
189 .not().isEmpty(), 180 .not().isEmpty(),
190 181
191 (req: express.Request, res: express.Response, next: express.NextFunction) => { 182 (req: express.Request, res: express.Response, next: express.NextFunction) => {
192 logger.debug('Checking videoPlaylists search query', { parameters: req.query })
193
194 if (areValidationErrors(req, res)) return 183 if (areValidationErrors(req, res)) return
195 184
196 return next() 185 return next()
@@ -211,8 +200,6 @@ const videoPlaylistsAddVideoValidator = [
211 .custom(isVideoPlaylistTimestampValid), 200 .custom(isVideoPlaylistTimestampValid),
212 201
213 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 202 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
214 logger.debug('Checking videoPlaylistsAddVideoValidator parameters', { parameters: req.params })
215
216 if (areValidationErrors(req, res)) return 203 if (areValidationErrors(req, res)) return
217 204
218 if (!await doesVideoPlaylistExist(req.params.playlistId, res, 'all')) return 205 if (!await doesVideoPlaylistExist(req.params.playlistId, res, 'all')) return
@@ -241,8 +228,6 @@ const videoPlaylistsUpdateOrRemoveVideoValidator = [
241 .custom(isVideoPlaylistTimestampValid), 228 .custom(isVideoPlaylistTimestampValid),
242 229
243 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 230 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
244 logger.debug('Checking videoPlaylistsRemoveVideoValidator parameters', { parameters: req.params })
245
246 if (areValidationErrors(req, res)) return 231 if (areValidationErrors(req, res)) return
247 232
248 if (!await doesVideoPlaylistExist(req.params.playlistId, res, 'all')) return 233 if (!await doesVideoPlaylistExist(req.params.playlistId, res, 'all')) return
@@ -271,8 +256,6 @@ const videoPlaylistElementAPGetValidator = [
271 .custom(isIdValid), 256 .custom(isIdValid),
272 257
273 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 258 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
274 logger.debug('Checking videoPlaylistElementAPGetValidator parameters', { parameters: req.params })
275
276 if (areValidationErrors(req, res)) return 259 if (areValidationErrors(req, res)) return
277 260
278 const playlistElementId = parseInt(req.params.playlistElementId + '', 10) 261 const playlistElementId = parseInt(req.params.playlistElementId + '', 10)
@@ -312,8 +295,6 @@ const videoPlaylistsReorderVideosValidator = [
312 .isInt({ min: 1 }), 295 .isInt({ min: 1 }),
313 296
314 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 297 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
315 logger.debug('Checking videoPlaylistsReorderVideosValidator parameters', { parameters: req.params })
316
317 if (areValidationErrors(req, res)) return 298 if (areValidationErrors(req, res)) return
318 299
319 if (!await doesVideoPlaylistExist(req.params.playlistId, res, 'all')) return 300 if (!await doesVideoPlaylistExist(req.params.playlistId, res, 'all')) return
@@ -346,8 +327,6 @@ const commonVideoPlaylistFiltersValidator = [
346 .custom(isVideoPlaylistTypeValid), 327 .custom(isVideoPlaylistTypeValid),
347 328
348 (req: express.Request, res: express.Response, next: express.NextFunction) => { 329 (req: express.Request, res: express.Response, next: express.NextFunction) => {
349 logger.debug('Checking commonVideoPlaylistFiltersValidator parameters', { parameters: req.params })
350
351 if (areValidationErrors(req, res)) return 330 if (areValidationErrors(req, res)) return
352 331
353 return next() 332 return next()
@@ -360,8 +339,6 @@ const doVideosInPlaylistExistValidator = [
360 .custom(v => isArrayOf(v, isIdValid)).withMessage('Should have a valid video ids array'), 339 .custom(v => isArrayOf(v, isIdValid)).withMessage('Should have a valid video ids array'),
361 340
362 (req: express.Request, res: express.Response, next: express.NextFunction) => { 341 (req: express.Request, res: express.Response, next: express.NextFunction) => {
363 logger.debug('Checking areVideosInPlaylistExistValidator parameters', { parameters: req.query })
364
365 if (areValidationErrors(req, res)) return 342 if (areValidationErrors(req, res)) return
366 343
367 return next() 344 return next()
diff --git a/server/middlewares/validators/videos/video-rates.ts b/server/middlewares/validators/videos/video-rates.ts
index 0c02baafb..275634d5b 100644
--- a/server/middlewares/validators/videos/video-rates.ts
+++ b/server/middlewares/validators/videos/video-rates.ts
@@ -6,7 +6,6 @@ import { isAccountNameValid } from '../../../helpers/custom-validators/accounts'
6import { isIdValid } from '../../../helpers/custom-validators/misc' 6import { isIdValid } from '../../../helpers/custom-validators/misc'
7import { isRatingValid } from '../../../helpers/custom-validators/video-rates' 7import { isRatingValid } from '../../../helpers/custom-validators/video-rates'
8import { isVideoRatingTypeValid } from '../../../helpers/custom-validators/videos' 8import { isVideoRatingTypeValid } from '../../../helpers/custom-validators/videos'
9import { logger } from '../../../helpers/logger'
10import { AccountVideoRateModel } from '../../../models/account/account-video-rate' 9import { AccountVideoRateModel } from '../../../models/account/account-video-rate'
11import { areValidationErrors, checkCanSeeVideo, doesVideoExist, isValidVideoIdParam } from '../shared' 10import { areValidationErrors, checkCanSeeVideo, doesVideoExist, isValidVideoIdParam } from '../shared'
12 11
@@ -17,8 +16,6 @@ const videoUpdateRateValidator = [
17 .custom(isVideoRatingTypeValid), 16 .custom(isVideoRatingTypeValid),
18 17
19 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 18 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
20 logger.debug('Checking videoRate parameters', { parameters: req.body })
21
22 if (areValidationErrors(req, res)) return 19 if (areValidationErrors(req, res)) return
23 if (!await doesVideoExist(req.params.id, res)) return 20 if (!await doesVideoExist(req.params.id, res)) return
24 21
@@ -36,8 +33,6 @@ const getAccountVideoRateValidatorFactory = function (rateType: VideoRateType) {
36 .custom(isIdValid), 33 .custom(isIdValid),
37 34
38 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 35 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
39 logger.debug('Checking videoCommentGetValidator parameters.', { parameters: req.params })
40
41 if (areValidationErrors(req, res)) return 36 if (areValidationErrors(req, res)) return
42 37
43 const rate = await AccountVideoRateModel.loadLocalAndPopulateVideo(rateType, req.params.name, +req.params.videoId) 38 const rate = await AccountVideoRateModel.loadLocalAndPopulateVideo(rateType, req.params.name, +req.params.videoId)
@@ -61,8 +56,6 @@ const videoRatingValidator = [
61 .custom(isRatingValid).withMessage('Value must be one of "like" or "dislike"'), 56 .custom(isRatingValid).withMessage('Value must be one of "like" or "dislike"'),
62 57
63 (req: express.Request, res: express.Response, next: express.NextFunction) => { 58 (req: express.Request, res: express.Response, next: express.NextFunction) => {
64 logger.debug('Checking rating parameter', { parameters: req.params })
65
66 if (areValidationErrors(req, res)) return 59 if (areValidationErrors(req, res)) return
67 60
68 return next() 61 return next()
diff --git a/server/middlewares/validators/videos/video-shares.ts b/server/middlewares/validators/videos/video-shares.ts
index 40337dcf1..c234de6ed 100644
--- a/server/middlewares/validators/videos/video-shares.ts
+++ b/server/middlewares/validators/videos/video-shares.ts
@@ -2,7 +2,6 @@ import express from 'express'
2import { param } from 'express-validator' 2import { param } from 'express-validator'
3import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' 3import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
4import { isIdValid } from '../../../helpers/custom-validators/misc' 4import { isIdValid } from '../../../helpers/custom-validators/misc'
5import { logger } from '../../../helpers/logger'
6import { VideoShareModel } from '../../../models/video/video-share' 5import { VideoShareModel } from '../../../models/video/video-share'
7import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared' 6import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared'
8 7
@@ -13,8 +12,6 @@ const videosShareValidator = [
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 videoShare parameters', { parameters: req.params })
17
18 if (areValidationErrors(req, res)) return 15 if (areValidationErrors(req, res)) return
19 if (!await doesVideoExist(req.params.id, res)) return 16 if (!await doesVideoExist(req.params.id, res)) return
20 17
diff --git a/server/middlewares/validators/videos/video-source.ts b/server/middlewares/validators/videos/video-source.ts
index 31a2f16b3..c6d8f1a81 100644
--- a/server/middlewares/validators/videos/video-source.ts
+++ b/server/middlewares/validators/videos/video-source.ts
@@ -3,15 +3,12 @@ import { getVideoWithAttributes } from '@server/helpers/video'
3import { VideoSourceModel } from '@server/models/video/video-source' 3import { VideoSourceModel } from '@server/models/video/video-source'
4import { MVideoFullLight } from '@server/types/models' 4import { MVideoFullLight } from '@server/types/models'
5import { HttpStatusCode, UserRight } from '@shared/models' 5import { HttpStatusCode, UserRight } from '@shared/models'
6import { logger } from '../../../helpers/logger'
7import { areValidationErrors, checkUserCanManageVideo, doesVideoExist, isValidVideoIdParam } from '../shared' 6import { areValidationErrors, checkUserCanManageVideo, doesVideoExist, isValidVideoIdParam } from '../shared'
8 7
9const videoSourceGetValidator = [ 8const videoSourceGetValidator = [
10 isValidVideoIdParam('id'), 9 isValidVideoIdParam('id'),
11 10
12 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 11 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
13 logger.debug('Checking videoSourceGet parameters', { parameters: req.params })
14
15 if (areValidationErrors(req, res)) return 12 if (areValidationErrors(req, res)) return
16 if (!await doesVideoExist(req.params.id, res, 'for-api')) return 13 if (!await doesVideoExist(req.params.id, res, 'for-api')) return
17 14
diff --git a/server/middlewares/validators/videos/video-stats.ts b/server/middlewares/validators/videos/video-stats.ts
index ddbf2a564..a79526d39 100644
--- a/server/middlewares/validators/videos/video-stats.ts
+++ b/server/middlewares/validators/videos/video-stats.ts
@@ -4,7 +4,6 @@ import { isDateValid } from '@server/helpers/custom-validators/misc'
4import { isValidStatTimeserieMetric } from '@server/helpers/custom-validators/video-stats' 4import { isValidStatTimeserieMetric } from '@server/helpers/custom-validators/video-stats'
5import { STATS_TIMESERIE } from '@server/initializers/constants' 5import { STATS_TIMESERIE } from '@server/initializers/constants'
6import { HttpStatusCode, UserRight, VideoStatsTimeserieQuery } from '@shared/models' 6import { HttpStatusCode, UserRight, VideoStatsTimeserieQuery } from '@shared/models'
7import { logger } from '../../../helpers/logger'
8import { areValidationErrors, checkUserCanManageVideo, doesVideoExist, isValidVideoIdParam } from '../shared' 7import { areValidationErrors, checkUserCanManageVideo, doesVideoExist, isValidVideoIdParam } from '../shared'
9 8
10const videoOverallStatsValidator = [ 9const videoOverallStatsValidator = [
@@ -19,8 +18,6 @@ const videoOverallStatsValidator = [
19 .custom(isDateValid), 18 .custom(isDateValid),
20 19
21 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 20 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
22 logger.debug('Checking videoOverallStatsValidator parameters', { parameters: req.body })
23
24 if (areValidationErrors(req, res)) return 21 if (areValidationErrors(req, res)) return
25 if (!await commonStatsCheck(req, res)) return 22 if (!await commonStatsCheck(req, res)) return
26 23
@@ -32,8 +29,6 @@ const videoRetentionStatsValidator = [
32 isValidVideoIdParam('videoId'), 29 isValidVideoIdParam('videoId'),
33 30
34 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 31 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
35 logger.debug('Checking videoRetentionStatsValidator parameters', { parameters: req.body })
36
37 if (areValidationErrors(req, res)) return 32 if (areValidationErrors(req, res)) return
38 if (!await commonStatsCheck(req, res)) return 33 if (!await commonStatsCheck(req, res)) return
39 34
@@ -63,8 +58,6 @@ const videoTimeserieStatsValidator = [
63 .custom(isDateValid), 58 .custom(isDateValid),
64 59
65 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 60 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
66 logger.debug('Checking videoTimeserieStatsValidator parameters', { parameters: req.body })
67
68 if (areValidationErrors(req, res)) return 61 if (areValidationErrors(req, res)) return
69 if (!await commonStatsCheck(req, res)) return 62 if (!await commonStatsCheck(req, res)) return
70 63
diff --git a/server/middlewares/validators/videos/video-studio.ts b/server/middlewares/validators/videos/video-studio.ts
index d07e150ae..b3e2d8101 100644
--- a/server/middlewares/validators/videos/video-studio.ts
+++ b/server/middlewares/validators/videos/video-studio.ts
@@ -12,7 +12,6 @@ import { CONFIG } from '@server/initializers/config'
12import { approximateIntroOutroAdditionalSize, getTaskFile } from '@server/lib/video-studio' 12import { approximateIntroOutroAdditionalSize, getTaskFile } from '@server/lib/video-studio'
13import { isAudioFile } from '@shared/extra-utils' 13import { isAudioFile } from '@shared/extra-utils'
14import { HttpStatusCode, UserRight, VideoState, VideoStudioCreateEdition, VideoStudioTask } from '@shared/models' 14import { HttpStatusCode, UserRight, VideoState, VideoStudioCreateEdition, VideoStudioTask } from '@shared/models'
15import { logger } from '../../../helpers/logger'
16import { areValidationErrors, checkUserCanManageVideo, checkUserQuota, doesVideoExist } from '../shared' 15import { areValidationErrors, checkUserCanManageVideo, checkUserQuota, doesVideoExist } from '../shared'
17 16
18const videoStudioAddEditionValidator = [ 17const videoStudioAddEditionValidator = [
@@ -23,8 +22,6 @@ const videoStudioAddEditionValidator = [
23 .custom(isValidStudioTasksArray).withMessage('Should have a valid array of tasks'), 22 .custom(isValidStudioTasksArray).withMessage('Should have a valid array of tasks'),
24 23
25 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 24 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
26 logger.debug('Checking videoStudioAddEditionValidator parameters.', { parameters: req.params, body: req.body, files: req.files })
27
28 if (CONFIG.VIDEO_STUDIO.ENABLED !== true) { 25 if (CONFIG.VIDEO_STUDIO.ENABLED !== true) {
29 res.fail({ 26 res.fail({
30 status: HttpStatusCode.BAD_REQUEST_400, 27 status: HttpStatusCode.BAD_REQUEST_400,
diff --git a/server/middlewares/validators/videos/video-transcoding.ts b/server/middlewares/validators/videos/video-transcoding.ts
index 36b9799e6..3eb2d3141 100644
--- a/server/middlewares/validators/videos/video-transcoding.ts
+++ b/server/middlewares/validators/videos/video-transcoding.ts
@@ -4,7 +4,6 @@ import { isValidCreateTranscodingType } from '@server/helpers/custom-validators/
4import { CONFIG } from '@server/initializers/config' 4import { CONFIG } from '@server/initializers/config'
5import { VideoJobInfoModel } from '@server/models/video/video-job-info' 5import { VideoJobInfoModel } from '@server/models/video/video-job-info'
6import { HttpStatusCode } from '@shared/models' 6import { HttpStatusCode } from '@shared/models'
7import { logger } from '../../../helpers/logger'
8import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared' 7import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared'
9 8
10const createTranscodingValidator = [ 9const createTranscodingValidator = [
@@ -14,8 +13,6 @@ const createTranscodingValidator = [
14 .custom(isValidCreateTranscodingType), 13 .custom(isValidCreateTranscodingType),
15 14
16 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 15 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
17 logger.debug('Checking createTranscodingValidator parameters', { parameters: req.body })
18
19 if (areValidationErrors(req, res)) return 16 if (areValidationErrors(req, res)) return
20 if (!await doesVideoExist(req.params.videoId, res, 'all')) return 17 if (!await doesVideoExist(req.params.videoId, res, 'all')) return
21 18
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 @@
1import express from 'express' 1import express from 'express'
2import { body, param } from 'express-validator' 2import { body, param } from 'express-validator'
3import { isVideoTimeValid } from '@server/helpers/custom-validators/video-view' 3import { isVideoTimeValid } from '@server/helpers/custom-validators/video-view'
4import { getCachedVideoDuration } from '@server/lib/video'
4import { LocalVideoViewerModel } from '@server/models/view/local-video-viewer' 5import { LocalVideoViewerModel } from '@server/models/view/local-video-viewer'
5import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' 6import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
6import { exists, isIdValid, isIntOrNull, toIntOrNull } from '../../../helpers/custom-validators/misc' 7import { exists, isIdValid, isIntOrNull, toIntOrNull } from '../../../helpers/custom-validators/misc'
7import { logger } from '../../../helpers/logger'
8import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared' 8import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared'
9import { getCachedVideoDuration } from '@server/lib/video'
10 9
11const getVideoLocalViewerValidator = [ 10const 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
diff --git a/server/middlewares/validators/videos/videos.ts b/server/middlewares/validators/videos/videos.ts
index 5e8e25a9c..3d93bc62f 100644
--- a/server/middlewares/validators/videos/videos.ts
+++ b/server/middlewares/validators/videos/videos.ts
@@ -72,8 +72,6 @@ const videosAddLegacyValidator = getCommonVideoEditAttributes().concat([
72 .custom(isIdValid), 72 .custom(isIdValid),
73 73
74 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 74 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
75 logger.debug('Checking videosAdd parameters', { parameters: req.body, files: req.files })
76
77 if (areValidationErrors(req, res)) return cleanUpReqFiles(req) 75 if (areValidationErrors(req, res)) return cleanUpReqFiles(req)
78 76
79 const videoFile: express.VideoUploadFile = req.files['videofile'][0] 77 const videoFile: express.VideoUploadFile = req.files['videofile'][0]
@@ -202,7 +200,7 @@ const videosAddResumableInitValidator = getCommonVideoEditAttributes().concat([
202 files: req.files 200 files: req.files
203 }) 201 })
204 202
205 if (areValidationErrors(req, res)) return cleanup() 203 if (areValidationErrors(req, res, { omitLog: true })) return cleanup()
206 204
207 const files = { videofile: [ videoFileMetadata ] } 205 const files = { videofile: [ videoFileMetadata ] }
208 if (!await commonVideoChecksPass({ req, res, user, videoFileSize: videoFileMetadata.size, files })) return cleanup() 206 if (!await commonVideoChecksPass({ req, res, user, videoFileSize: videoFileMetadata.size, files })) return cleanup()
@@ -231,8 +229,6 @@ const videosUpdateValidator = getCommonVideoEditAttributes().concat([
231 .custom(isIdValid), 229 .custom(isIdValid),
232 230
233 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 231 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
234 logger.debug('Checking videosUpdate parameters', { parameters: req.body })
235
236 if (areValidationErrors(req, res)) return cleanUpReqFiles(req) 232 if (areValidationErrors(req, res)) return cleanUpReqFiles(req)
237 if (areErrorsInScheduleUpdate(req, res)) return cleanUpReqFiles(req) 233 if (areErrorsInScheduleUpdate(req, res)) return cleanUpReqFiles(req)
238 if (!await doesVideoExist(req.params.id, res)) return cleanUpReqFiles(req) 234 if (!await doesVideoExist(req.params.id, res)) return cleanUpReqFiles(req)
@@ -284,8 +280,6 @@ const videosCustomGetValidator = (
284 isValidVideoIdParam('id'), 280 isValidVideoIdParam('id'),
285 281
286 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 282 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
287 logger.debug('Checking videosGet parameters', { parameters: req.params })
288
289 if (areValidationErrors(req, res)) return 283 if (areValidationErrors(req, res)) return
290 if (!await doesVideoExist(req.params.id, res, fetchType)) return 284 if (!await doesVideoExist(req.params.id, res, fetchType)) return
291 285
@@ -311,8 +305,6 @@ const videoFileMetadataGetValidator = getCommonVideoEditAttributes().concat([
311 .custom(isIdValid).not().isEmpty().withMessage('Should have a valid videoFileId'), 305 .custom(isIdValid).not().isEmpty().withMessage('Should have a valid videoFileId'),
312 306
313 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 307 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
314 logger.debug('Checking videoFileMetadataGet parameters', { parameters: req.params })
315
316 if (areValidationErrors(req, res)) return 308 if (areValidationErrors(req, res)) return
317 if (!await doesVideoFileOfVideoExist(+req.params.videoFileId, req.params.id, res)) return 309 if (!await doesVideoFileOfVideoExist(+req.params.videoFileId, req.params.id, res)) return
318 310
@@ -324,8 +316,6 @@ const videosRemoveValidator = [
324 isValidVideoIdParam('id'), 316 isValidVideoIdParam('id'),
325 317
326 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 318 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
327 logger.debug('Checking videosRemove parameters', { parameters: req.params })
328
329 if (areValidationErrors(req, res)) return 319 if (areValidationErrors(req, res)) return
330 if (!await doesVideoExist(req.params.id, res)) return 320 if (!await doesVideoExist(req.params.id, res)) return
331 321
@@ -485,8 +475,6 @@ const commonVideosFiltersValidator = [
485 .custom(exists), 475 .custom(exists),
486 476
487 (req: express.Request, res: express.Response, next: express.NextFunction) => { 477 (req: express.Request, res: express.Response, next: express.NextFunction) => {
488 logger.debug('Checking commons video filters query', { parameters: req.query })
489
490 if (areValidationErrors(req, res)) return 478 if (areValidationErrors(req, res)) return
491 479
492 // FIXME: deprecated in 4.0, to remove 480 // FIXME: deprecated in 4.0, to remove