]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Remove unnecessary logs
authorChocobozzz <me@florianbigard.com>
Wed, 17 Aug 2022 12:58:40 +0000 (14:58 +0200)
committerChocobozzz <me@florianbigard.com>
Wed, 17 Aug 2022 12:58:40 +0000 (14:58 +0200)
45 files changed:
server/middlewares/validators/abuse.ts
server/middlewares/validators/account.ts
server/middlewares/validators/activitypub/pagination.ts
server/middlewares/validators/activitypub/signature.ts
server/middlewares/validators/actor-image.ts
server/middlewares/validators/blocklist.ts
server/middlewares/validators/bulk.ts
server/middlewares/validators/config.ts
server/middlewares/validators/feeds.ts
server/middlewares/validators/follows.ts
server/middlewares/validators/jobs.ts
server/middlewares/validators/logs.ts
server/middlewares/validators/metrics.ts
server/middlewares/validators/oembed.ts
server/middlewares/validators/pagination.ts
server/middlewares/validators/plugins.ts
server/middlewares/validators/redundancy.ts
server/middlewares/validators/search.ts
server/middlewares/validators/server.ts
server/middlewares/validators/shared/utils.ts
server/middlewares/validators/sort.ts
server/middlewares/validators/themes.ts
server/middlewares/validators/user-history.ts
server/middlewares/validators/user-notifications.ts
server/middlewares/validators/user-subscriptions.ts
server/middlewares/validators/users.ts
server/middlewares/validators/videos/video-blacklist.ts
server/middlewares/validators/videos/video-captions.ts
server/middlewares/validators/videos/video-channel-sync.ts
server/middlewares/validators/videos/video-channels.ts
server/middlewares/validators/videos/video-comments.ts
server/middlewares/validators/videos/video-files.ts
server/middlewares/validators/videos/video-imports.ts
server/middlewares/validators/videos/video-live.ts
server/middlewares/validators/videos/video-ownership-changes.ts
server/middlewares/validators/videos/video-playlists.ts
server/middlewares/validators/videos/video-rates.ts
server/middlewares/validators/videos/video-shares.ts
server/middlewares/validators/videos/video-source.ts
server/middlewares/validators/videos/video-stats.ts
server/middlewares/validators/videos/video-studio.ts
server/middlewares/validators/videos/video-transcoding.ts
server/middlewares/validators/videos/video-view.ts
server/middlewares/validators/videos/videos.ts
server/middlewares/validators/webfinger.ts

