mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 19:42:24 +02:00
Add video comments RSS
This commit is contained in:
parent
4a7591e1a8
commit
fe3a55b071
8 changed files with 211 additions and 103 deletions
|
@ -7,12 +7,14 @@ import { logger } from '../../helpers/logger'
|
|||
import { areValidationErrors } from './utils'
|
||||
import { isValidRSSFeed } from '../../helpers/custom-validators/feeds'
|
||||
import { isVideoChannelExist } from '../../helpers/custom-validators/video-channels'
|
||||
import { isVideoExist } from '../../helpers/custom-validators/videos'
|
||||
|
||||
const feedsValidator = [
|
||||
const videoFeedsValidator = [
|
||||
param('format').optional().custom(isValidRSSFeed).withMessage('Should have a valid format (rss, atom, json)'),
|
||||
query('format').optional().custom(isValidRSSFeed).withMessage('Should have a valid format (rss, atom, json)'),
|
||||
query('accountId').optional().custom(isIdOrUUIDValid),
|
||||
query('accountName').optional().custom(isAccountNameValid),
|
||||
query('videoChannelId').optional().custom(isIdOrUUIDValid),
|
||||
|
||||
async (req: express.Request, res: express.Response, next: express.NextFunction) => {
|
||||
logger.debug('Checking feeds parameters', { parameters: req.query })
|
||||
|
@ -26,8 +28,25 @@ const feedsValidator = [
|
|||
}
|
||||
]
|
||||
|
||||
const videoCommentsFeedsValidator = [
|
||||
param('format').optional().custom(isValidRSSFeed).withMessage('Should have a valid format (rss, atom, json)'),
|
||||
query('format').optional().custom(isValidRSSFeed).withMessage('Should have a valid format (rss, atom, json)'),
|
||||
query('videoId').optional().custom(isIdOrUUIDValid),
|
||||
|
||||
async (req: express.Request, res: express.Response, next: express.NextFunction) => {
|
||||
logger.debug('Checking feeds parameters', { parameters: req.query })
|
||||
|
||||
if (areValidationErrors(req, res)) return
|
||||
|
||||
if (req.query.videoId && !await isVideoExist(req.query.videoId, res)) return
|
||||
|
||||
return next()
|
||||
}
|
||||
]
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export {
|
||||
feedsValidator
|
||||
videoFeedsValidator,
|
||||
videoCommentsFeedsValidator
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue