const videoLiveAddValidator = getCommonVideoEditAttributes().concat([
body('channelId')
.customSanitizer(toIntOrNull)
- .custom(isIdValid).withMessage('Should have correct video channel id'),
+ .custom(isIdValid),
body('name')
.custom(isVideoNameValid).withMessage(
body('saveReplay')
.optional()
.customSanitizer(toBooleanOrNull)
- .custom(isBooleanValid).withMessage('Should have a valid saveReplay attribute'),
+ .custom(isBooleanValid).withMessage('Should have a valid saveReplay boolean'),
body('permanentLive')
.optional()
.customSanitizer(toBooleanOrNull)
- .custom(isBooleanValid).withMessage('Should have a valid permanentLive attribute'),
+ .custom(isBooleanValid).withMessage('Should have a valid permanentLive boolean'),
body('latencyMode')
.optional()
.customSanitizer(toIntOrNull)
- .custom(isLiveLatencyModeValid)
- .withMessage('Should have a valid latency mode attribute'),
+ .custom(isLiveLatencyModeValid),
async (req: express.Request, res: express.Response, next: express.NextFunction) => {
logger.debug('Checking videoLiveAddValidator parameters', { parameters: req.body })
if (!await doesVideoChannelOfAccountExist(body.channelId, user, res)) return cleanUpReqFiles(req)
if (CONFIG.LIVE.MAX_INSTANCE_LIVES !== -1) {
- const totalInstanceLives = await VideoModel.countLocalLives()
+ const totalInstanceLives = await VideoModel.countLives({ remote: false, mode: 'not-ended' })
if (totalInstanceLives >= CONFIG.LIVE.MAX_INSTANCE_LIVES) {
cleanUpReqFiles(req)
body('saveReplay')
.optional()
.customSanitizer(toBooleanOrNull)
- .custom(isBooleanValid).withMessage('Should have a valid saveReplay attribute'),
+ .custom(isBooleanValid).withMessage('Should have a valid saveReplay boolean'),
body('latencyMode')
.optional()
.customSanitizer(toIntOrNull)
- .custom(isLiveLatencyModeValid)
- .withMessage('Should have a valid latency mode attribute'),
+ .custom(isLiveLatencyModeValid),
(req: express.Request, res: express.Response, next: express.NextFunction) => {
logger.debug('Checking videoLiveUpdateValidator parameters', { parameters: req.body })