diff options
Diffstat (limited to 'server/middlewares/validators/config.ts')
-rw-r--r-- | server/middlewares/validators/config.ts | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/server/middlewares/validators/config.ts b/server/middlewares/validators/config.ts index d0071ccc1..93de453a7 100644 --- a/server/middlewares/validators/config.ts +++ b/server/middlewares/validators/config.ts | |||
@@ -8,6 +8,7 @@ import { isUserNSFWPolicyValid, isUserVideoQuotaDailyValid, isUserVideoQuotaVali | |||
8 | import { logger } from '../../helpers/logger' | 8 | import { logger } from '../../helpers/logger' |
9 | import { isThemeRegistered } from '../../lib/plugins/theme-utils' | 9 | import { isThemeRegistered } from '../../lib/plugins/theme-utils' |
10 | import { areValidationErrors } from './utils' | 10 | import { areValidationErrors } from './utils' |
11 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
11 | 12 | ||
12 | const customConfigUpdateValidator = [ | 13 | const customConfigUpdateValidator = [ |
13 | body('instance.name').exists().withMessage('Should have a valid instance name'), | 14 | body('instance.name').exists().withMessage('Should have a valid instance name'), |
@@ -105,9 +106,9 @@ function checkInvalidConfigIfEmailDisabled (customConfig: CustomConfig, res: exp | |||
105 | if (isEmailEnabled()) return true | 106 | if (isEmailEnabled()) return true |
106 | 107 | ||
107 | if (customConfig.signup.requiresEmailVerification === true) { | 108 | if (customConfig.signup.requiresEmailVerification === true) { |
108 | res.status(400) | 109 | res.status(HttpStatusCode.BAD_REQUEST_400) |
109 | .send({ error: 'Emailer is disabled but you require signup email verification.' }) | 110 | .send({ error: 'Emailer is disabled but you require signup email verification.' }) |
110 | .end() | 111 | .end() |
111 | return false | 112 | return false |
112 | } | 113 | } |
113 | 114 | ||
@@ -118,7 +119,7 @@ function checkInvalidTranscodingConfig (customConfig: CustomConfig, res: express | |||
118 | if (customConfig.transcoding.enabled === false) return true | 119 | if (customConfig.transcoding.enabled === false) return true |
119 | 120 | ||
120 | if (customConfig.transcoding.webtorrent.enabled === false && customConfig.transcoding.hls.enabled === false) { | 121 | if (customConfig.transcoding.webtorrent.enabled === false && customConfig.transcoding.hls.enabled === false) { |
121 | res.status(400) | 122 | res.status(HttpStatusCode.BAD_REQUEST_400) |
122 | .send({ error: 'You need to enable at least webtorrent transcoding or hls transcoding' }) | 123 | .send({ error: 'You need to enable at least webtorrent transcoding or hls transcoding' }) |
123 | .end() | 124 | .end() |
124 | return false | 125 | return false |
@@ -131,7 +132,7 @@ function checkInvalidLiveConfig (customConfig: CustomConfig, res: express.Respon | |||
131 | if (customConfig.live.enabled === false) return true | 132 | if (customConfig.live.enabled === false) return true |
132 | 133 | ||
133 | if (customConfig.live.allowReplay === true && customConfig.transcoding.enabled === false) { | 134 | if (customConfig.live.allowReplay === true && customConfig.transcoding.enabled === false) { |
134 | res.status(400) | 135 | res.status(HttpStatusCode.BAD_REQUEST_400) |
135 | .send({ error: 'You cannot allow live replay if transcoding is not enabled' }) | 136 | .send({ error: 'You cannot allow live replay if transcoding is not enabled' }) |
136 | .end() | 137 | .end() |
137 | return false | 138 | return false |