diff options
Diffstat (limited to 'server/middlewares/validators/config.ts')
-rw-r--r-- | server/middlewares/validators/config.ts | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/server/middlewares/validators/config.ts b/server/middlewares/validators/config.ts index 9ce47c5aa..f60103f48 100644 --- a/server/middlewares/validators/config.ts +++ b/server/middlewares/validators/config.ts | |||
@@ -66,6 +66,8 @@ const customConfigUpdateValidator = [ | |||
66 | body('import.videos.http.enabled').isBoolean().withMessage('Should have a valid import video http enabled boolean'), | 66 | body('import.videos.http.enabled').isBoolean().withMessage('Should have a valid import video http enabled boolean'), |
67 | body('import.videos.torrent.enabled').isBoolean().withMessage('Should have a valid import video torrent enabled boolean'), | 67 | body('import.videos.torrent.enabled').isBoolean().withMessage('Should have a valid import video torrent enabled boolean'), |
68 | 68 | ||
69 | body('import.videoChannelSynchronization.enabled').isBoolean().withMessage('Should have a valid synchronization enabled boolean'), | ||
70 | |||
69 | body('trending.videos.algorithms.default').exists().withMessage('Should have a valid default trending algorithm'), | 71 | body('trending.videos.algorithms.default').exists().withMessage('Should have a valid default trending algorithm'), |
70 | body('trending.videos.algorithms.enabled').exists().withMessage('Should have a valid array of enabled trending algorithms'), | 72 | body('trending.videos.algorithms.enabled').exists().withMessage('Should have a valid array of enabled trending algorithms'), |
71 | 73 | ||
@@ -110,6 +112,7 @@ const customConfigUpdateValidator = [ | |||
110 | if (areValidationErrors(req, res)) return | 112 | if (areValidationErrors(req, res)) return |
111 | if (!checkInvalidConfigIfEmailDisabled(req.body, res)) return | 113 | if (!checkInvalidConfigIfEmailDisabled(req.body, res)) return |
112 | if (!checkInvalidTranscodingConfig(req.body, res)) return | 114 | if (!checkInvalidTranscodingConfig(req.body, res)) return |
115 | if (!checkInvalidSynchronizationConfig(req.body, res)) return | ||
113 | if (!checkInvalidLiveConfig(req.body, res)) return | 116 | if (!checkInvalidLiveConfig(req.body, res)) return |
114 | if (!checkInvalidVideoStudioConfig(req.body, res)) return | 117 | if (!checkInvalidVideoStudioConfig(req.body, res)) return |
115 | 118 | ||
@@ -157,6 +160,14 @@ function checkInvalidTranscodingConfig (customConfig: CustomConfig, res: express | |||
157 | return true | 160 | return true |
158 | } | 161 | } |
159 | 162 | ||
163 | function checkInvalidSynchronizationConfig (customConfig: CustomConfig, res: express.Response) { | ||
164 | if (customConfig.import.videoChannelSynchronization.enabled && !customConfig.import.videos.http.enabled) { | ||
165 | res.fail({ message: 'You need to enable HTTP video import in order to enable channel synchronization' }) | ||
166 | return false | ||
167 | } | ||
168 | return true | ||
169 | } | ||
170 | |||
160 | function checkInvalidLiveConfig (customConfig: CustomConfig, res: express.Response) { | 171 | function checkInvalidLiveConfig (customConfig: CustomConfig, res: express.Response) { |
161 | if (customConfig.live.enabled === false) return true | 172 | if (customConfig.live.enabled === false) return true |
162 | 173 | ||