index e4aa1a8399c7a719e5564b8a1778a30e2ad0cf07..9b94008ce2977a26d2dfd4136f087f2a89449dd4 100644 (file)
@@ -52,8 +52,6 @@ const abuseReportValidator = [
     .custom(areAbusePredefinedReasonsValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking abuseReport parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return
 
     const body: AbuseCreate = req.body
@@ -76,8 +74,6 @@ const abuseGetValidator = [
     .custom(isIdValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking abuseGetValidator parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return
     if (!await doesAbuseExist(req.params.id, res)) return
 
@@ -97,8 +93,6 @@ const abuseUpdateValidator = [
     .custom(isAbuseModerationCommentValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking abuseUpdateValidator parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return
     if (!await doesAbuseExist(req.params.id, res)) return
 
@@ -139,8 +133,6 @@ const abuseListForAdminsValidator = [
     .custom(exists),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking abuseListForAdminsValidator parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return
 
     return next()
@@ -161,8 +153,6 @@ const abuseListForUserValidator = [
     .custom(isAbuseStateValid),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking abuseListForUserValidator parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return
 
     return next()
@@ -174,8 +164,6 @@ const getAbuseValidator = [
     .custom(isIdValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking getAbuseValidator parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return
     if (!await doesAbuseExist(req.params.id, res)) return
 
@@ -198,8 +186,6 @@ const getAbuseValidator = [
 
 const checkAbuseValidForMessagesValidator = [
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking checkAbuseValidForMessagesValidator parameters', { parameters: req.body })
-
     const abuse = res.locals.abuse
     if (abuse.ReporterAccount.isOwned() === false) {
       return res.fail({ message: 'This abuse was created by a user of your instance.' })
@@ -214,8 +200,6 @@ const addAbuseMessageValidator = [
     .custom(isAbuseMessageValid),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking addAbuseMessageValidator parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return
 
     return next()
@@ -227,8 +211,6 @@ const deleteAbuseMessageValidator = [
     .custom(isIdValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking deleteAbuseMessageValidator parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return
 
     const user = res.locals.oauth.token.user
index a7534ced523441c8b4d1bd11c840cb6b70901da6..551f67d61fb68dc8d0a506b9cdddfe275dca7ef9 100644 (file)
@@ -1,7 +1,6 @@
 import express from 'express'
 import { param } from 'express-validator'
 import { isAccountNameValid } from '../../helpers/custom-validators/accounts'
-import { logger } from '../../helpers/logger'
 import { areValidationErrors, doesAccountNameWithHostExist, doesLocalAccountNameExist } from './shared'
 
 const localAccountValidator = [
@@ -9,8 +8,6 @@ const localAccountValidator = [
     .custom(isAccountNameValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking localAccountValidator parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
     if (!await doesLocalAccountNameExist(req.params.name, res)) return
 
@@ -23,8 +20,6 @@ const accountNameWithHostGetValidator = [
     .exists(),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking accountsNameWithHostGetValidator parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
     if (!await doesAccountNameWithHostExist(req.params.accountName, res)) return
 
index 69c4febaf0d1c230673d0c877a00a3998bf131bd..1259e4fef062cee65e833e110ceda4946da125ad 100644 (file)
@@ -1,7 +1,6 @@
 import express from 'express'
 import { query } from 'express-validator'
 import { PAGINATION } from '@server/initializers/constants'
-import { logger } from '../../../helpers/logger'
 import { areValidationErrors } from '../shared'
 
 const apPaginationValidator = [
@@ -13,8 +12,6 @@ const apPaginationValidator = [
     .isInt({ min: 0, max: PAGINATION.OUTBOX.COUNT.MAX }).withMessage(`Should have a valid page size (max: ${PAGINATION.OUTBOX.COUNT.MAX})`),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking pagination parameters', { parameters: req.query })
-
     if (areValidationErrors(req, res)) return
 
     return next()
index 8c133ecef24a4b26772032afb263839eaa9dc945..998d0c0c49fe70955f0e0064cd0e8bf51844145e 100644 (file)
@@ -26,7 +26,7 @@ const signatureValidator = [
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
     logger.debug('Checking Linked Data Signature parameter', { parameters: { signature: req.body.signature } })
 
-    if (areValidationErrors(req, res)) return
+    if (areValidationErrors(req, res, { omitLog: true })) return
 
     return next()
   }
index c7e9f391c84f8f013f10a23b267edcef8c1e0a05..9dcf5e8717a93d483c1cd4b8ee0ca953bcc153f1 100644 (file)
@@ -2,7 +2,6 @@ import express from 'express'
 import { body } from 'express-validator'
 import { isActorImageFile } from '@server/helpers/custom-validators/actor-images'
 import { cleanUpReqFiles } from '../../helpers/express-utils'
-import { logger } from '../../helpers/logger'
 import { CONSTRAINTS_FIELDS } from '../../initializers/constants'
 import { areValidationErrors } from './shared'
 
@@ -13,8 +12,6 @@ const updateActorImageValidatorFactory = (fieldname: string) => ([
   ),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking updateActorImageValidator parameters', { files: req.files })
-
     if (areValidationErrors(req, res)) return cleanUpReqFiles(req)
 
     return next()
index 3de614522da6e8dc4d4af8126a4155e8634de2f1..1bae3764ac1ce3519e13d45906058bdf8c42877c 100644 (file)
@@ -5,7 +5,6 @@ import { toArray } from '@server/helpers/custom-validators/misc'
 import { getServerActor } from '@server/models/application/application'
 import { HttpStatusCode } from '../../../shared/models/http/http-error-codes'
 import { isEachUniqueHostValid, isHostValid } from '../../helpers/custom-validators/servers'
-import { logger } from '../../helpers/logger'
 import { WEBSERVER } from '../../initializers/constants'
 import { AccountBlocklistModel } from '../../models/account/account-blocklist'
 import { ServerModel } from '../../models/server/server'
@@ -17,8 +16,6 @@ const blockAccountValidator = [
     .exists(),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking blockAccountByAccountValidator parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return
     if (!await doesAccountNameWithHostExist(req.body.accountName, res)) return
 
@@ -42,8 +39,6 @@ const unblockAccountByAccountValidator = [
     .exists(),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking unblockAccountByAccountValidator parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
     if (!await doesAccountNameWithHostExist(req.params.accountName, res)) return
 
@@ -60,8 +55,6 @@ const unblockAccountByServerValidator = [
     .exists(),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking unblockAccountByServerValidator parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
     if (!await doesAccountNameWithHostExist(req.params.accountName, res)) return
 
@@ -78,8 +71,6 @@ const blockServerValidator = [
     .custom(isHostValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking serverGetValidator parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return
 
     const host: string = req.body.host
@@ -104,8 +95,6 @@ const unblockServerByAccountValidator = [
     .custom(isHostValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking unblockServerByAccountValidator parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
 
     const user = res.locals.oauth.token.User
@@ -120,8 +109,6 @@ const unblockServerByServerValidator = [
     .custom(isHostValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking unblockServerByServerValidator parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
 
     const serverActor = await getServerActor()
@@ -143,8 +130,6 @@ const blocklistStatusValidator = [
     .custom(areValidActorHandles).withMessage('Should have a valid accounts array'),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking blocklistStatusValidator parameters', { query: req.query })
-
     if (areValidationErrors(req, res)) return
 
     return next()
index 5bc15e076169bb598de457a332cddeab7589e26e..a1cea8032e3dcbc68c824e15d92123029a4d9f7f 100644 (file)
@@ -3,7 +3,6 @@ import { body } from 'express-validator'
 import { isBulkRemoveCommentsOfScopeValid } from '@server/helpers/custom-validators/bulk'
 import { HttpStatusCode, UserRight } from '@shared/models'
 import { BulkRemoveCommentsOfBody } from '@shared/models/bulk/bulk-remove-comments-of-body.model'
-import { logger } from '../../helpers/logger'
 import { areValidationErrors, doesAccountNameWithHostExist } from './shared'
 
 const bulkRemoveCommentsOfValidator = [
@@ -13,8 +12,6 @@ const bulkRemoveCommentsOfValidator = [
     .custom(isBulkRemoveCommentsOfScopeValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking bulkRemoveCommentsOfValidator parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return
     if (!await doesAccountNameWithHostExist(req.body.accountName, res)) return
 
index c89f3087e39172dca7144aa35340d7aacd921032..3a7daa57329e8fc2a5f88e4bf67be31cd0bd043e 100644 (file)
@@ -2,13 +2,12 @@ import express from 'express'
 import { body } from 'express-validator'
 import { isIntOrNull } from '@server/helpers/custom-validators/misc'
 import { CONFIG, isEmailEnabled } from '@server/initializers/config'
+import { HttpStatusCode } from '@shared/models/http/http-error-codes'
 import { CustomConfig } from '../../../shared/models/server/custom-config.model'
 import { isThemeNameValid } from '../../helpers/custom-validators/plugins'
 import { isUserNSFWPolicyValid, isUserVideoQuotaDailyValid, isUserVideoQuotaValid } from '../../helpers/custom-validators/users'
-import { logger } from '../../helpers/logger'
 import { isThemeRegistered } from '../../lib/plugins/theme-utils'
 import { areValidationErrors } from './shared'
-import { HttpStatusCode } from '@shared/models/http/http-error-codes'
 
 const customConfigUpdateValidator = [
   body('instance.name').exists(),
@@ -105,8 +104,6 @@ const customConfigUpdateValidator = [
   body('search.searchIndex.isDefaultSearch').isBoolean(),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking customConfigUpdateValidator parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return
     if (!checkInvalidConfigIfEmailDisabled(req.body, res)) return
     if (!checkInvalidTranscodingConfig(req.body, res)) return
index 900c1d3835f8ebef11a8e952a1fcb475a10adce1..0bfe89e6fb35cf13352b07cae4d27703396af45b 100644 (file)
@@ -3,7 +3,6 @@ import { param, query } from 'express-validator'
 import { HttpStatusCode } from '../../../shared/models/http/http-error-codes'
 import { isValidRSSFeed } from '../../helpers/custom-validators/feeds'
 import { exists, isIdOrUUIDValid, isIdValid, toCompleteUUID } from '../../helpers/custom-validators/misc'
-import { logger } from '../../helpers/logger'
 import {
   areValidationErrors,
   checkCanSeeVideo,
@@ -24,8 +23,6 @@ const feedsFormatValidator = [
     .custom(isValidRSSFeed).withMessage('Should have a valid format (rss, atom, json)'),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking feeds format parameters', { parameters: req.query })
-
     if (areValidationErrors(req, res)) return
 
     return next()
@@ -74,8 +71,6 @@ const videoFeedsValidator = [
     .optional(),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking feeds parameters', { parameters: req.query })
-
     if (areValidationErrors(req, res)) return
 
     if (req.query.accountId && !await doesAccountIdExist(req.query.accountId, res)) return
@@ -95,8 +90,6 @@ const videoSubscriptionFeedsValidator = [
     .custom(exists),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking subscription feeds parameters', { parameters: req.query })
-
     if (areValidationErrors(req, res)) return
 
     if (!await doesAccountIdExist(req.query.accountId, res)) return
@@ -113,8 +106,6 @@ const videoCommentsFeedsValidator = [
     .custom(isIdOrUUIDValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking feeds parameters', { parameters: req.query })
-
     if (areValidationErrors(req, res)) return
 
     if (req.query.videoId && (req.query.videoChannelId || req.query.videoChannelName)) {
index 639c60c0308ea955623c80ac099186db1b4dc32f..be98a4c04bfac936cf72fdaa4febd635476c361d 100644 (file)
@@ -50,8 +50,6 @@ const followValidator = [
         })
     }
 
-    logger.debug('Checking follow parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return
 
     const body: ServerFollowCreate = req.body
@@ -73,8 +71,6 @@ const removeFollowingValidator = [
     .custom(value => isHostValid(value) || isRemoteHandleValid(value)),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking unfollowing parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
 
     const serverActor = await getServerActor()
@@ -103,8 +99,6 @@ const getFollowerValidator = [
     .custom(isValidActorHandle),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking get follower parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
 
     let follow: MActorFollowActorsDefault
@@ -132,8 +126,6 @@ const getFollowerValidator = [
 
 const acceptFollowerValidator = [
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking accept follower parameters', { parameters: req.params })
-
     const follow = res.locals.follow
     if (follow.state !== 'pending' && follow.state !== 'rejected') {
       return res.fail({ message: 'Follow is not in pending/rejected state.' })
@@ -145,8 +137,6 @@ const acceptFollowerValidator = [
 
 const rejectFollowerValidator = [
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking reject follower parameters', { parameters: req.params })
-
     const follow = res.locals.follow
     if (follow.state !== 'pending' && follow.state !== 'accepted') {
       return res.fail({ message: 'Follow is not in pending/accepted state.' })
index 971c2060c8ac1dfc134bbd427b9a105e694d32dd..e5008adc3650657c6488a21ff35b11e136de272f 100644 (file)
@@ -1,7 +1,7 @@
 import express from 'express'
 import { param, query } from 'express-validator'
 import { isValidJobState, isValidJobType } from '../../helpers/custom-validators/jobs'
-import { logger, loggerTagsFactory } from '../../helpers/logger'
+import { loggerTagsFactory } from '../../helpers/logger'
 import { areValidationErrors } from './shared'
 
 const lTags = loggerTagsFactory('validators', 'jobs')
@@ -16,9 +16,7 @@ const listJobsValidator = [
     .custom(isValidJobType),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking listJobsValidator parameters.', { parameters: req.params, ...lTags() })
-
-    if (areValidationErrors(req, res)) return
+    if (areValidationErrors(req, res, lTags())) return
 
     return next()
   }
index ce36dc40b45fd8cebba1da1edcf3d79fa5f9f270..584cb2aaf010f6b8f380ab3d524c12841adc99de 100644 (file)
@@ -13,7 +13,6 @@ import {
   isValidLogLevel
 } from '../../helpers/custom-validators/logs'
 import { isDateValid, toArray } from '../../helpers/custom-validators/misc'
-import { logger } from '../../helpers/logger'
 import { areValidationErrors } from './shared'
 
 const createClientLogValidator = [
@@ -39,8 +38,6 @@ const createClientLogValidator = [
     .custom(isValidClientLogUserAgent),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking createClientLogValidator parameters.', { parameters: req.query })
-
     if (CONFIG.LOG.ACCEPT_CLIENT_LOG !== true) {
       return res.sendStatus(HttpStatusCode.FORBIDDEN_403)
     }
@@ -66,8 +63,6 @@ const getLogsValidator = [
     .custom(isDateValid).withMessage('Should have an end date that conforms to ISO 8601'),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking getLogsValidator parameters.', { parameters: req.query })
-
     if (areValidationErrors(req, res)) return
 
     return next()
@@ -82,8 +77,6 @@ const getAuditLogsValidator = [
     .custom(isDateValid).withMessage('Should have a end date that conforms to ISO 8601'),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking getAuditLogsValidator parameters.', { parameters: req.query })
-
     if (areValidationErrors(req, res)) return
 
     return next()
index cd6f872daa4000d6194d49c32b26875bdd5721ef..8ee5ac0d0ab4dfbe7c0369dc22efcd5cfc843607 100644 (file)
@@ -4,7 +4,6 @@ import { isValidPlayerMode } from '@server/helpers/custom-validators/metrics'
 import { isIdOrUUIDValid, toCompleteUUID } from '@server/helpers/custom-validators/misc'
 import { CONFIG } from '@server/initializers/config'
 import { HttpStatusCode, PlaybackMetricCreate } from '@shared/models'
-import { logger } from '../../helpers/logger'
 import { areValidationErrors, doesVideoExist } from './shared'
 
 const addPlaybackMetricValidator = [
@@ -35,8 +34,6 @@ const addPlaybackMetricValidator = [
     .custom(isIdOrUUIDValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking addPlaybackMetricValidator parameters.', { parameters: req.query })
-
     if (!CONFIG.OPEN_TELEMETRY.METRICS.ENABLED) return res.sendStatus(HttpStatusCode.NO_CONTENT_204)
 
     const body: PlaybackMetricCreate = req.body
index fa90dd05c91d1b294c3c6a51cf2a2c4fdaf531d6..ef9a227a0446a1513727858624dcea3e404765a8 100644 (file)
@@ -7,7 +7,6 @@ import { VideoPlaylistPrivacy, VideoPrivacy } from '@shared/models'
 import { HttpStatusCode } from '../../../shared/models/http/http-error-codes'
 import { isTestOrDevInstance } from '../../helpers/core-utils'
 import { isIdOrUUIDValid, isUUIDValid, toCompleteUUID } from '../../helpers/custom-validators/misc'
-import { logger } from '../../helpers/logger'
 import { WEBSERVER } from '../../initializers/constants'
 import { areValidationErrors } from './shared'
 
@@ -52,8 +51,6 @@ const oembedValidator = [
     .isIn([ 'xml', 'json' ]),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking oembed parameters', { parameters: req.query })
-
     if (areValidationErrors(req, res)) return
 
     if (req.query.format !== undefined && req.query.format !== 'json') {
index ce371d6c116ece94608408cefc67a28cdb3184d3..79ddbbf184d42c0c36be7c538a36f7ae3dc7f44a 100644 (file)
@@ -1,7 +1,6 @@
 import express from 'express'
 import { query } from 'express-validator'
 import { PAGINATION } from '@server/initializers/constants'
-import { logger } from '../../helpers/logger'
 import { areValidationErrors } from './shared'
 
 const paginationValidator = paginationValidatorBuilder()
@@ -16,9 +15,7 @@ function paginationValidatorBuilder (tags: string[] = []) {
       .isInt({ min: 0, max: PAGINATION.GLOBAL.COUNT.MAX }).withMessage(`Should have a number count (max: ${PAGINATION.GLOBAL.COUNT.MAX})`),
 
     (req: express.Request, res: express.Response, next: express.NextFunction) => {
-      logger.debug('Checking pagination parameters', { parameters: req.query, tags })
-
-      if (areValidationErrors(req, res)) return
+      if (areValidationErrors(req, res, { tags })) return
 
       return next()
     }
index dc80469c31f90796461fb53f7ac96a86f2ada5b3..78c03033384e5a5be3cbf94771234d6b6eab3999 100644 (file)
@@ -5,7 +5,6 @@ import { PluginType } from '../../../shared/models/plugins/plugin.type'
 import { InstallOrUpdatePlugin } from '../../../shared/models/plugins/server/api/install-plugin.model'
 import { exists, isBooleanValid, isSafePath, toBooleanOrNull, toIntOrNull } from '../../helpers/custom-validators/misc'
 import { isNpmPluginNameValid, isPluginNameValid, isPluginTypeValid, isPluginVersionValid } from '../../helpers/custom-validators/plugins'
-import { logger } from '../../helpers/logger'
 import { CONFIG } from '../../initializers/config'
 import { PluginManager } from '../../lib/plugins/plugin-manager'
 import { PluginModel } from '../../models/server/plugin'
@@ -26,8 +25,6 @@ const getPluginValidator = (pluginType: PluginType, withVersion = true) => {
 
   return validators.concat([
     (req: express.Request, res: express.Response, next: express.NextFunction) => {
-      logger.debug('Checking getPluginValidator parameters', { parameters: req.params })
-
       if (areValidationErrors(req, res)) return
 
       const npmName = PluginModel.buildNpmName(req.params.pluginName, pluginType)
@@ -58,8 +55,6 @@ const getExternalAuthValidator = [
     .custom(exists),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking getExternalAuthValidator parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
 
     const plugin = res.locals.registeredPlugin
@@ -89,8 +84,6 @@ const pluginStaticDirectoryValidator = [
     .custom(isSafePath),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking pluginStaticDirectoryValidator parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
 
     return next()
@@ -108,8 +101,6 @@ const listPluginsValidator = [
     .custom(isBooleanValid),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking listPluginsValidator parameters', { parameters: req.query })
-
     if (areValidationErrors(req, res)) return
 
     return next()
@@ -128,8 +119,6 @@ const installOrUpdatePluginValidator = [
     .custom(isSafePath),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking installOrUpdatePluginValidator parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return
 
     const body: InstallOrUpdatePlugin = req.body
@@ -149,8 +138,6 @@ const uninstallPluginValidator = [
     .custom(isNpmPluginNameValid),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking uninstallPluginValidator parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return
 
     return next()
@@ -162,8 +149,6 @@ const existingPluginValidator = [
     .custom(isNpmPluginNameValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking enabledPluginValidator parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
 
     const plugin = await PluginModel.loadByNpmName(req.params.npmName)
@@ -184,8 +169,6 @@ const updatePluginSettingsValidator = [
     .exists(),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking enabledPluginValidator parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return
 
     return next()
@@ -205,8 +188,6 @@ const listAvailablePluginsValidator = [
     .custom(isPluginVersionValid),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking enabledPluginValidator parameters', { parameters: req.query })
-
     if (areValidationErrors(req, res)) return
 
     if (CONFIG.PLUGINS.INDEX.ENABLED === false) {
index a74772bd198c9ca26d5f96393f6c3750ca1e4aba..79460f63cf3c14b1be90a5b7cda8fd0274dd4abe 100644 (file)
@@ -12,7 +12,6 @@ import {
   toIntOrNull
 } from '../../helpers/custom-validators/misc'
 import { isHostValid } from '../../helpers/custom-validators/servers'
-import { logger } from '../../helpers/logger'
 import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy'
 import { ServerModel } from '../../models/server/server'
 import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from './shared'
@@ -29,8 +28,6 @@ const videoFileRedundancyGetValidator = [
     .custom(exists),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoFileRedundancyGetValidator parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
     if (!await doesVideoExist(req.params.videoId, res)) return
 
@@ -72,8 +69,6 @@ const videoPlaylistRedundancyGetValidator = [
     .custom(exists),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoPlaylistRedundancyGetValidator parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
     if (!await doesVideoExist(req.params.videoId, res)) return
 
@@ -112,8 +107,6 @@ const updateServerRedundancyValidator = [
     .custom(isBooleanValid).withMessage('Should have a valid redundancyAllowed boolean'),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking updateServerRedundancy parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
 
     const server = await ServerModel.loadByHost(req.params.host)
@@ -135,8 +128,6 @@ const listVideoRedundanciesValidator = [
     .custom(isVideoRedundancyTarget),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking listVideoRedundanciesValidator parameters', { parameters: req.query })
-
     if (areValidationErrors(req, res)) return
 
     return next()
@@ -149,8 +140,6 @@ const addVideoRedundancyValidator = [
     .custom(isIdOrUUIDValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking addVideoRedundancyValidator parameters', { parameters: req.query })
-
     if (areValidationErrors(req, res)) return
 
     if (!await doesVideoExist(req.body.videoId, res, 'only-video')) return
@@ -180,8 +169,6 @@ const removeVideoRedundancyValidator = [
     .custom(isIdValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking removeVideoRedundancyValidator parameters', { parameters: req.query })
-
     if (areValidationErrors(req, res)) return
 
     const redundancy = await VideoRedundancyModel.loadByIdWithVideo(parseInt(req.params.redundancyId, 10))
index 827132468fdd0534626e18c4c6df2bd06bb56963..a63fd08932c7b126dd61af2bc6301566e11886b6 100644 (file)
@@ -3,7 +3,6 @@ import { query } from 'express-validator'
 import { isSearchTargetValid } from '@server/helpers/custom-validators/search'
 import { isHostValid } from '@server/helpers/custom-validators/servers'
 import { areUUIDsValid, isDateValid, isNotEmptyStringArray, toCompleteUUIDs } from '../../helpers/custom-validators/misc'
-import { logger } from '../../helpers/logger'
 import { areValidationErrors } from './shared'
 
 const videosSearchValidator = [
@@ -47,8 +46,6 @@ const videosSearchValidator = [
     .custom(isSearchTargetValid),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videos search query', { parameters: req.query })
-
     if (areValidationErrors(req, res)) return
 
     return next()
@@ -74,8 +71,6 @@ const videoChannelsListSearchValidator = [
     .custom(isNotEmptyStringArray).withMessage('Should have valid array of handles'),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking video channels search query', { parameters: req.query })
-
     if (areValidationErrors(req, res)) return
 
     return next()
@@ -102,8 +97,6 @@ const videoPlaylistsListSearchValidator = [
     .custom(areUUIDsValid).withMessage('Should have valid array of uuid'),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking video playlists search query', { parameters: req.query })
-
     if (areValidationErrors(req, res)) return
 
     return next()
index f6177f600bf9c27c5f78b40cc4b92d87168c73f0..d040e8a1f286b628268d3db9cb1c6331c2bea9d8 100644 (file)
@@ -13,8 +13,6 @@ const serverGetValidator = [
   body('host').custom(isHostValid).withMessage('Should have a valid host'),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking serverGetValidator parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return
 
     const server = await ServerModel.loadByHost(req.body.host)
@@ -40,8 +38,6 @@ const contactAdministratorValidator = [
     .custom(isValidContactBody),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking contactAdministratorValidator parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return
 
     if (CONFIG.CONTACT_FORM.ENABLED === false) {
index 77b64bc7abc21e02bf491a24d0d7d20e7a576681..f39128fddd8da8e6c240136991aa32e591b11ee5 100644 (file)
@@ -3,7 +3,32 @@ import { param, validationResult } from 'express-validator'
 import { isIdOrUUIDValid, toCompleteUUID } from '@server/helpers/custom-validators/misc'
 import { logger } from '../../../helpers/logger'
 
-function areValidationErrors (req: express.Request, res: express.Response) {
+function areValidationErrors (
+  req: express.Request,
+  res: express.Response,
+  options: {
+    omitLog?: boolean
+    omitBodyLog?: boolean
+    tags?: string[]
+  } = {}) {
+  const { omitLog = false, omitBodyLog = false, tags = [] } = options
+
+  if (!omitLog) {
+    logger.debug(
+      'Checking %s - %s parameters',
+      req.method, req.originalUrl,
+      {
+        body: omitBodyLog
+          ? 'omitted'
+          : req.body,
+        params: req.params,
+        query: req.query,
+        files: req.files,
+        tags
+      }
+    )
+  }
+
   const errors = validationResult(req)
 
   if (!errors.isEmpty()) {
index 269f1be531060f4fa278315bb2b7169bf72817c8..7d063910799f419d607724e7420a14040b8716b5 100644 (file)
@@ -1,6 +1,6 @@
 import express from 'express'
 import { query } from 'express-validator'
-import { logger } from '@server/helpers/logger'
+
 import { SORTABLE_COLUMNS } from '../../initializers/constants'
 import { areValidationErrors } from './shared'
 
@@ -15,9 +15,7 @@ function checkSort (sortableColumns: string[], tags: string[] = []) {
       .isIn(sortableColumns),
 
     (req: express.Request, res: express.Response, next: express.NextFunction) => {
-      logger.debug('Checking sort parameters', { parameters: req.query, tags })
-
-      if (areValidationErrors(req, res)) return
+      if (areValidationErrors(req, res, { tags })) return
 
       return next()
     }
index f6a8c2d923158a5b6a0fc849abc4e06e2dbd9b49..c130801a01cfb24c7328f969781dcf1f10bba8b6 100644 (file)
@@ -3,7 +3,6 @@ import { param } from 'express-validator'
 import { HttpStatusCode } from '../../../shared/models/http/http-error-codes'
 import { isSafePath } from '../../helpers/custom-validators/misc'
 import { isPluginNameValid, isPluginVersionValid } from '../../helpers/custom-validators/plugins'
-import { logger } from '../../helpers/logger'
 import { PluginManager } from '../../lib/plugins/plugin-manager'
 import { areValidationErrors } from './shared'
 
@@ -16,8 +15,6 @@ const serveThemeCSSValidator = [
     .custom(isSafePath),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking serveThemeCSS parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
 
     const theme = PluginManager.Instance.getRegisteredThemeByShortName(req.params.themeName)
index 23a00888ce41902ad97658cc6e2b96f42021381e..f2dae313437ad42c8a8835b25bdb21b52bd6504b 100644 (file)
@@ -1,7 +1,6 @@
 import express from 'express'
 import { body, param, query } from 'express-validator'
 import { exists, isDateValid, isIdValid } from '../../helpers/custom-validators/misc'
-import { logger } from '../../helpers/logger'
 import { areValidationErrors } from './shared'
 
 const userHistoryListValidator = [
@@ -10,8 +9,6 @@ const userHistoryListValidator = [
     .custom(exists),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking userHistoryListValidator parameters', { parameters: req.query })
-
     if (areValidationErrors(req, res)) return
 
     return next()
@@ -24,8 +21,6 @@ const userHistoryRemoveAllValidator = [
     .custom(isDateValid).withMessage('Should have a before date that conforms to ISO 8601'),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking userHistoryRemoveAllValidator parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return
 
     return next()
@@ -37,8 +32,6 @@ const userHistoryRemoveElementValidator = [
     .custom(isIdValid),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking userHistoryRemoveElementValidator parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
 
     return next()
index f46303ab84982c2103d5554b6155dc487a01eabc..8d70dcdd29a83ec3b2e617aab4e0ee55cba410bf 100644 (file)
@@ -2,7 +2,6 @@ import express from 'express'
 import { body, query } from 'express-validator'
 import { isNotEmptyIntArray, toBooleanOrNull } from '../../helpers/custom-validators/misc'
 import { isUserNotificationSettingValid } from '../../helpers/custom-validators/user-notifications'
-import { logger } from '../../helpers/logger'
 import { areValidationErrors } from './shared'
 
 const listUserNotificationsValidator = [
@@ -12,8 +11,6 @@ const listUserNotificationsValidator = [
     .isBoolean().withMessage('Should have a valid unread boolean'),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking listUserNotificationsValidator parameters', { parameters: req.query })
-
     if (areValidationErrors(req, res)) return
 
     return next()
@@ -47,8 +44,6 @@ const updateNotificationSettingsValidator = [
     .custom(isUserNotificationSettingValid),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking updateNotificationSettingsValidator parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return
 
     return next()
@@ -61,8 +56,6 @@ const markAsReadUserNotificationsValidator = [
     .custom(isNotEmptyIntArray).withMessage('Should have a valid array of notification ids'),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking markAsReadUserNotificationsValidator parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return
 
     return next()
index d9e6aa66724236efe1277b4790f8f6f245bca231..a7662891589dd8c4d74a8528dd4d8eb825dcaee5 100644 (file)
@@ -3,7 +3,6 @@ import { body, param, query } from 'express-validator'
 import { HttpStatusCode } from '../../../shared/models/http/http-error-codes'
 import { areValidActorHandles, isValidActorHandle } from '../../helpers/custom-validators/activitypub/actor'
 import { toArray } from '../../helpers/custom-validators/misc'
-import { logger } from '../../helpers/logger'
 import { WEBSERVER } from '../../initializers/constants'
 import { ActorFollowModel } from '../../models/actor/actor-follow'
 import { areValidationErrors } from './shared'
@@ -14,8 +13,6 @@ const userSubscriptionListValidator = [
     .not().isEmpty(),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking userSubscriptionListValidator parameters', { parameters: req.query })
-
     if (areValidationErrors(req, res)) return
 
     return next()
@@ -27,8 +24,6 @@ const userSubscriptionAddValidator = [
     .custom(isValidActorHandle).withMessage('Should have a valid URI to follow (username@domain)'),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking userSubscriptionAddValidator parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return
 
     return next()
@@ -41,8 +36,6 @@ const areSubscriptionsExistValidator = [
     .custom(areValidActorHandles).withMessage('Should have a valid array of URIs'),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking areSubscriptionsExistValidator parameters', { parameters: req.query })
-
     if (areValidationErrors(req, res)) return
 
     return next()
@@ -54,8 +47,6 @@ const userSubscriptionGetValidator = [
     .custom(isValidActorHandle),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking userSubscriptionGetValidator parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
 
     let [ name, host ] = req.params.uri.split('@')
index c3a07fccd28cc181094eadd19bfd51bc9bfac79b..282034f6d26a81c7040b06e838479d526cdae28f 100644 (file)
@@ -1,6 +1,5 @@
 import express from 'express'
 import { body, param, query } from 'express-validator'
-import { omit } from 'lodash'
 import { Hooks } from '@server/lib/plugins/hooks'
 import { MUserDefault } from '@server/types/models'
 import { HttpStatusCode, UserRegister, UserRight, UserRole } from '@shared/models'
@@ -41,8 +40,6 @@ const usersListValidator = [
     .isBoolean().withMessage('Should be a valid blocked boolena'),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking usersList parameters', { parameters: req.query })
-
     if (areValidationErrors(req, res)) return
 
     return next()
@@ -76,9 +73,7 @@ const usersAddValidator = [
     .custom(isUserAdminFlagsValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking usersAdd parameters', { parameters: omit(req.body, 'password') })
-
-    if (areValidationErrors(req, res)) return
+    if (areValidationErrors(req, res, { omitBodyLog: true })) return
     if (!await checkUserNameOrEmailDoesNotAlreadyExist(req.body.username, req.body.email, res)) return
 
     const authUser = res.locals.oauth.token.User
@@ -126,9 +121,7 @@ const usersRegisterValidator = [
     .custom(isVideoChannelDisplayNameValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking usersRegister parameters', { parameters: omit(req.body, 'password') })
-
-    if (areValidationErrors(req, res)) return
+    if (areValidationErrors(req, res, { omitBodyLog: true })) return
     if (!await checkUserNameOrEmailDoesNotAlreadyExist(req.body.username, req.body.email, res)) return
 
     const body: UserRegister = req.body
@@ -159,8 +152,6 @@ const usersRemoveValidator = [
     .custom(isIdValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking usersRemove parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
     if (!await checkUserIdExist(req.params.id, res)) return
 
@@ -181,8 +172,6 @@ const usersBlockingValidator = [
     .custom(isUserBlockedReasonValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking usersBlocking parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
     if (!await checkUserIdExist(req.params.id, res)) return
 
@@ -236,9 +225,7 @@ const usersUpdateValidator = [
     .custom(isUserAdminFlagsValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking usersUpdate parameters', { parameters: req.body })
-
-    if (areValidationErrors(req, res)) return
+    if (areValidationErrors(req, res, { omitBodyLog: true })) return
     if (!await checkUserIdExist(req.params.id, res)) return
 
     const user = res.locals.user
@@ -300,8 +287,6 @@ const usersUpdateMeValidator = [
     .custom(v => isUserAutoPlayNextVideoValid(v)).withMessage('Should have a valid autoPlayNextVideo boolean'),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking usersUpdateMe parameters', { parameters: omit(req.body, 'password') })
-
     const user = res.locals.oauth.token.User
 
     if (req.body.password || req.body.email) {
@@ -321,7 +306,7 @@ const usersUpdateMeValidator = [
       }
     }
 
-    if (areValidationErrors(req, res)) return
+    if (areValidationErrors(req, res, { omitBodyLog: true })) return
 
     return next()
   }
@@ -335,8 +320,6 @@ const usersGetValidator = [
     .isBoolean().withMessage('Should have a valid withStats boolean'),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking usersGet parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
     if (!await checkUserIdExist(req.params.id, res, req.query.withStats)) return
 
@@ -348,8 +331,6 @@ const usersVideoRatingValidator = [
   isValidVideoIdParam('videoId'),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking usersVideoRating parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
     if (!await doesVideoExist(req.params.videoId, res, 'id')) return
 
@@ -369,8 +350,6 @@ const usersVideosValidator = [
     .custom(isIdValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking usersVideosValidator parameters', { parameters: req.query })
-
     if (areValidationErrors(req, res)) return
 
     if (req.query.channelId && !await doesVideoChannelIdExist(req.query.channelId, res)) return
@@ -423,8 +402,6 @@ const usersAskResetPasswordValidator = [
     .isEmail(),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking usersAskResetPassword parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return
 
     const exists = await checkUserEmailExist(req.body.email, res, false)
@@ -447,8 +424,6 @@ const usersResetPasswordValidator = [
     .custom(isUserPasswordValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking usersResetPassword parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
     if (!await checkUserIdExist(req.params.id, res)) return
 
@@ -470,9 +445,8 @@ const usersAskSendVerifyEmailValidator = [
   body('email').isEmail().not().isEmpty().withMessage('Should have a valid email'),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking askUsersSendVerifyEmail parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return
+
     const exists = await checkUserEmailExist(req.body.email, res, false)
     if (!exists) {
       logger.debug('User with email %s does not exist (asking verify email).', req.body.email)
@@ -495,8 +469,6 @@ const usersVerifyEmailValidator = [
     .customSanitizer(toBooleanOrNull),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking usersVerifyEmail parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
     if (!await checkUserIdExist(req.params.id, res)) return
 
@@ -515,7 +487,9 @@ const usersVerifyEmailValidator = [
 ]
 
 const userAutocompleteValidator = [
-  param('search').isString().not().isEmpty().withMessage('Should have a search parameter')
+  param('search')
+    .isString()
+    .not().isEmpty()
 ]
 
 const ensureAuthUserOwnsAccountValidator = [
index f065f101ccf87af7bdbae42f463d02a823d20ee5..6b9aea07c976493397df8ec32a75f01174db5927 100644 (file)
@@ -3,15 +3,12 @@ import { body, query } from 'express-validator'
 import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
 import { isBooleanValid, toBooleanOrNull, toIntOrNull } from '../../../helpers/custom-validators/misc'
 import { isVideoBlacklistReasonValid, isVideoBlacklistTypeValid } from '../../../helpers/custom-validators/video-blacklist'
-import { logger } from '../../../helpers/logger'
 import { areValidationErrors, doesVideoBlacklistExist, doesVideoExist, isValidVideoIdParam } from '../shared'
 
 const videosBlacklistRemoveValidator = [
   isValidVideoIdParam('videoId'),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking blacklistRemove parameters.', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
     if (!await doesVideoExist(req.params.videoId, res)) return
     if (!await doesVideoBlacklistExist(res.locals.videoAll.id, res)) return
@@ -32,8 +29,6 @@ const videosBlacklistAddValidator = [
     .custom(isVideoBlacklistReasonValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videosBlacklistAdd parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
     if (!await doesVideoExist(req.params.videoId, res)) return
 
@@ -57,8 +52,6 @@ const videosBlacklistUpdateValidator = [
     .custom(isVideoBlacklistReasonValid).withMessage('Should have a valid reason'),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videosBlacklistUpdate parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
     if (!await doesVideoExist(req.params.videoId, res)) return
     if (!await doesVideoBlacklistExist(res.locals.videoAll.id, res)) return
@@ -78,8 +71,6 @@ const videosBlacklistFiltersValidator = [
     .isEmpty().withMessage('Should have a valid search'),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videos blacklist filters query', { parameters: req.query })
-
     if (areValidationErrors(req, res)) return
 
     return next()
index fd6dd151a235bb6fae5df1f26a6d6293bdf5af54..72b2febc352ece066daa6e17ae78576db5aafb32 100644 (file)
@@ -3,7 +3,6 @@ import { body, param } from 'express-validator'
 import { UserRight } from '@shared/models'
 import { isVideoCaptionFile, isVideoCaptionLanguageValid } from '../../../helpers/custom-validators/video-captions'
 import { cleanUpReqFiles } from '../../../helpers/express-utils'
-import { logger } from '../../../helpers/logger'
 import { CONSTRAINTS_FIELDS, MIMETYPES } from '../../../initializers/constants'
 import {
   areValidationErrors,
@@ -30,8 +29,6 @@ const addVideoCaptionValidator = [
     ),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking addVideoCaption parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return cleanUpReqFiles(req)
     if (!await doesVideoExist(req.params.videoId, res)) return cleanUpReqFiles(req)
 
@@ -50,8 +47,6 @@ const deleteVideoCaptionValidator = [
     .custom(isVideoCaptionLanguageValid).not().isEmpty().withMessage('Should have a valid caption language'),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking deleteVideoCaption parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
     if (!await doesVideoExist(req.params.videoId, res)) return
     if (!await doesVideoCaptionExist(res.locals.videoAll, req.params.captionLanguage, res)) return
@@ -68,8 +63,6 @@ const listVideoCaptionsValidator = [
   isValidVideoIdParam('videoId'),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking listVideoCaptions parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
     if (!await doesVideoExist(req.params.videoId, res, 'only-video')) return
 
index 18d8d74d204ce40ed8fd1e0c5485e994c90495e0..7e5b1247177cac9d574c6e52caad858e31fd11c1 100644 (file)
@@ -1,7 +1,6 @@
 import * as express from 'express'
 import { body, param } from 'express-validator'
 import { isUrlValid } from '@server/helpers/custom-validators/activitypub/misc'
-import { logger } from '@server/helpers/logger'
 import { CONFIG } from '@server/initializers/config'
 import { VideoChannelSyncModel } from '@server/models/video/video-channel-sync'
 import { HttpStatusCode, VideoChannelSyncCreate } from '@shared/models'
@@ -27,8 +26,6 @@ export const videoChannelSyncValidator = [
     .isInt(),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoChannelSync parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return
 
     const body: VideoChannelSyncCreate = req.body
index ad1415691f35af46107eb7153ada4e5dba3ab1c6..8338b24fc744145d8417184ea468eb83f6c66fdf 100644 (file)
@@ -12,7 +12,6 @@ import {
   isVideoChannelSupportValid,
   isVideoChannelUsernameValid
 } from '../../../helpers/custom-validators/video-channels'
-import { logger } from '../../../helpers/logger'
 import { ActorModel } from '../../../models/actor/actor'
 import { VideoChannelModel } from '../../../models/video/video-channel'
 import { areValidationErrors, checkUserQuota, doesVideoChannelNameWithHostExist } from '../shared'
@@ -31,8 +30,6 @@ export const videoChannelsAddValidator = [
     .custom(isVideoChannelSupportValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoChannelsAdd parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return
 
     const actor = await ActorModel.loadLocalByName(req.body.name)
@@ -72,8 +69,6 @@ export const videoChannelsUpdateValidator = [
     .custom(isBooleanValid).withMessage('Should have a valid bulkVideosSupportUpdate boolean field'),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoChannelsUpdate parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return
 
     return next()
@@ -82,8 +77,6 @@ export const videoChannelsUpdateValidator = [
 
 export const videoChannelsRemoveValidator = [
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoChannelsRemove parameters', { parameters: req.params })
-
     if (!await checkVideoChannelIsNotTheLastOne(res.locals.videoChannel, res)) return
 
     return next()
@@ -95,8 +88,6 @@ export const videoChannelsNameWithHostValidator = [
     .exists(),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoChannelsNameWithHostValidator parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
 
     if (!await doesVideoChannelNameWithHostExist(req.params.nameWithHost, res)) return
@@ -147,8 +138,6 @@ export const videoChannelsListValidator = [
     .not().isEmpty(),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking video channels search query', { parameters: req.query })
-
     if (areValidationErrors(req, res)) return
 
     return next()
@@ -164,8 +153,6 @@ export const videoChannelImportVideosValidator = [
     .custom(isIdValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoChannelImport parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return
 
     const body: VideosImportInChannelCreate = req.body
index b2a39617b57fbbade01861a07a1ec54fd7738bbd..69062701bf28635708eed402ddf03b2d0c910744 100644 (file)
@@ -43,8 +43,6 @@ const listVideoCommentsValidator = [
     .custom(exists),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking listVideoCommentsValidator parameters.', { parameters: req.query })
-
     if (areValidationErrors(req, res)) return
 
     return next()
@@ -55,8 +53,6 @@ const listVideoCommentThreadsValidator = [
   isValidVideoIdParam('videoId'),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking listVideoCommentThreads parameters.', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
     if (!await doesVideoExist(req.params.videoId, res, 'only-video')) return
 
@@ -73,8 +69,6 @@ const listVideoThreadCommentsValidator = [
     .custom(isIdValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking listVideoThreadComments parameters.', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
     if (!await doesVideoExist(req.params.videoId, res, 'only-video')) return
     if (!await doesVideoCommentThreadExist(req.params.threadId, res.locals.onlyVideo, res)) return
@@ -92,8 +86,6 @@ const addVideoCommentThreadValidator = [
     .custom(isValidVideoCommentText),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking addVideoCommentThread parameters.', { parameters: req.params, body: req.body })
-
     if (areValidationErrors(req, res)) return
     if (!await doesVideoExist(req.params.videoId, res)) return
 
@@ -114,8 +106,6 @@ const addVideoCommentReplyValidator = [
   body('text').custom(isValidVideoCommentText),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking addVideoCommentReply parameters.', { parameters: req.params, body: req.body })
-
     if (areValidationErrors(req, res)) return
     if (!await doesVideoExist(req.params.videoId, res)) return
 
@@ -136,8 +126,6 @@ const videoCommentGetValidator = [
     .custom(isIdValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoCommentGetValidator parameters.', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
     if (!await doesVideoExist(req.params.videoId, res, 'id')) return
     if (!await doesVideoCommentExist(req.params.commentId, res.locals.videoId, res)) return
@@ -153,8 +141,6 @@ const removeVideoCommentValidator = [
     .custom(isIdValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking removeVideoCommentValidator parameters.', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
     if (!await doesVideoExist(req.params.videoId, res)) return
     if (!await doesVideoCommentExist(req.params.commentId, res.locals.videoAll, res)) return
index b44c997e3d6acdb590236c409bdfc742f5cef5e8..92c5b9483b9d1ef6e5f8d9dec370ea0eb1257e3c 100644 (file)
@@ -1,17 +1,14 @@
 import express from 'express'
+import { param } from 'express-validator'
+import { isIdValid } from '@server/helpers/custom-validators/misc'
 import { MVideo } from '@server/types/models'
 import { HttpStatusCode } from '@shared/models'
-import { logger } from '../../../helpers/logger'
 import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared'
-import { isIdValid } from '@server/helpers/custom-validators/misc'
-import { param } from 'express-validator'
 
 const videoFilesDeleteWebTorrentValidator = [
   isValidVideoIdParam('id'),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoFilesDeleteWebTorrent parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
     if (!await doesVideoExist(req.params.id, res)) return
 
@@ -44,8 +41,6 @@ const videoFilesDeleteWebTorrentFileValidator = [
     .custom(isIdValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoFilesDeleteWebTorrentFile parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
     if (!await doesVideoExist(req.params.id, res)) return
 
@@ -78,8 +73,6 @@ const videoFilesDeleteHLSValidator = [
   isValidVideoIdParam('id'),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoFilesDeleteHLS parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
     if (!await doesVideoExist(req.params.id, res)) return
 
@@ -112,8 +105,6 @@ const videoFilesDeleteHLSFileValidator = [
     .custom(isIdValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoFilesDeleteHLSFile parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
     if (!await doesVideoExist(req.params.id, res)) return
 
index 0ab9e6e6f75a44c022ac85e5ed26c2f345248c80..f295b1885a6df6810c6e0b7757089d6f7c449448 100644 (file)
@@ -39,8 +39,6 @@ const videoImportAddValidator = getCommonVideoEditAttributes().concat([
     ),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoImportAddValidator parameters', { parameters: req.body })
-
     const user = res.locals.oauth.token.User
     const torrentFile = req.files?.['torrentfile'] ? req.files['torrentfile'][0] : undefined
 
@@ -98,8 +96,6 @@ const getMyVideoImportsValidator = [
     .custom(isIdValid),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking getMyVideoImportsValidator parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
 
     return next()
@@ -111,8 +107,6 @@ const videoImportDeleteValidator = [
     .custom(isIdValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoImportDeleteValidator parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
 
     if (!await doesVideoImportExist(parseInt(req.params.id), res)) return
@@ -134,8 +128,6 @@ const videoImportCancelValidator = [
     .custom(isIdValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoImportCancelValidator parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
 
     if (!await doesVideoImportExist(parseInt(req.params.id), res)) return
index a330d70a19957dcd45580084feac6f6f24fd4d88..328760dde3f58bc890b69dae202596c6a09588ee 100644 (file)
@@ -6,6 +6,7 @@ import { isLocalLiveVideoAccepted } from '@server/lib/moderation'
 import { Hooks } from '@server/lib/plugins/hooks'
 import { VideoModel } from '@server/models/video/video'
 import { VideoLiveModel } from '@server/models/video/video-live'
+import { VideoLiveSessionModel } from '@server/models/video/video-live-session'
 import {
   HttpStatusCode,
   LiveVideoCreate,
@@ -28,14 +29,11 @@ import {
   isValidVideoIdParam
 } from '../shared'
 import { getCommonVideoEditAttributes } from './videos'
-import { VideoLiveSessionModel } from '@server/models/video/video-live-session'
 
 const videoLiveGetValidator = [
   isValidVideoIdParam('videoId'),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoLiveGetValidator parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
     if (!await doesVideoExist(req.params.videoId, res, 'all')) return
 
@@ -79,8 +77,6 @@ const videoLiveAddValidator = getCommonVideoEditAttributes().concat([
     .custom(isLiveLatencyModeValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoLiveAddValidator parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return cleanUpReqFiles(req)
 
     if (CONFIG.LIVE.ENABLED !== true) {
@@ -163,8 +159,6 @@ const videoLiveUpdateValidator = [
     .custom(isLiveLatencyModeValid),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoLiveUpdateValidator parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return
 
     const body: LiveVideoUpdate = req.body
@@ -197,8 +191,6 @@ const videoLiveUpdateValidator = [
 
 const videoLiveListSessionsValidator = [
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoLiveListSessionsValidator parameters', { parameters: req.params })
-
     // Check the user can manage the live
     const user = res.locals.oauth.token.User
     if (!checkUserCanManageVideo(user, res.locals.videoAll, UserRight.GET_ANY_LIVE, res)) return
@@ -211,8 +203,6 @@ const videoLiveFindReplaySessionValidator = [
   isValidVideoIdParam('videoId'),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoLiveFindReplaySessionValidator parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
     if (!await doesVideoExist(req.params.videoId, res, 'id')) return
 
index e73196f5b63a0d5f4d54ff9bf4c55a004e53f7db..3eca78c25a42b42a3c662f1ad33ceff4908f1420 100644 (file)
@@ -2,7 +2,6 @@ import express from 'express'
 import { param } from 'express-validator'
 import { isIdValid } from '@server/helpers/custom-validators/misc'
 import { checkUserCanTerminateOwnershipChange } from '@server/helpers/custom-validators/video-ownership'
-import { logger } from '@server/helpers/logger'
 import { AccountModel } from '@server/models/account/account'
 import { MVideoWithAllFiles } from '@server/types/models'
 import { HttpStatusCode, UserRight, VideoChangeOwnershipAccept, VideoChangeOwnershipStatus, VideoState } from '@shared/models'
@@ -20,8 +19,6 @@ const videosChangeOwnershipValidator = [
   isValidVideoIdParam('videoId'),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking changeOwnership parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
     if (!await doesVideoExist(req.params.videoId, res)) return
 
@@ -44,8 +41,6 @@ const videosTerminateChangeOwnershipValidator = [
     .custom(isIdValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking changeOwnership parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
     if (!await doesChangeVideoOwnershipExist(req.params.id, res)) return
 
index 42e6646f9a43759a1266a237f010a5b08d414b77..6d4b8a6f15e86727e8f98ad66f4f2103e79e6fde 100644 (file)
@@ -29,7 +29,6 @@ import {
 } from '../../../helpers/custom-validators/video-playlists'
 import { isVideoImageValid } from '../../../helpers/custom-validators/videos'
 import { cleanUpReqFiles } from '../../../helpers/express-utils'
-import { logger } from '../../../helpers/logger'
 import { CONSTRAINTS_FIELDS } from '../../../initializers/constants'
 import { VideoPlaylistElementModel } from '../../../models/video/video-playlist-element'
 import { MVideoPlaylist } from '../../../types/models/video/video-playlist'
@@ -48,8 +47,6 @@ const videoPlaylistsAddValidator = getCommonPlaylistEditAttributes().concat([
     .custom(isVideoPlaylistNameValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoPlaylistsAddValidator parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return cleanUpReqFiles(req)
 
     const body: VideoPlaylistCreate = req.body
@@ -76,8 +73,6 @@ const videoPlaylistsUpdateValidator = getCommonPlaylistEditAttributes().concat([
     .custom(isVideoPlaylistNameValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoPlaylistsUpdateValidator parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return cleanUpReqFiles(req)
 
     if (!await doesVideoPlaylistExist(req.params.playlistId, res, 'all')) return cleanUpReqFiles(req)
@@ -118,8 +113,6 @@ const videoPlaylistsDeleteValidator = [
   isValidPlaylistIdParam('playlistId'),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoPlaylistsDeleteValidator parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
 
     if (!await doesVideoPlaylistExist(req.params.playlistId, res)) return
@@ -142,8 +135,6 @@ const videoPlaylistsGetValidator = (fetchType: VideoPlaylistFetchType) => {
     isValidPlaylistIdParam('playlistId'),
 
     async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-      logger.debug('Checking videoPlaylistsGetValidator parameters', { parameters: req.params })
-
       if (areValidationErrors(req, res)) return
 
       if (!await doesVideoPlaylistExist(req.params.playlistId, res, fetchType)) return
@@ -189,8 +180,6 @@ const videoPlaylistsSearchValidator = [
     .not().isEmpty(),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoPlaylists search query', { parameters: req.query })
-
     if (areValidationErrors(req, res)) return
 
     return next()
@@ -211,8 +200,6 @@ const videoPlaylistsAddVideoValidator = [
     .custom(isVideoPlaylistTimestampValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoPlaylistsAddVideoValidator parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
 
     if (!await doesVideoPlaylistExist(req.params.playlistId, res, 'all')) return
@@ -241,8 +228,6 @@ const videoPlaylistsUpdateOrRemoveVideoValidator = [
     .custom(isVideoPlaylistTimestampValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoPlaylistsRemoveVideoValidator parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
 
     if (!await doesVideoPlaylistExist(req.params.playlistId, res, 'all')) return
@@ -271,8 +256,6 @@ const videoPlaylistElementAPGetValidator = [
     .custom(isIdValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoPlaylistElementAPGetValidator parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
 
     const playlistElementId = parseInt(req.params.playlistElementId + '', 10)
@@ -312,8 +295,6 @@ const videoPlaylistsReorderVideosValidator = [
     .isInt({ min: 1 }),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoPlaylistsReorderVideosValidator parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
 
     if (!await doesVideoPlaylistExist(req.params.playlistId, res, 'all')) return
@@ -346,8 +327,6 @@ const commonVideoPlaylistFiltersValidator = [
     .custom(isVideoPlaylistTypeValid),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking commonVideoPlaylistFiltersValidator parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
 
     return next()
@@ -360,8 +339,6 @@ const doVideosInPlaylistExistValidator = [
     .custom(v => isArrayOf(v, isIdValid)).withMessage('Should have a valid video ids array'),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking areVideosInPlaylistExistValidator parameters', { parameters: req.query })
-
     if (areValidationErrors(req, res)) return
 
     return next()
index 0c02baafb9f7c4496bdebcd8e7afa30e0fda612f..275634d5bdf02ddf8431d8520f98b52602983e26 100644 (file)
@@ -6,7 +6,6 @@ import { isAccountNameValid } from '../../../helpers/custom-validators/accounts'
 import { isIdValid } from '../../../helpers/custom-validators/misc'
 import { isRatingValid } from '../../../helpers/custom-validators/video-rates'
 import { isVideoRatingTypeValid } from '../../../helpers/custom-validators/videos'
-import { logger } from '../../../helpers/logger'
 import { AccountVideoRateModel } from '../../../models/account/account-video-rate'
 import { areValidationErrors, checkCanSeeVideo, doesVideoExist, isValidVideoIdParam } from '../shared'
 
@@ -17,8 +16,6 @@ const videoUpdateRateValidator = [
     .custom(isVideoRatingTypeValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoRate parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return
     if (!await doesVideoExist(req.params.id, res)) return
 
@@ -36,8 +33,6 @@ const getAccountVideoRateValidatorFactory = function (rateType: VideoRateType) {
       .custom(isIdValid),
 
     async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-      logger.debug('Checking videoCommentGetValidator parameters.', { parameters: req.params })
-
       if (areValidationErrors(req, res)) return
 
       const rate = await AccountVideoRateModel.loadLocalAndPopulateVideo(rateType, req.params.name, +req.params.videoId)
@@ -61,8 +56,6 @@ const videoRatingValidator = [
     .custom(isRatingValid).withMessage('Value must be one of "like" or "dislike"'),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking rating parameter', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
 
     return next()
index 40337dcf11d71612d4d9e16ac4212cc0f729e52c..c234de6ed53dfff68b1b3e69af101a19c6cc9d63 100644 (file)
@@ -2,7 +2,6 @@ import express from 'express'
 import { param } from 'express-validator'
 import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
 import { isIdValid } from '../../../helpers/custom-validators/misc'
-import { logger } from '../../../helpers/logger'
 import { VideoShareModel } from '../../../models/video/video-share'
 import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared'
 
@@ -13,8 +12,6 @@ const videosShareValidator = [
     .custom(isIdValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoShare parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
     if (!await doesVideoExist(req.params.id, res)) return
 
index 31a2f16b379a5953db9cd2e5223349b0041c5734..c6d8f1a813ac47caff6a50e2ba211650abdd195a 100644 (file)
@@ -3,15 +3,12 @@ import { getVideoWithAttributes } from '@server/helpers/video'
 import { VideoSourceModel } from '@server/models/video/video-source'
 import { MVideoFullLight } from '@server/types/models'
 import { HttpStatusCode, UserRight } from '@shared/models'
-import { logger } from '../../../helpers/logger'
 import { areValidationErrors, checkUserCanManageVideo, doesVideoExist, isValidVideoIdParam } from '../shared'
 
 const videoSourceGetValidator = [
   isValidVideoIdParam('id'),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoSourceGet parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
     if (!await doesVideoExist(req.params.id, res, 'for-api')) return
 
index ddbf2a564545fc9ff5d67778869cd6e3a5bd5076..a79526d397f2ae2e1d6372635a7f6a39d7c2e4c4 100644 (file)
@@ -4,7 +4,6 @@ import { isDateValid } from '@server/helpers/custom-validators/misc'
 import { isValidStatTimeserieMetric } from '@server/helpers/custom-validators/video-stats'
 import { STATS_TIMESERIE } from '@server/initializers/constants'
 import { HttpStatusCode, UserRight, VideoStatsTimeserieQuery } from '@shared/models'
-import { logger } from '../../../helpers/logger'
 import { areValidationErrors, checkUserCanManageVideo, doesVideoExist, isValidVideoIdParam } from '../shared'
 
 const videoOverallStatsValidator = [
@@ -19,8 +18,6 @@ const videoOverallStatsValidator = [
     .custom(isDateValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoOverallStatsValidator parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return
     if (!await commonStatsCheck(req, res)) return
 
@@ -32,8 +29,6 @@ const videoRetentionStatsValidator = [
   isValidVideoIdParam('videoId'),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoRetentionStatsValidator parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return
     if (!await commonStatsCheck(req, res)) return
 
@@ -63,8 +58,6 @@ const videoTimeserieStatsValidator = [
     .custom(isDateValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoTimeserieStatsValidator parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return
     if (!await commonStatsCheck(req, res)) return
 
index d07e150aef6e1aba30e77a5e7be93e6eb8d0e044..b3e2d81019c6b40f9034ebf1f98ac051cae61f1b 100644 (file)
@@ -12,7 +12,6 @@ import { CONFIG } from '@server/initializers/config'
 import { approximateIntroOutroAdditionalSize, getTaskFile } from '@server/lib/video-studio'
 import { isAudioFile } from '@shared/extra-utils'
 import { HttpStatusCode, UserRight, VideoState, VideoStudioCreateEdition, VideoStudioTask } from '@shared/models'
-import { logger } from '../../../helpers/logger'
 import { areValidationErrors, checkUserCanManageVideo, checkUserQuota, doesVideoExist } from '../shared'
 
 const videoStudioAddEditionValidator = [
@@ -23,8 +22,6 @@ const videoStudioAddEditionValidator = [
     .custom(isValidStudioTasksArray).withMessage('Should have a valid array of tasks'),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoStudioAddEditionValidator parameters.', { parameters: req.params, body: req.body, files: req.files })
-
     if (CONFIG.VIDEO_STUDIO.ENABLED !== true) {
       res.fail({
         status: HttpStatusCode.BAD_REQUEST_400,
index 36b9799e6fde767ff31c9d51d2e81071ba5b4dbb..3eb2d3141ed69ac2161fb3d7a23aacbb70e13631 100644 (file)
@@ -4,7 +4,6 @@ import { isValidCreateTranscodingType } from '@server/helpers/custom-validators/
 import { CONFIG } from '@server/initializers/config'
 import { VideoJobInfoModel } from '@server/models/video/video-job-info'
 import { HttpStatusCode } from '@shared/models'
-import { logger } from '../../../helpers/logger'
 import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared'
 
 const createTranscodingValidator = [
@@ -14,8 +13,6 @@ const createTranscodingValidator = [
     .custom(isValidCreateTranscodingType),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking createTranscodingValidator parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return
     if (!await doesVideoExist(req.params.videoId, res, 'all')) return
 
index 4927c04ad65b706501b436aedafdb2998e2cfc95..6e2d4505d9bab43ef4dda175e9d7650a0d1a1c2f 100644 (file)
@@ -1,20 +1,17 @@
 import express from 'express'
 import { body, param } from 'express-validator'
 import { isVideoTimeValid } from '@server/helpers/custom-validators/video-view'
+import { getCachedVideoDuration } from '@server/lib/video'
 import { LocalVideoViewerModel } from '@server/models/view/local-video-viewer'
 import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
 import { exists, isIdValid, isIntOrNull, toIntOrNull } from '../../../helpers/custom-validators/misc'
-import { logger } from '../../../helpers/logger'
 import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared'
-import { getCachedVideoDuration } from '@server/lib/video'
 
 const getVideoLocalViewerValidator = [
   param('localViewerId')
     .custom(isIdValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking getVideoLocalViewerValidator parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
 
     const localViewer = await LocalVideoViewerModel.loadFullById(+req.params.localViewerId)
@@ -40,8 +37,6 @@ const videoViewValidator = [
     .custom(isIntOrNull),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoView parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return
     if (!await doesVideoExist(req.params.videoId, res, 'only-immutable-attributes')) return
 
index 5e8e25a9c71695ca4c3f29691fc3de90470e26e5..3d93bc62f6ddde822cb678f780e03cc58e9fc197 100644 (file)
@@ -72,8 +72,6 @@ const videosAddLegacyValidator = getCommonVideoEditAttributes().concat([
     .custom(isIdValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videosAdd parameters', { parameters: req.body, files: req.files })
-
     if (areValidationErrors(req, res)) return cleanUpReqFiles(req)
 
     const videoFile: express.VideoUploadFile = req.files['videofile'][0]
@@ -202,7 +200,7 @@ const videosAddResumableInitValidator = getCommonVideoEditAttributes().concat([
       files: req.files
     })
 
-    if (areValidationErrors(req, res)) return cleanup()
+    if (areValidationErrors(req, res, { omitLog: true })) return cleanup()
 
     const files = { videofile: [ videoFileMetadata ] }
     if (!await commonVideoChecksPass({ req, res, user, videoFileSize: videoFileMetadata.size, files })) return cleanup()
@@ -231,8 +229,6 @@ const videosUpdateValidator = getCommonVideoEditAttributes().concat([
     .custom(isIdValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videosUpdate parameters', { parameters: req.body })
-
     if (areValidationErrors(req, res)) return cleanUpReqFiles(req)
     if (areErrorsInScheduleUpdate(req, res)) return cleanUpReqFiles(req)
     if (!await doesVideoExist(req.params.id, res)) return cleanUpReqFiles(req)
@@ -284,8 +280,6 @@ const videosCustomGetValidator = (
     isValidVideoIdParam('id'),
 
     async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-      logger.debug('Checking videosGet parameters', { parameters: req.params })
-
       if (areValidationErrors(req, res)) return
       if (!await doesVideoExist(req.params.id, res, fetchType)) return
 
@@ -311,8 +305,6 @@ const videoFileMetadataGetValidator = getCommonVideoEditAttributes().concat([
     .custom(isIdValid).not().isEmpty().withMessage('Should have a valid videoFileId'),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videoFileMetadataGet parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
     if (!await doesVideoFileOfVideoExist(+req.params.videoFileId, req.params.id, res)) return
 
@@ -324,8 +316,6 @@ const videosRemoveValidator = [
   isValidVideoIdParam('id'),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking videosRemove parameters', { parameters: req.params })
-
     if (areValidationErrors(req, res)) return
     if (!await doesVideoExist(req.params.id, res)) return
 
@@ -485,8 +475,6 @@ const commonVideosFiltersValidator = [
     .custom(exists),
 
   (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking commons video filters query', { parameters: req.query })
-
     if (areValidationErrors(req, res)) return
 
     // FIXME: deprecated in 4.0, to remove
index 4c176f1626d7688e86bfe21556c3e1121877825a..dcfba99fa84551bddaf5c256c7be6c154de3b7ea 100644 (file)
@@ -3,7 +3,6 @@ import { query } from 'express-validator'
 import { HttpStatusCode } from '../../../shared/models/http/http-error-codes'
 import { isWebfingerLocalResourceValid } from '../../helpers/custom-validators/webfinger'
 import { getHostWithPort } from '../../helpers/express-utils'
-import { logger } from '../../helpers/logger'
 import { ActorModel } from '../../models/actor/actor'
 import { areValidationErrors } from './shared'
 
@@ -12,8 +11,6 @@ const webfingerValidator = [
     .custom(isWebfingerLocalResourceValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking webfinger parameters', { parameters: req.query })
-
     if (areValidationErrors(req, res)) return
 
     // Remove 'acct:' from the beginning of the string