aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/videos
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-03-22 16:58:49 +0100
committerChocobozzz <me@florianbigard.com>2022-03-22 17:24:32 +0100
commit92e66e04f7f51d37b465cff442ce47f6d6d7cadd (patch)
tree4475c5c601c0f6673ca56afba5b7f70a4fae4ec3 /server/middlewares/validators/videos
parent1808a1f8e4b7b102823492a2007a46929aebf189 (diff)
downloadPeerTube-92e66e04f7f51d37b465cff442ce47f6d6d7cadd.tar.gz
PeerTube-92e66e04f7f51d37b465cff442ce47f6d6d7cadd.tar.zst
PeerTube-92e66e04f7f51d37b465cff442ce47f6d6d7cadd.zip
Rename studio to editor
Diffstat (limited to 'server/middlewares/validators/videos')
-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
2 files changed, 21 insertions, 21 deletions
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