import { asyncMiddleware, feedsValidator, setDefaultSort, videosSortValidator } from '../middlewares'
import { VideoModel } from '../models/video/video'
import * as Feed from 'pfeed'
-import { ResultList } from '../../shared/models'
import { AccountModel } from '../models/account/account'
import { cacheRoute } from '../middlewares/cache'
-import { VideoSortField } from '../../client/src/app/shared/video/sort-field.type'
+import { VideoChannelModel } from '../models/video/video-channel'
const feedsRouter = express.Router()
const start = 0
const account: AccountModel = res.locals.account
+ const videoChannel: VideoChannelModel = res.locals.videoChannel
const hideNSFW = CONFIG.INSTANCE.DEFAULT_NSFW_POLICY === 'do_not_list'
const resultList = await VideoModel.listForApi({
hideNSFW,
filter: req.query.filter,
withFiles: true,
- accountId: account ? account.id : null
+ accountId: account ? account.id : null,
+ videoChannelId: videoChannel ? videoChannel.id : null
})
// Adding video items to the feed, one at a time
import * as express from 'express'
import { param, query } from 'express-validator/check'
-import { isAccountIdExist, isAccountNameValid, isLocalAccountNameExist } from '../../helpers/custom-validators/accounts'
+import { isAccountIdExist, isAccountNameValid } from '../../helpers/custom-validators/accounts'
import { join } from 'path'
import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc'
import { logger } from '../../helpers/logger'
import { areValidationErrors } from './utils'
import { isValidRSSFeed } from '../../helpers/custom-validators/feeds'
+import { isVideoChannelExist } from '../../helpers/custom-validators/video-channels'
const feedsValidator = [
param('format').optional().custom(isValidRSSFeed).withMessage('Should have a valid format (rss, atom, json)'),
if (areValidationErrors(req, res)) return
- if (req.query.accountId) {
- if (!await isAccountIdExist(req.query.accountId, res)) return
- } else if (req.query.accountName) {
- if (!await isLocalAccountNameExist(req.query.accountName, res)) return
- }
+ if (req.query.accountId && !await isAccountIdExist(req.query.accountId, res)) return
+ if (req.query.videoChannelId && !await isVideoChannelExist(req.query.videoChannelId, res)) return
return next()
}