diff options
author | Chocobozzz <me@florianbigard.com> | 2022-08-17 14:58:40 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-08-17 14:58:40 +0200 |
commit | a85d530384761a0af833caac9b38b9834517c9fa (patch) | |
tree | 5407dbcc32b6324067632d4c99f25a6b7d851230 | |
parent | 2ec349aa857b0bd8f26de5cd78981d60c9b98a69 (diff) | |
download | PeerTube-a85d530384761a0af833caac9b38b9834517c9fa.tar.gz PeerTube-a85d530384761a0af833caac9b38b9834517c9fa.tar.zst PeerTube-a85d530384761a0af833caac9b38b9834517c9fa.zip |
Remove unnecessary logs
45 files changed, 46 insertions, 352 deletions
diff --git a/server/middlewares/validators/abuse.ts b/server/middlewares/validators/abuse.ts index e4aa1a839..9b94008ce 100644 --- a/server/middlewares/validators/abuse.ts +++ b/server/middlewares/validators/abuse.ts | |||
@@ -52,8 +52,6 @@ const abuseReportValidator = [ | |||
52 | .custom(areAbusePredefinedReasonsValid), | 52 | .custom(areAbusePredefinedReasonsValid), |
53 | 53 | ||
54 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 54 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
55 | logger.debug('Checking abuseReport parameters', { parameters: req.body }) | ||
56 | |||
57 | if (areValidationErrors(req, res)) return | 55 | if (areValidationErrors(req, res)) return |
58 | 56 | ||
59 | const body: AbuseCreate = req.body | 57 | const body: AbuseCreate = req.body |
@@ -76,8 +74,6 @@ const abuseGetValidator = [ | |||
76 | .custom(isIdValid), | 74 | .custom(isIdValid), |
77 | 75 | ||
78 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 76 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
79 | logger.debug('Checking abuseGetValidator parameters', { parameters: req.body }) | ||
80 | |||
81 | if (areValidationErrors(req, res)) return | 77 | if (areValidationErrors(req, res)) return |
82 | if (!await doesAbuseExist(req.params.id, res)) return | 78 | if (!await doesAbuseExist(req.params.id, res)) return |
83 | 79 | ||
@@ -97,8 +93,6 @@ const abuseUpdateValidator = [ | |||
97 | .custom(isAbuseModerationCommentValid), | 93 | .custom(isAbuseModerationCommentValid), |
98 | 94 | ||
99 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 95 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
100 | logger.debug('Checking abuseUpdateValidator parameters', { parameters: req.body }) | ||
101 | |||
102 | if (areValidationErrors(req, res)) return | 96 | if (areValidationErrors(req, res)) return |
103 | if (!await doesAbuseExist(req.params.id, res)) return | 97 | if (!await doesAbuseExist(req.params.id, res)) return |
104 | 98 | ||
@@ -139,8 +133,6 @@ const abuseListForAdminsValidator = [ | |||
139 | .custom(exists), | 133 | .custom(exists), |
140 | 134 | ||
141 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 135 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
142 | logger.debug('Checking abuseListForAdminsValidator parameters', { parameters: req.body }) | ||
143 | |||
144 | if (areValidationErrors(req, res)) return | 136 | if (areValidationErrors(req, res)) return |
145 | 137 | ||
146 | return next() | 138 | return next() |
@@ -161,8 +153,6 @@ const abuseListForUserValidator = [ | |||
161 | .custom(isAbuseStateValid), | 153 | .custom(isAbuseStateValid), |
162 | 154 | ||
163 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 155 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
164 | logger.debug('Checking abuseListForUserValidator parameters', { parameters: req.body }) | ||
165 | |||
166 | if (areValidationErrors(req, res)) return | 156 | if (areValidationErrors(req, res)) return |
167 | 157 | ||
168 | return next() | 158 | return next() |
@@ -174,8 +164,6 @@ const getAbuseValidator = [ | |||
174 | .custom(isIdValid), | 164 | .custom(isIdValid), |
175 | 165 | ||
176 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 166 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
177 | logger.debug('Checking getAbuseValidator parameters', { parameters: req.body }) | ||
178 | |||
179 | if (areValidationErrors(req, res)) return | 167 | if (areValidationErrors(req, res)) return |
180 | if (!await doesAbuseExist(req.params.id, res)) return | 168 | if (!await doesAbuseExist(req.params.id, res)) return |
181 | 169 | ||
@@ -198,8 +186,6 @@ const getAbuseValidator = [ | |||
198 | 186 | ||
199 | const checkAbuseValidForMessagesValidator = [ | 187 | const checkAbuseValidForMessagesValidator = [ |
200 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 188 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
201 | logger.debug('Checking checkAbuseValidForMessagesValidator parameters', { parameters: req.body }) | ||
202 | |||
203 | const abuse = res.locals.abuse | 189 | const abuse = res.locals.abuse |
204 | if (abuse.ReporterAccount.isOwned() === false) { | 190 | if (abuse.ReporterAccount.isOwned() === false) { |
205 | return res.fail({ message: 'This abuse was created by a user of your instance.' }) | 191 | return res.fail({ message: 'This abuse was created by a user of your instance.' }) |
@@ -214,8 +200,6 @@ const addAbuseMessageValidator = [ | |||
214 | .custom(isAbuseMessageValid), | 200 | .custom(isAbuseMessageValid), |
215 | 201 | ||
216 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 202 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
217 | logger.debug('Checking addAbuseMessageValidator parameters', { parameters: req.body }) | ||
218 | |||
219 | if (areValidationErrors(req, res)) return | 203 | if (areValidationErrors(req, res)) return |
220 | 204 | ||
221 | return next() | 205 | return next() |
@@ -227,8 +211,6 @@ const deleteAbuseMessageValidator = [ | |||
227 | .custom(isIdValid), | 211 | .custom(isIdValid), |
228 | 212 | ||
229 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 213 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
230 | logger.debug('Checking deleteAbuseMessageValidator parameters', { parameters: req.body }) | ||
231 | |||
232 | if (areValidationErrors(req, res)) return | 214 | if (areValidationErrors(req, res)) return |
233 | 215 | ||
234 | const user = res.locals.oauth.token.user | 216 | const user = res.locals.oauth.token.user |
diff --git a/server/middlewares/validators/account.ts b/server/middlewares/validators/account.ts index a7534ced5..551f67d61 100644 --- a/server/middlewares/validators/account.ts +++ b/server/middlewares/validators/account.ts | |||
@@ -1,7 +1,6 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { param } from 'express-validator' | 2 | import { param } from 'express-validator' |
3 | import { isAccountNameValid } from '../../helpers/custom-validators/accounts' | 3 | import { isAccountNameValid } from '../../helpers/custom-validators/accounts' |
4 | import { logger } from '../../helpers/logger' | ||
5 | import { areValidationErrors, doesAccountNameWithHostExist, doesLocalAccountNameExist } from './shared' | 4 | import { areValidationErrors, doesAccountNameWithHostExist, doesLocalAccountNameExist } from './shared' |
6 | 5 | ||
7 | const localAccountValidator = [ | 6 | const localAccountValidator = [ |
@@ -9,8 +8,6 @@ const localAccountValidator = [ | |||
9 | .custom(isAccountNameValid), | 8 | .custom(isAccountNameValid), |
10 | 9 | ||
11 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 10 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
12 | logger.debug('Checking localAccountValidator parameters', { parameters: req.params }) | ||
13 | |||
14 | if (areValidationErrors(req, res)) return | 11 | if (areValidationErrors(req, res)) return |
15 | if (!await doesLocalAccountNameExist(req.params.name, res)) return | 12 | if (!await doesLocalAccountNameExist(req.params.name, res)) return |
16 | 13 | ||
@@ -23,8 +20,6 @@ const accountNameWithHostGetValidator = [ | |||
23 | .exists(), | 20 | .exists(), |
24 | 21 | ||
25 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 22 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
26 | logger.debug('Checking accountsNameWithHostGetValidator parameters', { parameters: req.params }) | ||
27 | |||
28 | if (areValidationErrors(req, res)) return | 23 | if (areValidationErrors(req, res)) return |
29 | if (!await doesAccountNameWithHostExist(req.params.accountName, res)) return | 24 | if (!await doesAccountNameWithHostExist(req.params.accountName, res)) return |
30 | 25 | ||
diff --git a/server/middlewares/validators/activitypub/pagination.ts b/server/middlewares/validators/activitypub/pagination.ts index 69c4febaf..1259e4fef 100644 --- a/server/middlewares/validators/activitypub/pagination.ts +++ b/server/middlewares/validators/activitypub/pagination.ts | |||
@@ -1,7 +1,6 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { query } from 'express-validator' | 2 | import { query } from 'express-validator' |
3 | import { PAGINATION } from '@server/initializers/constants' | 3 | import { PAGINATION } from '@server/initializers/constants' |
4 | import { logger } from '../../../helpers/logger' | ||
5 | import { areValidationErrors } from '../shared' | 4 | import { areValidationErrors } from '../shared' |
6 | 5 | ||
7 | const apPaginationValidator = [ | 6 | const apPaginationValidator = [ |
@@ -13,8 +12,6 @@ const apPaginationValidator = [ | |||
13 | .isInt({ min: 0, max: PAGINATION.OUTBOX.COUNT.MAX }).withMessage(`Should have a valid page size (max: ${PAGINATION.OUTBOX.COUNT.MAX})`), | 12 | .isInt({ min: 0, max: PAGINATION.OUTBOX.COUNT.MAX }).withMessage(`Should have a valid page size (max: ${PAGINATION.OUTBOX.COUNT.MAX})`), |
14 | 13 | ||
15 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 14 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
16 | logger.debug('Checking pagination parameters', { parameters: req.query }) | ||
17 | |||
18 | if (areValidationErrors(req, res)) return | 15 | if (areValidationErrors(req, res)) return |
19 | 16 | ||
20 | return next() | 17 | return next() |
diff --git a/server/middlewares/validators/activitypub/signature.ts b/server/middlewares/validators/activitypub/signature.ts index 8c133ecef..998d0c0c4 100644 --- a/server/middlewares/validators/activitypub/signature.ts +++ b/server/middlewares/validators/activitypub/signature.ts | |||
@@ -26,7 +26,7 @@ const signatureValidator = [ | |||
26 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 26 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
27 | logger.debug('Checking Linked Data Signature parameter', { parameters: { signature: req.body.signature } }) | 27 | logger.debug('Checking Linked Data Signature parameter', { parameters: { signature: req.body.signature } }) |
28 | 28 | ||
29 | if (areValidationErrors(req, res)) return | 29 | if (areValidationErrors(req, res, { omitLog: true })) return |
30 | 30 | ||
31 | return next() | 31 | return next() |
32 | } | 32 | } |
diff --git a/server/middlewares/validators/actor-image.ts b/server/middlewares/validators/actor-image.ts index c7e9f391c..9dcf5e871 100644 --- a/server/middlewares/validators/actor-image.ts +++ b/server/middlewares/validators/actor-image.ts | |||
@@ -2,7 +2,6 @@ import express from 'express' | |||
2 | import { body } from 'express-validator' | 2 | import { body } from 'express-validator' |
3 | import { isActorImageFile } from '@server/helpers/custom-validators/actor-images' | 3 | import { isActorImageFile } from '@server/helpers/custom-validators/actor-images' |
4 | import { cleanUpReqFiles } from '../../helpers/express-utils' | 4 | import { cleanUpReqFiles } from '../../helpers/express-utils' |
5 | import { logger } from '../../helpers/logger' | ||
6 | import { CONSTRAINTS_FIELDS } from '../../initializers/constants' | 5 | import { CONSTRAINTS_FIELDS } from '../../initializers/constants' |
7 | import { areValidationErrors } from './shared' | 6 | import { areValidationErrors } from './shared' |
8 | 7 | ||
@@ -13,8 +12,6 @@ const updateActorImageValidatorFactory = (fieldname: string) => ([ | |||
13 | ), | 12 | ), |
14 | 13 | ||
15 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 14 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
16 | logger.debug('Checking updateActorImageValidator parameters', { files: req.files }) | ||
17 | |||
18 | if (areValidationErrors(req, res)) return cleanUpReqFiles(req) | 15 | if (areValidationErrors(req, res)) return cleanUpReqFiles(req) |
19 | 16 | ||
20 | return next() | 17 | return next() |
diff --git a/server/middlewares/validators/blocklist.ts b/server/middlewares/validators/blocklist.ts index 3de614522..1bae3764a 100644 --- a/server/middlewares/validators/blocklist.ts +++ b/server/middlewares/validators/blocklist.ts | |||
@@ -5,7 +5,6 @@ import { toArray } from '@server/helpers/custom-validators/misc' | |||
5 | import { getServerActor } from '@server/models/application/application' | 5 | import { getServerActor } from '@server/models/application/application' |
6 | import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' | 6 | import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' |
7 | import { isEachUniqueHostValid, isHostValid } from '../../helpers/custom-validators/servers' | 7 | import { isEachUniqueHostValid, isHostValid } from '../../helpers/custom-validators/servers' |
8 | import { logger } from '../../helpers/logger' | ||
9 | import { WEBSERVER } from '../../initializers/constants' | 8 | import { WEBSERVER } from '../../initializers/constants' |
10 | import { AccountBlocklistModel } from '../../models/account/account-blocklist' | 9 | import { AccountBlocklistModel } from '../../models/account/account-blocklist' |
11 | import { ServerModel } from '../../models/server/server' | 10 | import { ServerModel } from '../../models/server/server' |
@@ -17,8 +16,6 @@ const blockAccountValidator = [ | |||
17 | .exists(), | 16 | .exists(), |
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 blockAccountByAccountValidator parameters', { parameters: req.body }) | ||
21 | |||
22 | if (areValidationErrors(req, res)) return | 19 | if (areValidationErrors(req, res)) return |
23 | if (!await doesAccountNameWithHostExist(req.body.accountName, res)) return | 20 | if (!await doesAccountNameWithHostExist(req.body.accountName, res)) return |
24 | 21 | ||
@@ -42,8 +39,6 @@ const unblockAccountByAccountValidator = [ | |||
42 | .exists(), | 39 | .exists(), |
43 | 40 | ||
44 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 41 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
45 | logger.debug('Checking unblockAccountByAccountValidator parameters', { parameters: req.params }) | ||
46 | |||
47 | if (areValidationErrors(req, res)) return | 42 | if (areValidationErrors(req, res)) return |
48 | if (!await doesAccountNameWithHostExist(req.params.accountName, res)) return | 43 | if (!await doesAccountNameWithHostExist(req.params.accountName, res)) return |
49 | 44 | ||
@@ -60,8 +55,6 @@ const unblockAccountByServerValidator = [ | |||
60 | .exists(), | 55 | .exists(), |
61 | 56 | ||
62 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 57 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
63 | logger.debug('Checking unblockAccountByServerValidator parameters', { parameters: req.params }) | ||
64 | |||
65 | if (areValidationErrors(req, res)) return | 58 | if (areValidationErrors(req, res)) return |
66 | if (!await doesAccountNameWithHostExist(req.params.accountName, res)) return | 59 | if (!await doesAccountNameWithHostExist(req.params.accountName, res)) return |
67 | 60 | ||
@@ -78,8 +71,6 @@ const blockServerValidator = [ | |||
78 | .custom(isHostValid), | 71 | .custom(isHostValid), |
79 | 72 | ||
80 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 73 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
81 | logger.debug('Checking serverGetValidator parameters', { parameters: req.body }) | ||
82 | |||
83 | if (areValidationErrors(req, res)) return | 74 | if (areValidationErrors(req, res)) return |
84 | 75 | ||
85 | const host: string = req.body.host | 76 | const host: string = req.body.host |
@@ -104,8 +95,6 @@ const unblockServerByAccountValidator = [ | |||
104 | .custom(isHostValid), | 95 | .custom(isHostValid), |
105 | 96 | ||
106 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 97 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
107 | logger.debug('Checking unblockServerByAccountValidator parameters', { parameters: req.params }) | ||
108 | |||
109 | if (areValidationErrors(req, res)) return | 98 | if (areValidationErrors(req, res)) return |
110 | 99 | ||
111 | const user = res.locals.oauth.token.User | 100 | const user = res.locals.oauth.token.User |
@@ -120,8 +109,6 @@ const unblockServerByServerValidator = [ | |||
120 | .custom(isHostValid), | 109 | .custom(isHostValid), |
121 | 110 | ||
122 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 111 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
123 | logger.debug('Checking unblockServerByServerValidator parameters', { parameters: req.params }) | ||
124 | |||
125 | if (areValidationErrors(req, res)) return | 112 | if (areValidationErrors(req, res)) return |
126 | 113 | ||
127 | const serverActor = await getServerActor() | 114 | const serverActor = await getServerActor() |
@@ -143,8 +130,6 @@ const blocklistStatusValidator = [ | |||
143 | .custom(areValidActorHandles).withMessage('Should have a valid accounts array'), | 130 | .custom(areValidActorHandles).withMessage('Should have a valid accounts array'), |
144 | 131 | ||
145 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 132 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
146 | logger.debug('Checking blocklistStatusValidator parameters', { query: req.query }) | ||
147 | |||
148 | if (areValidationErrors(req, res)) return | 133 | if (areValidationErrors(req, res)) return |
149 | 134 | ||
150 | return next() | 135 | return next() |
diff --git a/server/middlewares/validators/bulk.ts b/server/middlewares/validators/bulk.ts index 5bc15e076..a1cea8032 100644 --- a/server/middlewares/validators/bulk.ts +++ b/server/middlewares/validators/bulk.ts | |||
@@ -3,7 +3,6 @@ import { body } from 'express-validator' | |||
3 | import { isBulkRemoveCommentsOfScopeValid } from '@server/helpers/custom-validators/bulk' | 3 | import { isBulkRemoveCommentsOfScopeValid } from '@server/helpers/custom-validators/bulk' |
4 | import { HttpStatusCode, UserRight } from '@shared/models' | 4 | import { HttpStatusCode, UserRight } from '@shared/models' |
5 | import { BulkRemoveCommentsOfBody } from '@shared/models/bulk/bulk-remove-comments-of-body.model' | 5 | import { BulkRemoveCommentsOfBody } from '@shared/models/bulk/bulk-remove-comments-of-body.model' |
6 | import { logger } from '../../helpers/logger' | ||
7 | import { areValidationErrors, doesAccountNameWithHostExist } from './shared' | 6 | import { areValidationErrors, doesAccountNameWithHostExist } from './shared' |
8 | 7 | ||
9 | const bulkRemoveCommentsOfValidator = [ | 8 | const bulkRemoveCommentsOfValidator = [ |
@@ -13,8 +12,6 @@ const bulkRemoveCommentsOfValidator = [ | |||
13 | .custom(isBulkRemoveCommentsOfScopeValid), | 12 | .custom(isBulkRemoveCommentsOfScopeValid), |
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 bulkRemoveCommentsOfValidator parameters', { parameters: req.body }) | ||
17 | |||
18 | if (areValidationErrors(req, res)) return | 15 | if (areValidationErrors(req, res)) return |
19 | if (!await doesAccountNameWithHostExist(req.body.accountName, res)) return | 16 | if (!await doesAccountNameWithHostExist(req.body.accountName, res)) return |
20 | 17 | ||
diff --git a/server/middlewares/validators/config.ts b/server/middlewares/validators/config.ts index c89f3087e..3a7daa573 100644 --- a/server/middlewares/validators/config.ts +++ b/server/middlewares/validators/config.ts | |||
@@ -2,13 +2,12 @@ import express from 'express' | |||
2 | import { body } from 'express-validator' | 2 | import { body } from 'express-validator' |
3 | import { isIntOrNull } from '@server/helpers/custom-validators/misc' | 3 | import { isIntOrNull } from '@server/helpers/custom-validators/misc' |
4 | import { CONFIG, isEmailEnabled } from '@server/initializers/config' | 4 | import { CONFIG, isEmailEnabled } from '@server/initializers/config' |
5 | import { HttpStatusCode } from '@shared/models/http/http-error-codes' | ||
5 | import { CustomConfig } from '../../../shared/models/server/custom-config.model' | 6 | import { CustomConfig } from '../../../shared/models/server/custom-config.model' |
6 | import { isThemeNameValid } from '../../helpers/custom-validators/plugins' | 7 | import { isThemeNameValid } from '../../helpers/custom-validators/plugins' |
7 | import { isUserNSFWPolicyValid, isUserVideoQuotaDailyValid, isUserVideoQuotaValid } from '../../helpers/custom-validators/users' | 8 | import { isUserNSFWPolicyValid, isUserVideoQuotaDailyValid, isUserVideoQuotaValid } from '../../helpers/custom-validators/users' |
8 | import { logger } from '../../helpers/logger' | ||
9 | import { isThemeRegistered } from '../../lib/plugins/theme-utils' | 9 | import { isThemeRegistered } from '../../lib/plugins/theme-utils' |
10 | import { areValidationErrors } from './shared' | 10 | import { areValidationErrors } from './shared' |
11 | import { HttpStatusCode } from '@shared/models/http/http-error-codes' | ||
12 | 11 | ||
13 | const customConfigUpdateValidator = [ | 12 | const customConfigUpdateValidator = [ |
14 | body('instance.name').exists(), | 13 | body('instance.name').exists(), |
@@ -105,8 +104,6 @@ const customConfigUpdateValidator = [ | |||
105 | body('search.searchIndex.isDefaultSearch').isBoolean(), | 104 | body('search.searchIndex.isDefaultSearch').isBoolean(), |
106 | 105 | ||
107 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 106 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
108 | logger.debug('Checking customConfigUpdateValidator parameters', { parameters: req.body }) | ||
109 | |||
110 | if (areValidationErrors(req, res)) return | 107 | if (areValidationErrors(req, res)) return |
111 | if (!checkInvalidConfigIfEmailDisabled(req.body, res)) return | 108 | if (!checkInvalidConfigIfEmailDisabled(req.body, res)) return |
112 | if (!checkInvalidTranscodingConfig(req.body, res)) return | 109 | if (!checkInvalidTranscodingConfig(req.body, res)) return |
diff --git a/server/middlewares/validators/feeds.ts b/server/middlewares/validators/feeds.ts index 900c1d383..0bfe89e6f 100644 --- a/server/middlewares/validators/feeds.ts +++ b/server/middlewares/validators/feeds.ts | |||
@@ -3,7 +3,6 @@ import { param, query } from 'express-validator' | |||
3 | import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' | 3 | import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' |
4 | import { isValidRSSFeed } from '../../helpers/custom-validators/feeds' | 4 | import { isValidRSSFeed } from '../../helpers/custom-validators/feeds' |
5 | import { exists, isIdOrUUIDValid, isIdValid, toCompleteUUID } from '../../helpers/custom-validators/misc' | 5 | import { exists, isIdOrUUIDValid, isIdValid, toCompleteUUID } from '../../helpers/custom-validators/misc' |
6 | import { logger } from '../../helpers/logger' | ||
7 | import { | 6 | import { |
8 | areValidationErrors, | 7 | areValidationErrors, |
9 | checkCanSeeVideo, | 8 | checkCanSeeVideo, |
@@ -24,8 +23,6 @@ const feedsFormatValidator = [ | |||
24 | .custom(isValidRSSFeed).withMessage('Should have a valid format (rss, atom, json)'), | 23 | .custom(isValidRSSFeed).withMessage('Should have a valid format (rss, atom, json)'), |
25 | 24 | ||
26 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 25 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
27 | logger.debug('Checking feeds format parameters', { parameters: req.query }) | ||
28 | |||
29 | if (areValidationErrors(req, res)) return | 26 | if (areValidationErrors(req, res)) return |
30 | 27 | ||
31 | return next() | 28 | return next() |
@@ -74,8 +71,6 @@ const videoFeedsValidator = [ | |||
74 | .optional(), | 71 | .optional(), |
75 | 72 | ||
76 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 73 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
77 | logger.debug('Checking feeds parameters', { parameters: req.query }) | ||
78 | |||
79 | if (areValidationErrors(req, res)) return | 74 | if (areValidationErrors(req, res)) return |
80 | 75 | ||
81 | if (req.query.accountId && !await doesAccountIdExist(req.query.accountId, res)) return | 76 | if (req.query.accountId && !await doesAccountIdExist(req.query.accountId, res)) return |
@@ -95,8 +90,6 @@ const videoSubscriptionFeedsValidator = [ | |||
95 | .custom(exists), | 90 | .custom(exists), |
96 | 91 | ||
97 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 92 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
98 | logger.debug('Checking subscription feeds parameters', { parameters: req.query }) | ||
99 | |||
100 | if (areValidationErrors(req, res)) return | 93 | if (areValidationErrors(req, res)) return |
101 | 94 | ||
102 | if (!await doesAccountIdExist(req.query.accountId, res)) return | 95 | if (!await doesAccountIdExist(req.query.accountId, res)) return |
@@ -113,8 +106,6 @@ const videoCommentsFeedsValidator = [ | |||
113 | .custom(isIdOrUUIDValid), | 106 | .custom(isIdOrUUIDValid), |
114 | 107 | ||
115 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 108 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
116 | logger.debug('Checking feeds parameters', { parameters: req.query }) | ||
117 | |||
118 | if (areValidationErrors(req, res)) return | 109 | if (areValidationErrors(req, res)) return |
119 | 110 | ||
120 | if (req.query.videoId && (req.query.videoChannelId || req.query.videoChannelName)) { | 111 | if (req.query.videoId && (req.query.videoChannelId || req.query.videoChannelName)) { |
diff --git a/server/middlewares/validators/follows.ts b/server/middlewares/validators/follows.ts index 639c60c03..be98a4c04 100644 --- a/server/middlewares/validators/follows.ts +++ b/server/middlewares/validators/follows.ts | |||
@@ -50,8 +50,6 @@ const followValidator = [ | |||
50 | }) | 50 | }) |
51 | } | 51 | } |
52 | 52 | ||
53 | logger.debug('Checking follow parameters', { parameters: req.body }) | ||
54 | |||
55 | if (areValidationErrors(req, res)) return | 53 | if (areValidationErrors(req, res)) return |
56 | 54 | ||
57 | const body: ServerFollowCreate = req.body | 55 | const body: ServerFollowCreate = req.body |
@@ -73,8 +71,6 @@ const removeFollowingValidator = [ | |||
73 | .custom(value => isHostValid(value) || isRemoteHandleValid(value)), | 71 | .custom(value => isHostValid(value) || isRemoteHandleValid(value)), |
74 | 72 | ||
75 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 73 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
76 | logger.debug('Checking unfollowing parameters', { parameters: req.params }) | ||
77 | |||
78 | if (areValidationErrors(req, res)) return | 74 | if (areValidationErrors(req, res)) return |
79 | 75 | ||
80 | const serverActor = await getServerActor() | 76 | const serverActor = await getServerActor() |
@@ -103,8 +99,6 @@ const getFollowerValidator = [ | |||
103 | .custom(isValidActorHandle), | 99 | .custom(isValidActorHandle), |
104 | 100 | ||
105 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 101 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
106 | logger.debug('Checking get follower parameters', { parameters: req.params }) | ||
107 | |||
108 | if (areValidationErrors(req, res)) return | 102 | if (areValidationErrors(req, res)) return |
109 | 103 | ||
110 | let follow: MActorFollowActorsDefault | 104 | let follow: MActorFollowActorsDefault |
@@ -132,8 +126,6 @@ const getFollowerValidator = [ | |||
132 | 126 | ||
133 | const acceptFollowerValidator = [ | 127 | const acceptFollowerValidator = [ |
134 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 128 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
135 | logger.debug('Checking accept follower parameters', { parameters: req.params }) | ||
136 | |||
137 | const follow = res.locals.follow | 129 | const follow = res.locals.follow |
138 | if (follow.state !== 'pending' && follow.state !== 'rejected') { | 130 | if (follow.state !== 'pending' && follow.state !== 'rejected') { |
139 | return res.fail({ message: 'Follow is not in pending/rejected state.' }) | 131 | return res.fail({ message: 'Follow is not in pending/rejected state.' }) |
@@ -145,8 +137,6 @@ const acceptFollowerValidator = [ | |||
145 | 137 | ||
146 | const rejectFollowerValidator = [ | 138 | const rejectFollowerValidator = [ |
147 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 139 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
148 | logger.debug('Checking reject follower parameters', { parameters: req.params }) | ||
149 | |||
150 | const follow = res.locals.follow | 140 | const follow = res.locals.follow |
151 | if (follow.state !== 'pending' && follow.state !== 'accepted') { | 141 | if (follow.state !== 'pending' && follow.state !== 'accepted') { |
152 | return res.fail({ message: 'Follow is not in pending/accepted state.' }) | 142 | return res.fail({ message: 'Follow is not in pending/accepted state.' }) |
diff --git a/server/middlewares/validators/jobs.ts b/server/middlewares/validators/jobs.ts index 971c2060c..e5008adc3 100644 --- a/server/middlewares/validators/jobs.ts +++ b/server/middlewares/validators/jobs.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { param, query } from 'express-validator' | 2 | import { param, query } from 'express-validator' |
3 | import { isValidJobState, isValidJobType } from '../../helpers/custom-validators/jobs' | 3 | import { isValidJobState, isValidJobType } from '../../helpers/custom-validators/jobs' |
4 | import { logger, loggerTagsFactory } from '../../helpers/logger' | 4 | import { loggerTagsFactory } from '../../helpers/logger' |
5 | import { areValidationErrors } from './shared' | 5 | import { areValidationErrors } from './shared' |
6 | 6 | ||
7 | const lTags = loggerTagsFactory('validators', 'jobs') | 7 | const lTags = loggerTagsFactory('validators', 'jobs') |
@@ -16,9 +16,7 @@ const listJobsValidator = [ | |||
16 | .custom(isValidJobType), | 16 | .custom(isValidJobType), |
17 | 17 | ||
18 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 18 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
19 | logger.debug('Checking listJobsValidator parameters.', { parameters: req.params, ...lTags() }) | 19 | if (areValidationErrors(req, res, lTags())) return |
20 | |||
21 | if (areValidationErrors(req, res)) return | ||
22 | 20 | ||
23 | return next() | 21 | return next() |
24 | } | 22 | } |
diff --git a/server/middlewares/validators/logs.ts b/server/middlewares/validators/logs.ts index ce36dc40b..584cb2aaf 100644 --- a/server/middlewares/validators/logs.ts +++ b/server/middlewares/validators/logs.ts | |||
@@ -13,7 +13,6 @@ import { | |||
13 | isValidLogLevel | 13 | isValidLogLevel |
14 | } from '../../helpers/custom-validators/logs' | 14 | } from '../../helpers/custom-validators/logs' |
15 | import { isDateValid, toArray } from '../../helpers/custom-validators/misc' | 15 | import { isDateValid, toArray } from '../../helpers/custom-validators/misc' |
16 | import { logger } from '../../helpers/logger' | ||
17 | import { areValidationErrors } from './shared' | 16 | import { areValidationErrors } from './shared' |
18 | 17 | ||
19 | const createClientLogValidator = [ | 18 | const createClientLogValidator = [ |
@@ -39,8 +38,6 @@ const createClientLogValidator = [ | |||
39 | .custom(isValidClientLogUserAgent), | 38 | .custom(isValidClientLogUserAgent), |
40 | 39 | ||
41 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 40 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
42 | logger.debug('Checking createClientLogValidator parameters.', { parameters: req.query }) | ||
43 | |||
44 | if (CONFIG.LOG.ACCEPT_CLIENT_LOG !== true) { | 41 | if (CONFIG.LOG.ACCEPT_CLIENT_LOG !== true) { |
45 | return res.sendStatus(HttpStatusCode.FORBIDDEN_403) | 42 | return res.sendStatus(HttpStatusCode.FORBIDDEN_403) |
46 | } | 43 | } |
@@ -66,8 +63,6 @@ const getLogsValidator = [ | |||
66 | .custom(isDateValid).withMessage('Should have an end date that conforms to ISO 8601'), | 63 | .custom(isDateValid).withMessage('Should have an end date that conforms to ISO 8601'), |
67 | 64 | ||
68 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 65 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
69 | logger.debug('Checking getLogsValidator parameters.', { parameters: req.query }) | ||
70 | |||
71 | if (areValidationErrors(req, res)) return | 66 | if (areValidationErrors(req, res)) return |
72 | 67 | ||
73 | return next() | 68 | return next() |
@@ -82,8 +77,6 @@ const getAuditLogsValidator = [ | |||
82 | .custom(isDateValid).withMessage('Should have a end date that conforms to ISO 8601'), | 77 | .custom(isDateValid).withMessage('Should have a end date that conforms to ISO 8601'), |
83 | 78 | ||
84 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 79 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
85 | logger.debug('Checking getAuditLogsValidator parameters.', { parameters: req.query }) | ||
86 | |||
87 | if (areValidationErrors(req, res)) return | 80 | if (areValidationErrors(req, res)) return |
88 | 81 | ||
89 | return next() | 82 | return next() |
diff --git a/server/middlewares/validators/metrics.ts b/server/middlewares/validators/metrics.ts index cd6f872da..8ee5ac0d0 100644 --- a/server/middlewares/validators/metrics.ts +++ b/server/middlewares/validators/metrics.ts | |||
@@ -4,7 +4,6 @@ import { isValidPlayerMode } from '@server/helpers/custom-validators/metrics' | |||
4 | import { isIdOrUUIDValid, toCompleteUUID } from '@server/helpers/custom-validators/misc' | 4 | import { isIdOrUUIDValid, toCompleteUUID } from '@server/helpers/custom-validators/misc' |
5 | import { CONFIG } from '@server/initializers/config' | 5 | import { CONFIG } from '@server/initializers/config' |
6 | import { HttpStatusCode, PlaybackMetricCreate } from '@shared/models' | 6 | import { HttpStatusCode, PlaybackMetricCreate } from '@shared/models' |
7 | import { logger } from '../../helpers/logger' | ||
8 | import { areValidationErrors, doesVideoExist } from './shared' | 7 | import { areValidationErrors, doesVideoExist } from './shared' |
9 | 8 | ||
10 | const addPlaybackMetricValidator = [ | 9 | const addPlaybackMetricValidator = [ |
@@ -35,8 +34,6 @@ const addPlaybackMetricValidator = [ | |||
35 | .custom(isIdOrUUIDValid), | 34 | .custom(isIdOrUUIDValid), |
36 | 35 | ||
37 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 36 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
38 | logger.debug('Checking addPlaybackMetricValidator parameters.', { parameters: req.query }) | ||
39 | |||
40 | if (!CONFIG.OPEN_TELEMETRY.METRICS.ENABLED) return res.sendStatus(HttpStatusCode.NO_CONTENT_204) | 37 | if (!CONFIG.OPEN_TELEMETRY.METRICS.ENABLED) return res.sendStatus(HttpStatusCode.NO_CONTENT_204) |
41 | 38 | ||
42 | const body: PlaybackMetricCreate = req.body | 39 | const body: PlaybackMetricCreate = req.body |
diff --git a/server/middlewares/validators/oembed.ts b/server/middlewares/validators/oembed.ts index fa90dd05c..ef9a227a0 100644 --- a/server/middlewares/validators/oembed.ts +++ b/server/middlewares/validators/oembed.ts | |||
@@ -7,7 +7,6 @@ import { VideoPlaylistPrivacy, VideoPrivacy } from '@shared/models' | |||
7 | import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' | 7 | import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' |
8 | import { isTestOrDevInstance } from '../../helpers/core-utils' | 8 | import { isTestOrDevInstance } from '../../helpers/core-utils' |
9 | import { isIdOrUUIDValid, isUUIDValid, toCompleteUUID } from '../../helpers/custom-validators/misc' | 9 | import { isIdOrUUIDValid, isUUIDValid, toCompleteUUID } from '../../helpers/custom-validators/misc' |
10 | import { logger } from '../../helpers/logger' | ||
11 | import { WEBSERVER } from '../../initializers/constants' | 10 | import { WEBSERVER } from '../../initializers/constants' |
12 | import { areValidationErrors } from './shared' | 11 | import { areValidationErrors } from './shared' |
13 | 12 | ||
@@ -52,8 +51,6 @@ const oembedValidator = [ | |||
52 | .isIn([ 'xml', 'json' ]), | 51 | .isIn([ 'xml', 'json' ]), |
53 | 52 | ||
54 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 53 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
55 | logger.debug('Checking oembed parameters', { parameters: req.query }) | ||
56 | |||
57 | if (areValidationErrors(req, res)) return | 54 | if (areValidationErrors(req, res)) return |
58 | 55 | ||
59 | if (req.query.format !== undefined && req.query.format !== 'json') { | 56 | if (req.query.format !== undefined && req.query.format !== 'json') { |
diff --git a/server/middlewares/validators/pagination.ts b/server/middlewares/validators/pagination.ts index ce371d6c1..79ddbbf18 100644 --- a/server/middlewares/validators/pagination.ts +++ b/server/middlewares/validators/pagination.ts | |||
@@ -1,7 +1,6 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { query } from 'express-validator' | 2 | import { query } from 'express-validator' |
3 | import { PAGINATION } from '@server/initializers/constants' | 3 | import { PAGINATION } from '@server/initializers/constants' |
4 | import { logger } from '../../helpers/logger' | ||
5 | import { areValidationErrors } from './shared' | 4 | import { areValidationErrors } from './shared' |
6 | 5 | ||
7 | const paginationValidator = paginationValidatorBuilder() | 6 | const paginationValidator = paginationValidatorBuilder() |
@@ -16,9 +15,7 @@ function paginationValidatorBuilder (tags: string[] = []) { | |||
16 | .isInt({ min: 0, max: PAGINATION.GLOBAL.COUNT.MAX }).withMessage(`Should have a number count (max: ${PAGINATION.GLOBAL.COUNT.MAX})`), | 15 | .isInt({ min: 0, max: PAGINATION.GLOBAL.COUNT.MAX }).withMessage(`Should have a number count (max: ${PAGINATION.GLOBAL.COUNT.MAX})`), |
17 | 16 | ||
18 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 17 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
19 | logger.debug('Checking pagination parameters', { parameters: req.query, tags }) | 18 | if (areValidationErrors(req, res, { tags })) return |
20 | |||
21 | if (areValidationErrors(req, res)) return | ||
22 | 19 | ||
23 | return next() | 20 | return next() |
24 | } | 21 | } |
diff --git a/server/middlewares/validators/plugins.ts b/server/middlewares/validators/plugins.ts index dc80469c3..78c030333 100644 --- a/server/middlewares/validators/plugins.ts +++ b/server/middlewares/validators/plugins.ts | |||
@@ -5,7 +5,6 @@ import { PluginType } from '../../../shared/models/plugins/plugin.type' | |||
5 | import { InstallOrUpdatePlugin } from '../../../shared/models/plugins/server/api/install-plugin.model' | 5 | import { InstallOrUpdatePlugin } from '../../../shared/models/plugins/server/api/install-plugin.model' |
6 | import { exists, isBooleanValid, isSafePath, toBooleanOrNull, toIntOrNull } from '../../helpers/custom-validators/misc' | 6 | import { exists, isBooleanValid, isSafePath, toBooleanOrNull, toIntOrNull } from '../../helpers/custom-validators/misc' |
7 | import { isNpmPluginNameValid, isPluginNameValid, isPluginTypeValid, isPluginVersionValid } from '../../helpers/custom-validators/plugins' | 7 | import { isNpmPluginNameValid, isPluginNameValid, isPluginTypeValid, isPluginVersionValid } from '../../helpers/custom-validators/plugins' |
8 | import { logger } from '../../helpers/logger' | ||
9 | import { CONFIG } from '../../initializers/config' | 8 | import { CONFIG } from '../../initializers/config' |
10 | import { PluginManager } from '../../lib/plugins/plugin-manager' | 9 | import { PluginManager } from '../../lib/plugins/plugin-manager' |
11 | import { PluginModel } from '../../models/server/plugin' | 10 | import { PluginModel } from '../../models/server/plugin' |
@@ -26,8 +25,6 @@ const getPluginValidator = (pluginType: PluginType, withVersion = true) => { | |||
26 | 25 | ||
27 | return validators.concat([ | 26 | return validators.concat([ |
28 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 27 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
29 | logger.debug('Checking getPluginValidator parameters', { parameters: req.params }) | ||
30 | |||
31 | if (areValidationErrors(req, res)) return | 28 | if (areValidationErrors(req, res)) return |
32 | 29 | ||
33 | const npmName = PluginModel.buildNpmName(req.params.pluginName, pluginType) | 30 | const npmName = PluginModel.buildNpmName(req.params.pluginName, pluginType) |
@@ -58,8 +55,6 @@ const getExternalAuthValidator = [ | |||
58 | .custom(exists), | 55 | .custom(exists), |
59 | 56 | ||
60 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 57 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
61 | logger.debug('Checking getExternalAuthValidator parameters', { parameters: req.params }) | ||
62 | |||
63 | if (areValidationErrors(req, res)) return | 58 | if (areValidationErrors(req, res)) return |
64 | 59 | ||
65 | const plugin = res.locals.registeredPlugin | 60 | const plugin = res.locals.registeredPlugin |
@@ -89,8 +84,6 @@ const pluginStaticDirectoryValidator = [ | |||
89 | .custom(isSafePath), | 84 | .custom(isSafePath), |
90 | 85 | ||
91 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 86 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
92 | logger.debug('Checking pluginStaticDirectoryValidator parameters', { parameters: req.params }) | ||
93 | |||
94 | if (areValidationErrors(req, res)) return | 87 | if (areValidationErrors(req, res)) return |
95 | 88 | ||
96 | return next() | 89 | return next() |
@@ -108,8 +101,6 @@ const listPluginsValidator = [ | |||
108 | .custom(isBooleanValid), | 101 | .custom(isBooleanValid), |
109 | 102 | ||
110 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 103 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
111 | logger.debug('Checking listPluginsValidator parameters', { parameters: req.query }) | ||
112 | |||
113 | if (areValidationErrors(req, res)) return | 104 | if (areValidationErrors(req, res)) return |
114 | 105 | ||
115 | return next() | 106 | return next() |
@@ -128,8 +119,6 @@ const installOrUpdatePluginValidator = [ | |||
128 | .custom(isSafePath), | 119 | .custom(isSafePath), |
129 | 120 | ||
130 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 121 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
131 | logger.debug('Checking installOrUpdatePluginValidator parameters', { parameters: req.body }) | ||
132 | |||
133 | if (areValidationErrors(req, res)) return | 122 | if (areValidationErrors(req, res)) return |
134 | 123 | ||
135 | const body: InstallOrUpdatePlugin = req.body | 124 | const body: InstallOrUpdatePlugin = req.body |
@@ -149,8 +138,6 @@ const uninstallPluginValidator = [ | |||
149 | .custom(isNpmPluginNameValid), | 138 | .custom(isNpmPluginNameValid), |
150 | 139 | ||
151 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 140 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
152 | logger.debug('Checking uninstallPluginValidator parameters', { parameters: req.body }) | ||
153 | |||
154 | if (areValidationErrors(req, res)) return | 141 | if (areValidationErrors(req, res)) return |
155 | 142 | ||
156 | return next() | 143 | return next() |
@@ -162,8 +149,6 @@ const existingPluginValidator = [ | |||
162 | .custom(isNpmPluginNameValid), | 149 | .custom(isNpmPluginNameValid), |
163 | 150 | ||
164 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 151 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
165 | logger.debug('Checking enabledPluginValidator parameters', { parameters: req.params }) | ||
166 | |||
167 | if (areValidationErrors(req, res)) return | 152 | if (areValidationErrors(req, res)) return |
168 | 153 | ||
169 | const plugin = await PluginModel.loadByNpmName(req.params.npmName) | 154 | const plugin = await PluginModel.loadByNpmName(req.params.npmName) |
@@ -184,8 +169,6 @@ const updatePluginSettingsValidator = [ | |||
184 | .exists(), | 169 | .exists(), |
185 | 170 | ||
186 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 171 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
187 | logger.debug('Checking enabledPluginValidator parameters', { parameters: req.body }) | ||
188 | |||
189 | if (areValidationErrors(req, res)) return | 172 | if (areValidationErrors(req, res)) return |
190 | 173 | ||
191 | return next() | 174 | return next() |
@@ -205,8 +188,6 @@ const listAvailablePluginsValidator = [ | |||
205 | .custom(isPluginVersionValid), | 188 | .custom(isPluginVersionValid), |
206 | 189 | ||
207 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 190 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
208 | logger.debug('Checking enabledPluginValidator parameters', { parameters: req.query }) | ||
209 | |||
210 | if (areValidationErrors(req, res)) return | 191 | if (areValidationErrors(req, res)) return |
211 | 192 | ||
212 | if (CONFIG.PLUGINS.INDEX.ENABLED === false) { | 193 | if (CONFIG.PLUGINS.INDEX.ENABLED === false) { |
diff --git a/server/middlewares/validators/redundancy.ts b/server/middlewares/validators/redundancy.ts index a74772bd1..79460f63c 100644 --- a/server/middlewares/validators/redundancy.ts +++ b/server/middlewares/validators/redundancy.ts | |||
@@ -12,7 +12,6 @@ import { | |||
12 | toIntOrNull | 12 | toIntOrNull |
13 | } from '../../helpers/custom-validators/misc' | 13 | } from '../../helpers/custom-validators/misc' |
14 | import { isHostValid } from '../../helpers/custom-validators/servers' | 14 | import { isHostValid } from '../../helpers/custom-validators/servers' |
15 | import { logger } from '../../helpers/logger' | ||
16 | import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy' | 15 | import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy' |
17 | import { ServerModel } from '../../models/server/server' | 16 | import { ServerModel } from '../../models/server/server' |
18 | import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from './shared' | 17 | import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from './shared' |
@@ -29,8 +28,6 @@ const videoFileRedundancyGetValidator = [ | |||
29 | .custom(exists), | 28 | .custom(exists), |
30 | 29 | ||
31 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 30 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
32 | logger.debug('Checking videoFileRedundancyGetValidator parameters', { parameters: req.params }) | ||
33 | |||
34 | if (areValidationErrors(req, res)) return | 31 | if (areValidationErrors(req, res)) return |
35 | if (!await doesVideoExist(req.params.videoId, res)) return | 32 | if (!await doesVideoExist(req.params.videoId, res)) return |
36 | 33 | ||
@@ -72,8 +69,6 @@ const videoPlaylistRedundancyGetValidator = [ | |||
72 | .custom(exists), | 69 | .custom(exists), |
73 | 70 | ||
74 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 71 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
75 | logger.debug('Checking videoPlaylistRedundancyGetValidator parameters', { parameters: req.params }) | ||
76 | |||
77 | if (areValidationErrors(req, res)) return | 72 | if (areValidationErrors(req, res)) return |
78 | if (!await doesVideoExist(req.params.videoId, res)) return | 73 | if (!await doesVideoExist(req.params.videoId, res)) return |
79 | 74 | ||
@@ -112,8 +107,6 @@ const updateServerRedundancyValidator = [ | |||
112 | .custom(isBooleanValid).withMessage('Should have a valid redundancyAllowed boolean'), | 107 | .custom(isBooleanValid).withMessage('Should have a valid redundancyAllowed boolean'), |
113 | 108 | ||
114 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 109 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
115 | logger.debug('Checking updateServerRedundancy parameters', { parameters: req.params }) | ||
116 | |||
117 | if (areValidationErrors(req, res)) return | 110 | if (areValidationErrors(req, res)) return |
118 | 111 | ||
119 | const server = await ServerModel.loadByHost(req.params.host) | 112 | const server = await ServerModel.loadByHost(req.params.host) |
@@ -135,8 +128,6 @@ const listVideoRedundanciesValidator = [ | |||
135 | .custom(isVideoRedundancyTarget), | 128 | .custom(isVideoRedundancyTarget), |
136 | 129 | ||
137 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 130 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
138 | logger.debug('Checking listVideoRedundanciesValidator parameters', { parameters: req.query }) | ||
139 | |||
140 | if (areValidationErrors(req, res)) return | 131 | if (areValidationErrors(req, res)) return |
141 | 132 | ||
142 | return next() | 133 | return next() |
@@ -149,8 +140,6 @@ const addVideoRedundancyValidator = [ | |||
149 | .custom(isIdOrUUIDValid), | 140 | .custom(isIdOrUUIDValid), |
150 | 141 | ||
151 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 142 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
152 | logger.debug('Checking addVideoRedundancyValidator parameters', { parameters: req.query }) | ||
153 | |||
154 | if (areValidationErrors(req, res)) return | 143 | if (areValidationErrors(req, res)) return |
155 | 144 | ||
156 | if (!await doesVideoExist(req.body.videoId, res, 'only-video')) return | 145 | if (!await doesVideoExist(req.body.videoId, res, 'only-video')) return |
@@ -180,8 +169,6 @@ const removeVideoRedundancyValidator = [ | |||
180 | .custom(isIdValid), | 169 | .custom(isIdValid), |
181 | 170 | ||
182 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 171 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
183 | logger.debug('Checking removeVideoRedundancyValidator parameters', { parameters: req.query }) | ||
184 | |||
185 | if (areValidationErrors(req, res)) return | 172 | if (areValidationErrors(req, res)) return |
186 | 173 | ||
187 | const redundancy = await VideoRedundancyModel.loadByIdWithVideo(parseInt(req.params.redundancyId, 10)) | 174 | const redundancy = await VideoRedundancyModel.loadByIdWithVideo(parseInt(req.params.redundancyId, 10)) |
diff --git a/server/middlewares/validators/search.ts b/server/middlewares/validators/search.ts index 827132468..a63fd0893 100644 --- a/server/middlewares/validators/search.ts +++ b/server/middlewares/validators/search.ts | |||
@@ -3,7 +3,6 @@ import { query } from 'express-validator' | |||
3 | import { isSearchTargetValid } from '@server/helpers/custom-validators/search' | 3 | import { isSearchTargetValid } from '@server/helpers/custom-validators/search' |
4 | import { isHostValid } from '@server/helpers/custom-validators/servers' | 4 | import { isHostValid } from '@server/helpers/custom-validators/servers' |
5 | import { areUUIDsValid, isDateValid, isNotEmptyStringArray, toCompleteUUIDs } from '../../helpers/custom-validators/misc' | 5 | import { areUUIDsValid, isDateValid, isNotEmptyStringArray, toCompleteUUIDs } from '../../helpers/custom-validators/misc' |
6 | import { logger } from '../../helpers/logger' | ||
7 | import { areValidationErrors } from './shared' | 6 | import { areValidationErrors } from './shared' |
8 | 7 | ||
9 | const videosSearchValidator = [ | 8 | const videosSearchValidator = [ |
@@ -47,8 +46,6 @@ const videosSearchValidator = [ | |||
47 | .custom(isSearchTargetValid), | 46 | .custom(isSearchTargetValid), |
48 | 47 | ||
49 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 48 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
50 | logger.debug('Checking videos search query', { parameters: req.query }) | ||
51 | |||
52 | if (areValidationErrors(req, res)) return | 49 | if (areValidationErrors(req, res)) return |
53 | 50 | ||
54 | return next() | 51 | return next() |
@@ -74,8 +71,6 @@ const videoChannelsListSearchValidator = [ | |||
74 | .custom(isNotEmptyStringArray).withMessage('Should have valid array of handles'), | 71 | .custom(isNotEmptyStringArray).withMessage('Should have valid array of handles'), |
75 | 72 | ||
76 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 73 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
77 | logger.debug('Checking video channels search query', { parameters: req.query }) | ||
78 | |||
79 | if (areValidationErrors(req, res)) return | 74 | if (areValidationErrors(req, res)) return |
80 | 75 | ||
81 | return next() | 76 | return next() |
@@ -102,8 +97,6 @@ const videoPlaylistsListSearchValidator = [ | |||
102 | .custom(areUUIDsValid).withMessage('Should have valid array of uuid'), | 97 | .custom(areUUIDsValid).withMessage('Should have valid array of uuid'), |
103 | 98 | ||
104 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 99 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
105 | logger.debug('Checking video playlists search query', { parameters: req.query }) | ||
106 | |||
107 | if (areValidationErrors(req, res)) return | 100 | if (areValidationErrors(req, res)) return |
108 | 101 | ||
109 | return next() | 102 | return next() |
diff --git a/server/middlewares/validators/server.ts b/server/middlewares/validators/server.ts index f6177f600..d040e8a1f 100644 --- a/server/middlewares/validators/server.ts +++ b/server/middlewares/validators/server.ts | |||
@@ -13,8 +13,6 @@ const serverGetValidator = [ | |||
13 | body('host').custom(isHostValid).withMessage('Should have a valid host'), | 13 | body('host').custom(isHostValid).withMessage('Should have a valid host'), |
14 | 14 | ||
15 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 15 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
16 | logger.debug('Checking serverGetValidator parameters', { parameters: req.body }) | ||
17 | |||
18 | if (areValidationErrors(req, res)) return | 16 | if (areValidationErrors(req, res)) return |
19 | 17 | ||
20 | const server = await ServerModel.loadByHost(req.body.host) | 18 | const server = await ServerModel.loadByHost(req.body.host) |
@@ -40,8 +38,6 @@ const contactAdministratorValidator = [ | |||
40 | .custom(isValidContactBody), | 38 | .custom(isValidContactBody), |
41 | 39 | ||
42 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 40 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
43 | logger.debug('Checking contactAdministratorValidator parameters', { parameters: req.body }) | ||
44 | |||
45 | if (areValidationErrors(req, res)) return | 41 | if (areValidationErrors(req, res)) return |
46 | 42 | ||
47 | if (CONFIG.CONTACT_FORM.ENABLED === false) { | 43 | if (CONFIG.CONTACT_FORM.ENABLED === false) { |
diff --git a/server/middlewares/validators/shared/utils.ts b/server/middlewares/validators/shared/utils.ts index 77b64bc7a..f39128fdd 100644 --- a/server/middlewares/validators/shared/utils.ts +++ b/server/middlewares/validators/shared/utils.ts | |||
@@ -3,7 +3,32 @@ import { param, validationResult } from 'express-validator' | |||
3 | import { isIdOrUUIDValid, toCompleteUUID } from '@server/helpers/custom-validators/misc' | 3 | import { isIdOrUUIDValid, toCompleteUUID } from '@server/helpers/custom-validators/misc' |
4 | import { logger } from '../../../helpers/logger' | 4 | import { logger } from '../../../helpers/logger' |
5 | 5 | ||
6 | function areValidationErrors (req: express.Request, res: express.Response) { | 6 | function areValidationErrors ( |
7 | req: express.Request, | ||
8 | res: express.Response, | ||
9 | options: { | ||
10 | omitLog?: boolean | ||
11 | omitBodyLog?: boolean | ||
12 | tags?: string[] | ||
13 | } = {}) { | ||
14 | const { omitLog = false, omitBodyLog = false, tags = [] } = options | ||
15 | |||
16 | if (!omitLog) { | ||
17 | logger.debug( | ||
18 | 'Checking %s - %s parameters', | ||
19 | req.method, req.originalUrl, | ||
20 | { | ||
21 | body: omitBodyLog | ||
22 | ? 'omitted' | ||
23 | : req.body, | ||
24 | params: req.params, | ||
25 | query: req.query, | ||
26 | files: req.files, | ||
27 | tags | ||
28 | } | ||
29 | ) | ||
30 | } | ||
31 | |||
7 | const errors = validationResult(req) | 32 | const errors = validationResult(req) |
8 | 33 | ||
9 | if (!errors.isEmpty()) { | 34 | if (!errors.isEmpty()) { |
diff --git a/server/middlewares/validators/sort.ts b/server/middlewares/validators/sort.ts index 269f1be53..7d0639107 100644 --- a/server/middlewares/validators/sort.ts +++ b/server/middlewares/validators/sort.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { query } from 'express-validator' | 2 | import { query } from 'express-validator' |
3 | import { logger } from '@server/helpers/logger' | 3 | |
4 | import { SORTABLE_COLUMNS } from '../../initializers/constants' | 4 | import { SORTABLE_COLUMNS } from '../../initializers/constants' |
5 | import { areValidationErrors } from './shared' | 5 | import { areValidationErrors } from './shared' |
6 | 6 | ||
@@ -15,9 +15,7 @@ function checkSort (sortableColumns: string[], tags: string[] = []) { | |||
15 | .isIn(sortableColumns), | 15 | .isIn(sortableColumns), |
16 | 16 | ||
17 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 17 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
18 | logger.debug('Checking sort parameters', { parameters: req.query, tags }) | 18 | if (areValidationErrors(req, res, { tags })) return |
19 | |||
20 | if (areValidationErrors(req, res)) return | ||
21 | 19 | ||
22 | return next() | 20 | return next() |
23 | } | 21 | } |
diff --git a/server/middlewares/validators/themes.ts b/server/middlewares/validators/themes.ts index f6a8c2d92..c130801a0 100644 --- a/server/middlewares/validators/themes.ts +++ b/server/middlewares/validators/themes.ts | |||
@@ -3,7 +3,6 @@ import { param } from 'express-validator' | |||
3 | import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' | 3 | import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' |
4 | import { isSafePath } from '../../helpers/custom-validators/misc' | 4 | import { isSafePath } from '../../helpers/custom-validators/misc' |
5 | import { isPluginNameValid, isPluginVersionValid } from '../../helpers/custom-validators/plugins' | 5 | import { isPluginNameValid, isPluginVersionValid } from '../../helpers/custom-validators/plugins' |
6 | import { logger } from '../../helpers/logger' | ||
7 | import { PluginManager } from '../../lib/plugins/plugin-manager' | 6 | import { PluginManager } from '../../lib/plugins/plugin-manager' |
8 | import { areValidationErrors } from './shared' | 7 | import { areValidationErrors } from './shared' |
9 | 8 | ||
@@ -16,8 +15,6 @@ const serveThemeCSSValidator = [ | |||
16 | .custom(isSafePath), | 15 | .custom(isSafePath), |
17 | 16 | ||
18 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 17 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
19 | logger.debug('Checking serveThemeCSS parameters', { parameters: req.params }) | ||
20 | |||
21 | if (areValidationErrors(req, res)) return | 18 | if (areValidationErrors(req, res)) return |
22 | 19 | ||
23 | const theme = PluginManager.Instance.getRegisteredThemeByShortName(req.params.themeName) | 20 | const theme = PluginManager.Instance.getRegisteredThemeByShortName(req.params.themeName) |
diff --git a/server/middlewares/validators/user-history.ts b/server/middlewares/validators/user-history.ts index 23a00888c..f2dae3134 100644 --- a/server/middlewares/validators/user-history.ts +++ b/server/middlewares/validators/user-history.ts | |||
@@ -1,7 +1,6 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { body, param, query } from 'express-validator' | 2 | import { body, param, query } from 'express-validator' |
3 | import { exists, isDateValid, isIdValid } from '../../helpers/custom-validators/misc' | 3 | import { exists, isDateValid, isIdValid } from '../../helpers/custom-validators/misc' |
4 | import { logger } from '../../helpers/logger' | ||
5 | import { areValidationErrors } from './shared' | 4 | import { areValidationErrors } from './shared' |
6 | 5 | ||
7 | const userHistoryListValidator = [ | 6 | const userHistoryListValidator = [ |
@@ -10,8 +9,6 @@ const userHistoryListValidator = [ | |||
10 | .custom(exists), | 9 | .custom(exists), |
11 | 10 | ||
12 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 11 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
13 | logger.debug('Checking userHistoryListValidator parameters', { parameters: req.query }) | ||
14 | |||
15 | if (areValidationErrors(req, res)) return | 12 | if (areValidationErrors(req, res)) return |
16 | 13 | ||
17 | return next() | 14 | return next() |
@@ -24,8 +21,6 @@ const userHistoryRemoveAllValidator = [ | |||
24 | .custom(isDateValid).withMessage('Should have a before date that conforms to ISO 8601'), | 21 | .custom(isDateValid).withMessage('Should have a before date that conforms to ISO 8601'), |
25 | 22 | ||
26 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 23 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
27 | logger.debug('Checking userHistoryRemoveAllValidator parameters', { parameters: req.body }) | ||
28 | |||
29 | if (areValidationErrors(req, res)) return | 24 | if (areValidationErrors(req, res)) return |
30 | 25 | ||
31 | return next() | 26 | return next() |
@@ -37,8 +32,6 @@ const userHistoryRemoveElementValidator = [ | |||
37 | .custom(isIdValid), | 32 | .custom(isIdValid), |
38 | 33 | ||
39 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 34 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
40 | logger.debug('Checking userHistoryRemoveElementValidator parameters', { parameters: req.params }) | ||
41 | |||
42 | if (areValidationErrors(req, res)) return | 35 | if (areValidationErrors(req, res)) return |
43 | 36 | ||
44 | return next() | 37 | return next() |
diff --git a/server/middlewares/validators/user-notifications.ts b/server/middlewares/validators/user-notifications.ts index f46303ab8..8d70dcdd2 100644 --- a/server/middlewares/validators/user-notifications.ts +++ b/server/middlewares/validators/user-notifications.ts | |||
@@ -2,7 +2,6 @@ import express from 'express' | |||
2 | import { body, query } from 'express-validator' | 2 | import { body, query } from 'express-validator' |
3 | import { isNotEmptyIntArray, toBooleanOrNull } from '../../helpers/custom-validators/misc' | 3 | import { isNotEmptyIntArray, toBooleanOrNull } from '../../helpers/custom-validators/misc' |
4 | import { isUserNotificationSettingValid } from '../../helpers/custom-validators/user-notifications' | 4 | import { isUserNotificationSettingValid } from '../../helpers/custom-validators/user-notifications' |
5 | import { logger } from '../../helpers/logger' | ||
6 | import { areValidationErrors } from './shared' | 5 | import { areValidationErrors } from './shared' |
7 | 6 | ||
8 | const listUserNotificationsValidator = [ | 7 | const listUserNotificationsValidator = [ |
@@ -12,8 +11,6 @@ const listUserNotificationsValidator = [ | |||
12 | .isBoolean().withMessage('Should have a valid unread boolean'), | 11 | .isBoolean().withMessage('Should have a valid unread boolean'), |
13 | 12 | ||
14 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 13 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
15 | logger.debug('Checking listUserNotificationsValidator parameters', { parameters: req.query }) | ||
16 | |||
17 | if (areValidationErrors(req, res)) return | 14 | if (areValidationErrors(req, res)) return |
18 | 15 | ||
19 | return next() | 16 | return next() |
@@ -47,8 +44,6 @@ const updateNotificationSettingsValidator = [ | |||
47 | .custom(isUserNotificationSettingValid), | 44 | .custom(isUserNotificationSettingValid), |
48 | 45 | ||
49 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 46 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
50 | logger.debug('Checking updateNotificationSettingsValidator parameters', { parameters: req.body }) | ||
51 | |||
52 | if (areValidationErrors(req, res)) return | 47 | if (areValidationErrors(req, res)) return |
53 | 48 | ||
54 | return next() | 49 | return next() |
@@ -61,8 +56,6 @@ const markAsReadUserNotificationsValidator = [ | |||
61 | .custom(isNotEmptyIntArray).withMessage('Should have a valid array of notification ids'), | 56 | .custom(isNotEmptyIntArray).withMessage('Should have a valid array of notification ids'), |
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 markAsReadUserNotificationsValidator parameters', { parameters: req.body }) | ||
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/user-subscriptions.ts b/server/middlewares/validators/user-subscriptions.ts index d9e6aa667..a76628915 100644 --- a/server/middlewares/validators/user-subscriptions.ts +++ b/server/middlewares/validators/user-subscriptions.ts | |||
@@ -3,7 +3,6 @@ import { body, param, query } from 'express-validator' | |||
3 | import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' | 3 | import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' |
4 | import { areValidActorHandles, isValidActorHandle } from '../../helpers/custom-validators/activitypub/actor' | 4 | import { areValidActorHandles, isValidActorHandle } from '../../helpers/custom-validators/activitypub/actor' |
5 | import { toArray } from '../../helpers/custom-validators/misc' | 5 | import { toArray } from '../../helpers/custom-validators/misc' |
6 | import { logger } from '../../helpers/logger' | ||
7 | import { WEBSERVER } from '../../initializers/constants' | 6 | import { WEBSERVER } from '../../initializers/constants' |
8 | import { ActorFollowModel } from '../../models/actor/actor-follow' | 7 | import { ActorFollowModel } from '../../models/actor/actor-follow' |
9 | import { areValidationErrors } from './shared' | 8 | import { areValidationErrors } from './shared' |
@@ -14,8 +13,6 @@ const userSubscriptionListValidator = [ | |||
14 | .not().isEmpty(), | 13 | .not().isEmpty(), |
15 | 14 | ||
16 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 15 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
17 | logger.debug('Checking userSubscriptionListValidator parameters', { parameters: req.query }) | ||
18 | |||
19 | if (areValidationErrors(req, res)) return | 16 | if (areValidationErrors(req, res)) return |
20 | 17 | ||
21 | return next() | 18 | return next() |
@@ -27,8 +24,6 @@ const userSubscriptionAddValidator = [ | |||
27 | .custom(isValidActorHandle).withMessage('Should have a valid URI to follow (username@domain)'), | 24 | .custom(isValidActorHandle).withMessage('Should have a valid URI to follow (username@domain)'), |
28 | 25 | ||
29 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 26 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
30 | logger.debug('Checking userSubscriptionAddValidator parameters', { parameters: req.body }) | ||
31 | |||
32 | if (areValidationErrors(req, res)) return | 27 | if (areValidationErrors(req, res)) return |
33 | 28 | ||
34 | return next() | 29 | return next() |
@@ -41,8 +36,6 @@ const areSubscriptionsExistValidator = [ | |||
41 | .custom(areValidActorHandles).withMessage('Should have a valid array of URIs'), | 36 | .custom(areValidActorHandles).withMessage('Should have a valid array of URIs'), |
42 | 37 | ||
43 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 38 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
44 | logger.debug('Checking areSubscriptionsExistValidator parameters', { parameters: req.query }) | ||
45 | |||
46 | if (areValidationErrors(req, res)) return | 39 | if (areValidationErrors(req, res)) return |
47 | 40 | ||
48 | return next() | 41 | return next() |
@@ -54,8 +47,6 @@ const userSubscriptionGetValidator = [ | |||
54 | .custom(isValidActorHandle), | 47 | .custom(isValidActorHandle), |
55 | 48 | ||
56 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 49 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
57 | logger.debug('Checking userSubscriptionGetValidator parameters', { parameters: req.params }) | ||
58 | |||
59 | if (areValidationErrors(req, res)) return | 50 | if (areValidationErrors(req, res)) return |
60 | 51 | ||
61 | let [ name, host ] = req.params.uri.split('@') | 52 | let [ name, host ] = req.params.uri.split('@') |
diff --git a/server/middlewares/validators/users.ts b/server/middlewares/validators/users.ts index c3a07fccd..282034f6d 100644 --- a/server/middlewares/validators/users.ts +++ b/server/middlewares/validators/users.ts | |||
@@ -1,6 +1,5 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { body, param, query } from 'express-validator' | 2 | import { body, param, query } from 'express-validator' |
3 | import { omit } from 'lodash' | ||
4 | import { Hooks } from '@server/lib/plugins/hooks' | 3 | import { Hooks } from '@server/lib/plugins/hooks' |
5 | import { MUserDefault } from '@server/types/models' | 4 | import { MUserDefault } from '@server/types/models' |
6 | import { HttpStatusCode, UserRegister, UserRight, UserRole } from '@shared/models' | 5 | import { HttpStatusCode, UserRegister, UserRight, UserRole } from '@shared/models' |
@@ -41,8 +40,6 @@ const usersListValidator = [ | |||
41 | .isBoolean().withMessage('Should be a valid blocked boolena'), | 40 | .isBoolean().withMessage('Should be a valid blocked boolena'), |
42 | 41 | ||
43 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 42 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
44 | logger.debug('Checking usersList parameters', { parameters: req.query }) | ||
45 | |||
46 | if (areValidationErrors(req, res)) return | 43 | if (areValidationErrors(req, res)) return |
47 | 44 | ||
48 | return next() | 45 | return next() |
@@ -76,9 +73,7 @@ const usersAddValidator = [ | |||
76 | .custom(isUserAdminFlagsValid), | 73 | .custom(isUserAdminFlagsValid), |
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 usersAdd parameters', { parameters: omit(req.body, 'password') }) | 76 | if (areValidationErrors(req, res, { omitBodyLog: true })) return |
80 | |||
81 | if (areValidationErrors(req, res)) return | ||
82 | if (!await checkUserNameOrEmailDoesNotAlreadyExist(req.body.username, req.body.email, res)) return | 77 | if (!await checkUserNameOrEmailDoesNotAlreadyExist(req.body.username, req.body.email, res)) return |
83 | 78 | ||
84 | const authUser = res.locals.oauth.token.User | 79 | const authUser = res.locals.oauth.token.User |
@@ -126,9 +121,7 @@ const usersRegisterValidator = [ | |||
126 | .custom(isVideoChannelDisplayNameValid), | 121 | .custom(isVideoChannelDisplayNameValid), |
127 | 122 | ||
128 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 123 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
129 | logger.debug('Checking usersRegister parameters', { parameters: omit(req.body, 'password') }) | 124 | if (areValidationErrors(req, res, { omitBodyLog: true })) return |
130 | |||
131 | if (areValidationErrors(req, res)) return | ||
132 | if (!await checkUserNameOrEmailDoesNotAlreadyExist(req.body.username, req.body.email, res)) return | 125 | if (!await checkUserNameOrEmailDoesNotAlreadyExist(req.body.username, req.body.email, res)) return |
133 | 126 | ||
134 | const body: UserRegister = req.body | 127 | const body: UserRegister = req.body |
@@ -159,8 +152,6 @@ const usersRemoveValidator = [ | |||
159 | .custom(isIdValid), | 152 | .custom(isIdValid), |
160 | 153 | ||
161 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 154 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
162 | logger.debug('Checking usersRemove parameters', { parameters: req.params }) | ||
163 | |||
164 | if (areValidationErrors(req, res)) return | 155 | if (areValidationErrors(req, res)) return |
165 | if (!await checkUserIdExist(req.params.id, res)) return | 156 | if (!await checkUserIdExist(req.params.id, res)) return |
166 | 157 | ||
@@ -181,8 +172,6 @@ const usersBlockingValidator = [ | |||
181 | .custom(isUserBlockedReasonValid), | 172 | .custom(isUserBlockedReasonValid), |
182 | 173 | ||
183 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 174 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
184 | logger.debug('Checking usersBlocking parameters', { parameters: req.params }) | ||
185 | |||
186 | if (areValidationErrors(req, res)) return | 175 | if (areValidationErrors(req, res)) return |
187 | if (!await checkUserIdExist(req.params.id, res)) return | 176 | if (!await checkUserIdExist(req.params.id, res)) return |
188 | 177 | ||
@@ -236,9 +225,7 @@ const usersUpdateValidator = [ | |||
236 | .custom(isUserAdminFlagsValid), | 225 | .custom(isUserAdminFlagsValid), |
237 | 226 | ||
238 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 227 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
239 | logger.debug('Checking usersUpdate parameters', { parameters: req.body }) | 228 | if (areValidationErrors(req, res, { omitBodyLog: true })) return |
240 | |||
241 | if (areValidationErrors(req, res)) return | ||
242 | if (!await checkUserIdExist(req.params.id, res)) return | 229 | if (!await checkUserIdExist(req.params.id, res)) return |
243 | 230 | ||
244 | const user = res.locals.user | 231 | const user = res.locals.user |
@@ -300,8 +287,6 @@ const usersUpdateMeValidator = [ | |||
300 | .custom(v => isUserAutoPlayNextVideoValid(v)).withMessage('Should have a valid autoPlayNextVideo boolean'), | 287 | .custom(v => isUserAutoPlayNextVideoValid(v)).withMessage('Should have a valid autoPlayNextVideo boolean'), |
301 | 288 | ||
302 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 289 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
303 | logger.debug('Checking usersUpdateMe parameters', { parameters: omit(req.body, 'password') }) | ||
304 | |||
305 | const user = res.locals.oauth.token.User | 290 | const user = res.locals.oauth.token.User |
306 | 291 | ||
307 | if (req.body.password || req.body.email) { | 292 | if (req.body.password || req.body.email) { |
@@ -321,7 +306,7 @@ const usersUpdateMeValidator = [ | |||
321 | } | 306 | } |
322 | } | 307 | } |
323 | 308 | ||
324 | if (areValidationErrors(req, res)) return | 309 | if (areValidationErrors(req, res, { omitBodyLog: true })) return |
325 | 310 | ||
326 | return next() | 311 | return next() |
327 | } | 312 | } |
@@ -335,8 +320,6 @@ const usersGetValidator = [ | |||
335 | .isBoolean().withMessage('Should have a valid withStats boolean'), | 320 | .isBoolean().withMessage('Should have a valid withStats boolean'), |
336 | 321 | ||
337 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 322 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
338 | logger.debug('Checking usersGet parameters', { parameters: req.params }) | ||
339 | |||
340 | if (areValidationErrors(req, res)) return | 323 | if (areValidationErrors(req, res)) return |
341 | if (!await checkUserIdExist(req.params.id, res, req.query.withStats)) return | 324 | if (!await checkUserIdExist(req.params.id, res, req.query.withStats)) return |
342 | 325 | ||
@@ -348,8 +331,6 @@ const usersVideoRatingValidator = [ | |||
348 | isValidVideoIdParam('videoId'), | 331 | isValidVideoIdParam('videoId'), |
349 | 332 | ||
350 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 333 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
351 | logger.debug('Checking usersVideoRating parameters', { parameters: req.params }) | ||
352 | |||
353 | if (areValidationErrors(req, res)) return | 334 | if (areValidationErrors(req, res)) return |
354 | if (!await doesVideoExist(req.params.videoId, res, 'id')) return | 335 | if (!await doesVideoExist(req.params.videoId, res, 'id')) return |
355 | 336 | ||
@@ -369,8 +350,6 @@ const usersVideosValidator = [ | |||
369 | .custom(isIdValid), | 350 | .custom(isIdValid), |
370 | 351 | ||
371 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 352 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
372 | logger.debug('Checking usersVideosValidator parameters', { parameters: req.query }) | ||
373 | |||
374 | if (areValidationErrors(req, res)) return | 353 | if (areValidationErrors(req, res)) return |
375 | 354 | ||
376 | if (req.query.channelId && !await doesVideoChannelIdExist(req.query.channelId, res)) return | 355 | if (req.query.channelId && !await doesVideoChannelIdExist(req.query.channelId, res)) return |
@@ -423,8 +402,6 @@ const usersAskResetPasswordValidator = [ | |||
423 | .isEmail(), | 402 | .isEmail(), |
424 | 403 | ||
425 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 404 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
426 | logger.debug('Checking usersAskResetPassword parameters', { parameters: req.body }) | ||
427 | |||
428 | if (areValidationErrors(req, res)) return | 405 | if (areValidationErrors(req, res)) return |
429 | 406 | ||
430 | const exists = await checkUserEmailExist(req.body.email, res, false) | 407 | const exists = await checkUserEmailExist(req.body.email, res, false) |
@@ -447,8 +424,6 @@ const usersResetPasswordValidator = [ | |||
447 | .custom(isUserPasswordValid), | 424 | .custom(isUserPasswordValid), |
448 | 425 | ||
449 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 426 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
450 | logger.debug('Checking usersResetPassword parameters', { parameters: req.params }) | ||
451 | |||
452 | if (areValidationErrors(req, res)) return | 427 | if (areValidationErrors(req, res)) return |
453 | if (!await checkUserIdExist(req.params.id, res)) return | 428 | if (!await checkUserIdExist(req.params.id, res)) return |
454 | 429 | ||
@@ -470,9 +445,8 @@ const usersAskSendVerifyEmailValidator = [ | |||
470 | body('email').isEmail().not().isEmpty().withMessage('Should have a valid email'), | 445 | body('email').isEmail().not().isEmpty().withMessage('Should have a valid email'), |
471 | 446 | ||
472 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 447 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
473 | logger.debug('Checking askUsersSendVerifyEmail parameters', { parameters: req.body }) | ||
474 | |||
475 | if (areValidationErrors(req, res)) return | 448 | if (areValidationErrors(req, res)) return |
449 | |||
476 | const exists = await checkUserEmailExist(req.body.email, res, false) | 450 | const exists = await checkUserEmailExist(req.body.email, res, false) |
477 | if (!exists) { | 451 | if (!exists) { |
478 | logger.debug('User with email %s does not exist (asking verify email).', req.body.email) | 452 | logger.debug('User with email %s does not exist (asking verify email).', req.body.email) |
@@ -495,8 +469,6 @@ const usersVerifyEmailValidator = [ | |||
495 | .customSanitizer(toBooleanOrNull), | 469 | .customSanitizer(toBooleanOrNull), |
496 | 470 | ||
497 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 471 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
498 | logger.debug('Checking usersVerifyEmail parameters', { parameters: req.params }) | ||
499 | |||
500 | if (areValidationErrors(req, res)) return | 472 | if (areValidationErrors(req, res)) return |
501 | if (!await checkUserIdExist(req.params.id, res)) return | 473 | if (!await checkUserIdExist(req.params.id, res)) return |
502 | 474 | ||
@@ -515,7 +487,9 @@ const usersVerifyEmailValidator = [ | |||
515 | ] | 487 | ] |
516 | 488 | ||
517 | const userAutocompleteValidator = [ | 489 | const userAutocompleteValidator = [ |
518 | param('search').isString().not().isEmpty().withMessage('Should have a search parameter') | 490 | param('search') |
491 | .isString() | ||
492 | .not().isEmpty() | ||
519 | ] | 493 | ] |
520 | 494 | ||
521 | const ensureAuthUserOwnsAccountValidator = [ | 495 | const ensureAuthUserOwnsAccountValidator = [ |
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' | |||
3 | import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' | 3 | import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' |
4 | import { isBooleanValid, toBooleanOrNull, toIntOrNull } from '../../../helpers/custom-validators/misc' | 4 | import { isBooleanValid, toBooleanOrNull, toIntOrNull } from '../../../helpers/custom-validators/misc' |
5 | import { isVideoBlacklistReasonValid, isVideoBlacklistTypeValid } from '../../../helpers/custom-validators/video-blacklist' | 5 | import { isVideoBlacklistReasonValid, isVideoBlacklistTypeValid } from '../../../helpers/custom-validators/video-blacklist' |
6 | import { logger } from '../../../helpers/logger' | ||
7 | import { areValidationErrors, doesVideoBlacklistExist, doesVideoExist, isValidVideoIdParam } from '../shared' | 6 | import { areValidationErrors, doesVideoBlacklistExist, doesVideoExist, isValidVideoIdParam } from '../shared' |
8 | 7 | ||
9 | const videosBlacklistRemoveValidator = [ | 8 | const 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' | |||
3 | import { UserRight } from '@shared/models' | 3 | import { UserRight } from '@shared/models' |
4 | import { isVideoCaptionFile, isVideoCaptionLanguageValid } from '../../../helpers/custom-validators/video-captions' | 4 | import { isVideoCaptionFile, isVideoCaptionLanguageValid } from '../../../helpers/custom-validators/video-captions' |
5 | import { cleanUpReqFiles } from '../../../helpers/express-utils' | 5 | import { cleanUpReqFiles } from '../../../helpers/express-utils' |
6 | import { logger } from '../../../helpers/logger' | ||
7 | import { CONSTRAINTS_FIELDS, MIMETYPES } from '../../../initializers/constants' | 6 | import { CONSTRAINTS_FIELDS, MIMETYPES } from '../../../initializers/constants' |
8 | import { | 7 | import { |
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 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { body, param } from 'express-validator' | 2 | import { body, param } from 'express-validator' |
3 | import { isUrlValid } from '@server/helpers/custom-validators/activitypub/misc' | 3 | import { isUrlValid } from '@server/helpers/custom-validators/activitypub/misc' |
4 | import { logger } from '@server/helpers/logger' | ||
5 | import { CONFIG } from '@server/initializers/config' | 4 | import { CONFIG } from '@server/initializers/config' |
6 | import { VideoChannelSyncModel } from '@server/models/video/video-channel-sync' | 5 | import { VideoChannelSyncModel } from '@server/models/video/video-channel-sync' |
7 | import { HttpStatusCode, VideoChannelSyncCreate } from '@shared/models' | 6 | import { 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' |
15 | import { logger } from '../../../helpers/logger' | ||
16 | import { ActorModel } from '../../../models/actor/actor' | 15 | import { ActorModel } from '../../../models/actor/actor' |
17 | import { VideoChannelModel } from '../../../models/video/video-channel' | 16 | import { VideoChannelModel } from '../../../models/video/video-channel' |
18 | import { areValidationErrors, checkUserQuota, doesVideoChannelNameWithHostExist } from '../shared' | 17 | import { 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 | ||
83 | export const videoChannelsRemoveValidator = [ | 78 | export 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 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { param } from 'express-validator' | ||
3 | import { isIdValid } from '@server/helpers/custom-validators/misc' | ||
2 | import { MVideo } from '@server/types/models' | 4 | import { MVideo } from '@server/types/models' |
3 | import { HttpStatusCode } from '@shared/models' | 5 | import { HttpStatusCode } from '@shared/models' |
4 | import { logger } from '../../../helpers/logger' | ||
5 | import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared' | 6 | import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared' |
6 | import { isIdValid } from '@server/helpers/custom-validators/misc' | ||
7 | import { param } from 'express-validator' | ||
8 | 7 | ||
9 | const videoFilesDeleteWebTorrentValidator = [ | 8 | const 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' | |||
6 | import { Hooks } from '@server/lib/plugins/hooks' | 6 | import { Hooks } from '@server/lib/plugins/hooks' |
7 | import { VideoModel } from '@server/models/video/video' | 7 | import { VideoModel } from '@server/models/video/video' |
8 | import { VideoLiveModel } from '@server/models/video/video-live' | 8 | import { VideoLiveModel } from '@server/models/video/video-live' |
9 | import { VideoLiveSessionModel } from '@server/models/video/video-live-session' | ||
9 | import { | 10 | import { |
10 | HttpStatusCode, | 11 | HttpStatusCode, |
11 | LiveVideoCreate, | 12 | LiveVideoCreate, |
@@ -28,14 +29,11 @@ import { | |||
28 | isValidVideoIdParam | 29 | isValidVideoIdParam |
29 | } from '../shared' | 30 | } from '../shared' |
30 | import { getCommonVideoEditAttributes } from './videos' | 31 | import { getCommonVideoEditAttributes } from './videos' |
31 | import { VideoLiveSessionModel } from '@server/models/video/video-live-session' | ||
32 | 32 | ||
33 | const videoLiveGetValidator = [ | 33 | const 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 | ||
198 | const videoLiveListSessionsValidator = [ | 192 | const 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' | |||
2 | import { param } from 'express-validator' | 2 | import { param } from 'express-validator' |
3 | import { isIdValid } from '@server/helpers/custom-validators/misc' | 3 | import { isIdValid } from '@server/helpers/custom-validators/misc' |
4 | import { checkUserCanTerminateOwnershipChange } from '@server/helpers/custom-validators/video-ownership' | 4 | import { checkUserCanTerminateOwnershipChange } from '@server/helpers/custom-validators/video-ownership' |
5 | import { logger } from '@server/helpers/logger' | ||
6 | import { AccountModel } from '@server/models/account/account' | 5 | import { AccountModel } from '@server/models/account/account' |
7 | import { MVideoWithAllFiles } from '@server/types/models' | 6 | import { MVideoWithAllFiles } from '@server/types/models' |
8 | import { HttpStatusCode, UserRight, VideoChangeOwnershipAccept, VideoChangeOwnershipStatus, VideoState } from '@shared/models' | 7 | import { 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' |
30 | import { isVideoImageValid } from '../../../helpers/custom-validators/videos' | 30 | import { isVideoImageValid } from '../../../helpers/custom-validators/videos' |
31 | import { cleanUpReqFiles } from '../../../helpers/express-utils' | 31 | import { cleanUpReqFiles } from '../../../helpers/express-utils' |
32 | import { logger } from '../../../helpers/logger' | ||
33 | import { CONSTRAINTS_FIELDS } from '../../../initializers/constants' | 32 | import { CONSTRAINTS_FIELDS } from '../../../initializers/constants' |
34 | import { VideoPlaylistElementModel } from '../../../models/video/video-playlist-element' | 33 | import { VideoPlaylistElementModel } from '../../../models/video/video-playlist-element' |
35 | import { MVideoPlaylist } from '../../../types/models/video/video-playlist' | 34 | import { 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' | |||
6 | import { isIdValid } from '../../../helpers/custom-validators/misc' | 6 | import { isIdValid } from '../../../helpers/custom-validators/misc' |
7 | import { isRatingValid } from '../../../helpers/custom-validators/video-rates' | 7 | import { isRatingValid } from '../../../helpers/custom-validators/video-rates' |
8 | import { isVideoRatingTypeValid } from '../../../helpers/custom-validators/videos' | 8 | import { isVideoRatingTypeValid } from '../../../helpers/custom-validators/videos' |
9 | import { logger } from '../../../helpers/logger' | ||
10 | import { AccountVideoRateModel } from '../../../models/account/account-video-rate' | 9 | import { AccountVideoRateModel } from '../../../models/account/account-video-rate' |
11 | import { areValidationErrors, checkCanSeeVideo, doesVideoExist, isValidVideoIdParam } from '../shared' | 10 | import { 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' | |||
2 | import { param } from 'express-validator' | 2 | import { param } from 'express-validator' |
3 | import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' | 3 | import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' |
4 | import { isIdValid } from '../../../helpers/custom-validators/misc' | 4 | import { isIdValid } from '../../../helpers/custom-validators/misc' |
5 | import { logger } from '../../../helpers/logger' | ||
6 | import { VideoShareModel } from '../../../models/video/video-share' | 5 | import { VideoShareModel } from '../../../models/video/video-share' |
7 | import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared' | 6 | import { 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' | |||
3 | import { VideoSourceModel } from '@server/models/video/video-source' | 3 | import { VideoSourceModel } from '@server/models/video/video-source' |
4 | import { MVideoFullLight } from '@server/types/models' | 4 | import { MVideoFullLight } from '@server/types/models' |
5 | import { HttpStatusCode, UserRight } from '@shared/models' | 5 | import { HttpStatusCode, UserRight } from '@shared/models' |
6 | import { logger } from '../../../helpers/logger' | ||
7 | import { areValidationErrors, checkUserCanManageVideo, doesVideoExist, isValidVideoIdParam } from '../shared' | 6 | import { areValidationErrors, checkUserCanManageVideo, doesVideoExist, isValidVideoIdParam } from '../shared' |
8 | 7 | ||
9 | const videoSourceGetValidator = [ | 8 | const 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' | |||
4 | import { isValidStatTimeserieMetric } from '@server/helpers/custom-validators/video-stats' | 4 | import { isValidStatTimeserieMetric } from '@server/helpers/custom-validators/video-stats' |
5 | import { STATS_TIMESERIE } from '@server/initializers/constants' | 5 | import { STATS_TIMESERIE } from '@server/initializers/constants' |
6 | import { HttpStatusCode, UserRight, VideoStatsTimeserieQuery } from '@shared/models' | 6 | import { HttpStatusCode, UserRight, VideoStatsTimeserieQuery } from '@shared/models' |
7 | import { logger } from '../../../helpers/logger' | ||
8 | import { areValidationErrors, checkUserCanManageVideo, doesVideoExist, isValidVideoIdParam } from '../shared' | 7 | import { areValidationErrors, checkUserCanManageVideo, doesVideoExist, isValidVideoIdParam } from '../shared' |
9 | 8 | ||
10 | const videoOverallStatsValidator = [ | 9 | const 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' | |||
12 | import { approximateIntroOutroAdditionalSize, getTaskFile } from '@server/lib/video-studio' | 12 | import { approximateIntroOutroAdditionalSize, getTaskFile } from '@server/lib/video-studio' |
13 | import { isAudioFile } from '@shared/extra-utils' | 13 | import { isAudioFile } from '@shared/extra-utils' |
14 | import { HttpStatusCode, UserRight, VideoState, VideoStudioCreateEdition, VideoStudioTask } from '@shared/models' | 14 | import { HttpStatusCode, UserRight, VideoState, VideoStudioCreateEdition, VideoStudioTask } from '@shared/models' |
15 | import { logger } from '../../../helpers/logger' | ||
16 | import { areValidationErrors, checkUserCanManageVideo, checkUserQuota, doesVideoExist } from '../shared' | 15 | import { areValidationErrors, checkUserCanManageVideo, checkUserQuota, doesVideoExist } from '../shared' |
17 | 16 | ||
18 | const videoStudioAddEditionValidator = [ | 17 | const 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/ | |||
4 | import { CONFIG } from '@server/initializers/config' | 4 | import { CONFIG } from '@server/initializers/config' |
5 | import { VideoJobInfoModel } from '@server/models/video/video-job-info' | 5 | import { VideoJobInfoModel } from '@server/models/video/video-job-info' |
6 | import { HttpStatusCode } from '@shared/models' | 6 | import { HttpStatusCode } from '@shared/models' |
7 | import { logger } from '../../../helpers/logger' | ||
8 | import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared' | 7 | import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared' |
9 | 8 | ||
10 | const createTranscodingValidator = [ | 9 | const 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 @@ | |||
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 | ||
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 |
diff --git a/server/middlewares/validators/webfinger.ts b/server/middlewares/validators/webfinger.ts index 4c176f162..dcfba99fa 100644 --- a/server/middlewares/validators/webfinger.ts +++ b/server/middlewares/validators/webfinger.ts | |||
@@ -3,7 +3,6 @@ import { query } from 'express-validator' | |||
3 | import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' | 3 | import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' |
4 | import { isWebfingerLocalResourceValid } from '../../helpers/custom-validators/webfinger' | 4 | import { isWebfingerLocalResourceValid } from '../../helpers/custom-validators/webfinger' |
5 | import { getHostWithPort } from '../../helpers/express-utils' | 5 | import { getHostWithPort } from '../../helpers/express-utils' |
6 | import { logger } from '../../helpers/logger' | ||
7 | import { ActorModel } from '../../models/actor/actor' | 6 | import { ActorModel } from '../../models/actor/actor' |
8 | import { areValidationErrors } from './shared' | 7 | import { areValidationErrors } from './shared' |
9 | 8 | ||
@@ -12,8 +11,6 @@ const webfingerValidator = [ | |||
12 | .custom(isWebfingerLocalResourceValid), | 11 | .custom(isWebfingerLocalResourceValid), |
13 | 12 | ||
14 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 13 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
15 | logger.debug('Checking webfinger parameters', { parameters: req.query }) | ||
16 | |||
17 | if (areValidationErrors(req, res)) return | 14 | if (areValidationErrors(req, res)) return |
18 | 15 | ||
19 | // Remove 'acct:' from the beginning of the string | 16 | // Remove 'acct:' from the beginning of the string |