diff options
author | Chocobozzz <me@florianbigard.com> | 2022-03-22 16:58:49 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-03-22 17:24:32 +0100 |
commit | 92e66e04f7f51d37b465cff442ce47f6d6d7cadd (patch) | |
tree | 4475c5c601c0f6673ca56afba5b7f70a4fae4ec3 /server/middlewares/validators | |
parent | 1808a1f8e4b7b102823492a2007a46929aebf189 (diff) | |
download | PeerTube-92e66e04f7f51d37b465cff442ce47f6d6d7cadd.tar.gz PeerTube-92e66e04f7f51d37b465cff442ce47f6d6d7cadd.tar.zst PeerTube-92e66e04f7f51d37b465cff442ce47f6d6d7cadd.zip |
Rename studio to editor
Diffstat (limited to 'server/middlewares/validators')
-rw-r--r-- | server/middlewares/validators/config.ts | 12 | ||||
-rw-r--r-- | server/middlewares/validators/videos/index.ts | 2 | ||||
-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 | ||
166 | function checkInvalidVideoEditorConfig (customConfig: CustomConfig, res: express.Response) { | 166 | function 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' | |||
2 | export * from './video-captions' | 2 | export * from './video-captions' |
3 | export * from './video-channels' | 3 | export * from './video-channels' |
4 | export * from './video-comments' | 4 | export * from './video-comments' |
5 | export * from './video-editor' | ||
6 | export * from './video-files' | 5 | export * from './video-files' |
7 | export * from './video-imports' | 6 | export * from './video-imports' |
8 | export * from './video-live' | 7 | export * from './video-live' |
@@ -10,5 +9,6 @@ export * from './video-ownership-changes' | |||
10 | export * from './video-watch' | 9 | export * from './video-watch' |
11 | export * from './video-rates' | 10 | export * from './video-rates' |
12 | export * from './video-shares' | 11 | export * from './video-shares' |
12 | export * from './video-studio' | ||
13 | export * from './video-transcoding' | 13 | export * from './video-transcoding' |
14 | export * from './videos' | 14 | export * 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' | |||
2 | import { body, param } from 'express-validator' | 2 | import { body, param } from 'express-validator' |
3 | import { isIdOrUUIDValid } from '@server/helpers/custom-validators/misc' | 3 | import { isIdOrUUIDValid } from '@server/helpers/custom-validators/misc' |
4 | import { | 4 | import { |
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' |
10 | import { cleanUpReqFiles } from '@server/helpers/express-utils' | 10 | import { cleanUpReqFiles } from '@server/helpers/express-utils' |
11 | import { CONFIG } from '@server/initializers/config' | 11 | import { CONFIG } from '@server/initializers/config' |
12 | import { approximateIntroOutroAdditionalSize, getTaskFile } from '@server/lib/video-editor' | 12 | import { approximateIntroOutroAdditionalSize, getTaskFile } from '@server/lib/video-studio' |
13 | import { isAudioFile } from '@shared/extra-utils' | 13 | import { isAudioFile } from '@shared/extra-utils' |
14 | import { HttpStatusCode, UserRight, VideoEditorCreateEdition, VideoEditorTask, VideoState } from '@shared/models' | 14 | import { HttpStatusCode, UserRight, VideoState, VideoStudioCreateEdition, VideoStudioTask } from '@shared/models' |
15 | import { logger } from '../../../helpers/logger' | 15 | import { logger } from '../../../helpers/logger' |
16 | import { areValidationErrors, checkUserCanManageVideo, checkUserQuota, doesVideoExist } from '../shared' | 16 | import { areValidationErrors, checkUserCanManageVideo, checkUserQuota, doesVideoExist } from '../shared' |
17 | 17 | ||
18 | const videosEditorAddEditionValidator = [ | 18 | const 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 | ||
92 | export { | 92 | export { |
93 | videosEditorAddEditionValidator | 93 | videoStudioAddEditionValidator |
94 | } | 94 | } |
95 | 95 | ||
96 | // --------------------------------------------------------------------------- | 96 | // --------------------------------------------------------------------------- |
97 | 97 | ||
98 | const taskCheckers: { | 98 | const 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 | ||
107 | function checkTask (req: express.Request, task: VideoEditorTask, indice?: number) { | 107 | function 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 | ||