aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares')
-rw-r--r--server/middlewares/validators/config.ts12
-rw-r--r--server/middlewares/validators/videos/index.ts2
-rw-r--r--server/middlewares/validators/videos/video-studio.ts (renamed from server/middlewares/validators/videos/video-editor.ts)40
3 files changed, 27 insertions, 27 deletions
diff --git a/server/middlewares/validators/config.ts b/server/middlewares/validators/config.ts
index e87b2e39d..1e839d577 100644
--- a/server/middlewares/validators/config.ts
+++ b/server/middlewares/validators/config.ts
@@ -57,7 +57,7 @@ const customConfigUpdateValidator = [
57 body('transcoding.webtorrent.enabled').isBoolean().withMessage('Should have a valid webtorrent transcoding enabled boolean'), 57 body('transcoding.webtorrent.enabled').isBoolean().withMessage('Should have a valid webtorrent transcoding enabled boolean'),
58 body('transcoding.hls.enabled').isBoolean().withMessage('Should have a valid hls transcoding enabled boolean'), 58 body('transcoding.hls.enabled').isBoolean().withMessage('Should have a valid hls transcoding enabled boolean'),
59 59
60 body('videoEditor.enabled').isBoolean().withMessage('Should have a valid video editor enabled boolean'), 60 body('videoStudio.enabled').isBoolean().withMessage('Should have a valid video studio enabled boolean'),
61 61
62 body('import.videos.concurrency').isInt({ min: 0 }).withMessage('Should have a valid import concurrency number'), 62 body('import.videos.concurrency').isInt({ min: 0 }).withMessage('Should have a valid import concurrency number'),
63 body('import.videos.http.enabled').isBoolean().withMessage('Should have a valid import video http enabled boolean'), 63 body('import.videos.http.enabled').isBoolean().withMessage('Should have a valid import video http enabled boolean'),
@@ -106,7 +106,7 @@ const customConfigUpdateValidator = [
106 if (!checkInvalidConfigIfEmailDisabled(req.body, res)) return 106 if (!checkInvalidConfigIfEmailDisabled(req.body, res)) return
107 if (!checkInvalidTranscodingConfig(req.body, res)) return 107 if (!checkInvalidTranscodingConfig(req.body, res)) return
108 if (!checkInvalidLiveConfig(req.body, res)) return 108 if (!checkInvalidLiveConfig(req.body, res)) return
109 if (!checkInvalidVideoEditorConfig(req.body, res)) return 109 if (!checkInvalidVideoStudioConfig(req.body, res)) return
110 110
111 return next() 111 return next()
112 } 112 }
@@ -163,11 +163,11 @@ function checkInvalidLiveConfig (customConfig: CustomConfig, res: express.Respon
163 return true 163 return true
164} 164}
165 165
166function checkInvalidVideoEditorConfig (customConfig: CustomConfig, res: express.Response) { 166function checkInvalidVideoStudioConfig (customConfig: CustomConfig, res: express.Response) {
167 if (customConfig.videoEditor.enabled === false) return true 167 if (customConfig.videoStudio.enabled === false) return true
168 168
169 if (customConfig.videoEditor.enabled === true && customConfig.transcoding.enabled === false) { 169 if (customConfig.videoStudio.enabled === true && customConfig.transcoding.enabled === false) {
170 res.fail({ message: 'You cannot enable video editor if transcoding is not enabled' }) 170 res.fail({ message: 'You cannot enable video studio if transcoding is not enabled' })
171 return false 171 return false
172 } 172 }
173 173
diff --git a/server/middlewares/validators/videos/index.ts b/server/middlewares/validators/videos/index.ts
index faa082510..c7dea4b3d 100644
--- a/server/middlewares/validators/videos/index.ts
+++ b/server/middlewares/validators/videos/index.ts
@@ -2,7 +2,6 @@ export * from './video-blacklist'
2export * from './video-captions' 2export * from './video-captions'
3export * from './video-channels' 3export * from './video-channels'
4export * from './video-comments' 4export * from './video-comments'
5export * from './video-editor'
6export * from './video-files' 5export * from './video-files'
7export * from './video-imports' 6export * from './video-imports'
8export * from './video-live' 7export * from './video-live'
@@ -10,5 +9,6 @@ export * from './video-ownership-changes'
10export * from './video-watch' 9export * from './video-watch'
11export * from './video-rates' 10export * from './video-rates'
12export * from './video-shares' 11export * from './video-shares'
12export * from './video-studio'
13export * from './video-transcoding' 13export * from './video-transcoding'
14export * from './videos' 14export * from './videos'
diff --git a/server/middlewares/validators/videos/video-editor.ts b/server/middlewares/validators/videos/video-studio.ts
index 9be97be93..af7fe2283 100644
--- a/server/middlewares/validators/videos/video-editor.ts
+++ b/server/middlewares/validators/videos/video-studio.ts
@@ -2,31 +2,31 @@ import express from 'express'
2import { body, param } from 'express-validator' 2import { body, param } from 'express-validator'
3import { isIdOrUUIDValid } from '@server/helpers/custom-validators/misc' 3import { isIdOrUUIDValid } from '@server/helpers/custom-validators/misc'
4import { 4import {
5 isEditorCutTaskValid, 5 isStudioCutTaskValid,
6 isEditorTaskAddIntroOutroValid, 6 isStudioTaskAddIntroOutroValid,
7 isEditorTaskAddWatermarkValid, 7 isStudioTaskAddWatermarkValid,
8 isValidEditorTasksArray 8 isValidStudioTasksArray
9} from '@server/helpers/custom-validators/video-editor' 9} from '@server/helpers/custom-validators/video-studio'
10import { cleanUpReqFiles } from '@server/helpers/express-utils' 10import { cleanUpReqFiles } from '@server/helpers/express-utils'
11import { CONFIG } from '@server/initializers/config' 11import { CONFIG } from '@server/initializers/config'
12import { approximateIntroOutroAdditionalSize, getTaskFile } from '@server/lib/video-editor' 12import { approximateIntroOutroAdditionalSize, getTaskFile } from '@server/lib/video-studio'
13import { isAudioFile } from '@shared/extra-utils' 13import { isAudioFile } from '@shared/extra-utils'
14import { HttpStatusCode, UserRight, VideoEditorCreateEdition, VideoEditorTask, VideoState } from '@shared/models' 14import { HttpStatusCode, UserRight, VideoState, VideoStudioCreateEdition, VideoStudioTask } from '@shared/models'
15import { logger } from '../../../helpers/logger' 15import { logger } from '../../../helpers/logger'
16import { areValidationErrors, checkUserCanManageVideo, checkUserQuota, doesVideoExist } from '../shared' 16import { areValidationErrors, checkUserCanManageVideo, checkUserQuota, doesVideoExist } from '../shared'
17 17
18const videosEditorAddEditionValidator = [ 18const videoStudioAddEditionValidator = [
19 param('videoId').custom(isIdOrUUIDValid).withMessage('Should have a valid video id/uuid'), 19 param('videoId').custom(isIdOrUUIDValid).withMessage('Should have a valid video id/uuid'),
20 20
21 body('tasks').custom(isValidEditorTasksArray).withMessage('Should have a valid array of tasks'), 21 body('tasks').custom(isValidStudioTasksArray).withMessage('Should have a valid array of tasks'),
22 22
23 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 23 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
24 logger.debug('Checking videosEditorAddEditionValidator parameters.', { parameters: req.params, body: req.body, files: req.files }) 24 logger.debug('Checking videoStudioAddEditionValidator parameters.', { parameters: req.params, body: req.body, files: req.files })
25 25
26 if (CONFIG.VIDEO_EDITOR.ENABLED !== true) { 26 if (CONFIG.VIDEO_STUDIO.ENABLED !== true) {
27 res.fail({ 27 res.fail({
28 status: HttpStatusCode.BAD_REQUEST_400, 28 status: HttpStatusCode.BAD_REQUEST_400,
29 message: 'Video editor is disabled on this instance' 29 message: 'Video studio is disabled on this instance'
30 }) 30 })
31 31
32 return cleanUpReqFiles(req) 32 return cleanUpReqFiles(req)
@@ -34,7 +34,7 @@ const videosEditorAddEditionValidator = [
34 34
35 if (areValidationErrors(req, res)) return cleanUpReqFiles(req) 35 if (areValidationErrors(req, res)) return cleanUpReqFiles(req)
36 36
37 const body: VideoEditorCreateEdition = req.body 37 const body: VideoStudioCreateEdition = req.body
38 const files = req.files as Express.Multer.File[] 38 const files = req.files as Express.Multer.File[]
39 39
40 for (let i = 0; i < body.tasks.length; i++) { 40 for (let i = 0; i < body.tasks.length; i++) {
@@ -90,21 +90,21 @@ const videosEditorAddEditionValidator = [
90// --------------------------------------------------------------------------- 90// ---------------------------------------------------------------------------
91 91
92export { 92export {
93 videosEditorAddEditionValidator 93 videoStudioAddEditionValidator
94} 94}
95 95
96// --------------------------------------------------------------------------- 96// ---------------------------------------------------------------------------
97 97
98const taskCheckers: { 98const taskCheckers: {
99 [id in VideoEditorTask['name']]: (task: VideoEditorTask, indice?: number, files?: Express.Multer.File[]) => boolean 99 [id in VideoStudioTask['name']]: (task: VideoStudioTask, indice?: number, files?: Express.Multer.File[]) => boolean
100} = { 100} = {
101 'cut': isEditorCutTaskValid, 101 'cut': isStudioCutTaskValid,
102 'add-intro': isEditorTaskAddIntroOutroValid, 102 'add-intro': isStudioTaskAddIntroOutroValid,
103 'add-outro': isEditorTaskAddIntroOutroValid, 103 'add-outro': isStudioTaskAddIntroOutroValid,
104 'add-watermark': isEditorTaskAddWatermarkValid 104 'add-watermark': isStudioTaskAddWatermarkValid
105} 105}
106 106
107function checkTask (req: express.Request, task: VideoEditorTask, indice?: number) { 107function checkTask (req: express.Request, task: VideoStudioTask, indice?: number) {
108 const checker = taskCheckers[task.name] 108 const checker = taskCheckers[task.name]
109 if (!checker) return false 109 if (!checker) return false
110 110