diff options
Diffstat (limited to 'server/middlewares/validators/config.ts')
-rw-r--r-- | server/middlewares/validators/config.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/server/middlewares/validators/config.ts b/server/middlewares/validators/config.ts index 8b14feb3c..e87b2e39d 100644 --- a/server/middlewares/validators/config.ts +++ b/server/middlewares/validators/config.ts | |||
@@ -57,6 +57,8 @@ 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'), | ||
61 | |||
60 | 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'), |
61 | 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'), |
62 | body('import.videos.torrent.enabled').isBoolean().withMessage('Should have a valid import video torrent enabled boolean'), | 64 | body('import.videos.torrent.enabled').isBoolean().withMessage('Should have a valid import video torrent enabled boolean'), |
@@ -104,6 +106,7 @@ const customConfigUpdateValidator = [ | |||
104 | if (!checkInvalidConfigIfEmailDisabled(req.body, res)) return | 106 | if (!checkInvalidConfigIfEmailDisabled(req.body, res)) return |
105 | if (!checkInvalidTranscodingConfig(req.body, res)) return | 107 | if (!checkInvalidTranscodingConfig(req.body, res)) return |
106 | if (!checkInvalidLiveConfig(req.body, res)) return | 108 | if (!checkInvalidLiveConfig(req.body, res)) return |
109 | if (!checkInvalidVideoEditorConfig(req.body, res)) return | ||
107 | 110 | ||
108 | return next() | 111 | return next() |
109 | } | 112 | } |
@@ -159,3 +162,14 @@ function checkInvalidLiveConfig (customConfig: CustomConfig, res: express.Respon | |||
159 | 162 | ||
160 | return true | 163 | return true |
161 | } | 164 | } |
165 | |||
166 | function checkInvalidVideoEditorConfig (customConfig: CustomConfig, res: express.Response) { | ||
167 | if (customConfig.videoEditor.enabled === false) return true | ||
168 | |||
169 | if (customConfig.videoEditor.enabled === true && customConfig.transcoding.enabled === false) { | ||
170 | res.fail({ message: 'You cannot enable video editor if transcoding is not enabled' }) | ||
171 | return false | ||
172 | } | ||
173 | |||
174 | return true | ||
175 | } | ||