aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares')
-rw-r--r--server/middlewares/validators/videos/videos.ts34
1 files changed, 18 insertions, 16 deletions
diff --git a/server/middlewares/validators/videos/videos.ts b/server/middlewares/validators/videos/videos.ts
index 40a34d3b8..b022b2c23 100644
--- a/server/middlewares/validators/videos/videos.ts
+++ b/server/middlewares/validators/videos/videos.ts
@@ -1,6 +1,9 @@
1import * as express from 'express' 1import * as express from 'express'
2import { body, param, query, ValidationChain } from 'express-validator' 2import { body, param, query, ValidationChain } from 'express-validator'
3import { UserRight, VideoChangeOwnershipStatus, VideoPrivacy } from '../../../../shared' 3import { getServerActor } from '@server/models/application/application'
4import { MVideoFullLight } from '@server/types/models'
5import { ServerErrorCode, UserRight, VideoChangeOwnershipStatus, VideoPrivacy } from '../../../../shared'
6import { VideoChangeOwnershipAccept } from '../../../../shared/models/videos/video-change-ownership-accept.model'
4import { 7import {
5 isBooleanValid, 8 isBooleanValid,
6 isDateValid, 9 isDateValid,
@@ -12,6 +15,8 @@ import {
12 toIntOrNull, 15 toIntOrNull,
13 toValueOrNull 16 toValueOrNull
14} from '../../../helpers/custom-validators/misc' 17} from '../../../helpers/custom-validators/misc'
18import { isNSFWQueryValid, isNumberArray, isStringArray } from '../../../helpers/custom-validators/search'
19import { checkUserCanTerminateOwnershipChange, doesChangeVideoOwnershipExist } from '../../../helpers/custom-validators/video-ownership'
15import { 20import {
16 isScheduleVideoUpdatePrivacyValid, 21 isScheduleVideoUpdatePrivacyValid,
17 isVideoCategoryValid, 22 isVideoCategoryValid,
@@ -27,29 +32,24 @@ import {
27 isVideoSupportValid, 32 isVideoSupportValid,
28 isVideoTagsValid 33 isVideoTagsValid
29} from '../../../helpers/custom-validators/videos' 34} from '../../../helpers/custom-validators/videos'
35import { cleanUpReqFiles } from '../../../helpers/express-utils'
30import { getDurationFromVideoFile } from '../../../helpers/ffmpeg-utils' 36import { getDurationFromVideoFile } from '../../../helpers/ffmpeg-utils'
31import { logger } from '../../../helpers/logger' 37import { logger } from '../../../helpers/logger'
32import { CONSTRAINTS_FIELDS, OVERVIEWS } from '../../../initializers/constants'
33import { authenticatePromiseIfNeeded } from '../../oauth'
34import { areValidationErrors } from '../utils'
35import { cleanUpReqFiles } from '../../../helpers/express-utils'
36import { VideoModel } from '../../../models/video/video'
37import { checkUserCanTerminateOwnershipChange, doesChangeVideoOwnershipExist } from '../../../helpers/custom-validators/video-ownership'
38import { VideoChangeOwnershipAccept } from '../../../../shared/models/videos/video-change-ownership-accept.model'
39import { AccountModel } from '../../../models/account/account'
40import { isNSFWQueryValid, isNumberArray, isStringArray } from '../../../helpers/custom-validators/search'
41import { CONFIG } from '../../../initializers/config'
42import { isLocalVideoAccepted } from '../../../lib/moderation'
43import { Hooks } from '../../../lib/plugins/hooks'
44import { 38import {
45 checkUserCanManageVideo, 39 checkUserCanManageVideo,
46 doesVideoChannelOfAccountExist, 40 doesVideoChannelOfAccountExist,
47 doesVideoExist, 41 doesVideoExist,
48 doesVideoFileOfVideoExist 42 doesVideoFileOfVideoExist
49} from '../../../helpers/middlewares' 43} from '../../../helpers/middlewares'
50import { MVideoFullLight } from '@server/types/models'
51import { getVideoWithAttributes } from '../../../helpers/video' 44import { getVideoWithAttributes } from '../../../helpers/video'
52import { getServerActor } from '@server/models/application/application' 45import { CONFIG } from '../../../initializers/config'
46import { CONSTRAINTS_FIELDS, OVERVIEWS } from '../../../initializers/constants'
47import { isLocalVideoAccepted } from '../../../lib/moderation'
48import { Hooks } from '../../../lib/plugins/hooks'
49import { AccountModel } from '../../../models/account/account'
50import { VideoModel } from '../../../models/video/video'
51import { authenticatePromiseIfNeeded } from '../../oauth'
52import { areValidationErrors } from '../utils'
53 53
54const videosAddValidator = getCommonVideoEditAttributes().concat([ 54const videosAddValidator = getCommonVideoEditAttributes().concat([
55 body('videofile') 55 body('videofile')
@@ -148,7 +148,9 @@ async function checkVideoFollowConstraints (req: express.Request, res: express.R
148 148
149 return res.status(403) 149 return res.status(403)
150 .json({ 150 .json({
151 error: 'Cannot get this video regarding follow constraints.' 151 errorCode: ServerErrorCode.DOES_NOT_RESPECT_FOLLOW_CONSTRAINTS,
152 error: 'Cannot get this video regarding follow constraints.',
153 originUrl: video.url
152 }) 154 })
153} 155}
154 156