import * as express from 'express'
import { CONFIG, FEEDS, ROUTE_CACHE_LIFETIME } from '../initializers/constants'
import { THUMBNAILS_SIZE } from '../initializers'
-import { asyncMiddleware, setDefaultSort, videoCommentsFeedsValidator, videoFeedsValidator, videosSortValidator } from '../middlewares'
+import {
+ asyncMiddleware,
+ commonVideosFiltersValidator,
+ setDefaultSort,
+ videoCommentsFeedsValidator,
+ videoFeedsValidator,
+ videosSortValidator
+} from '../middlewares'
import { VideoModel } from '../models/video/video'
import * as Feed from 'pfeed'
import { AccountModel } from '../models/account/account'
-import { cache } from '../middlewares/cache'
+import { cacheRoute } from '../middlewares/cache'
import { VideoChannelModel } from '../models/video/video-channel'
import { VideoCommentModel } from '../models/video/video-comment'
import { buildNSFWFilter } from '../helpers/express-utils'
const feedsRouter = express.Router()
feedsRouter.get('/feeds/video-comments.:format',
- asyncMiddleware(cache(ROUTE_CACHE_LIFETIME.FEEDS)),
+ asyncMiddleware(cacheRoute(ROUTE_CACHE_LIFETIME.FEEDS)),
asyncMiddleware(videoCommentsFeedsValidator),
asyncMiddleware(generateVideoCommentsFeed)
)
feedsRouter.get('/feeds/videos.:format',
videosSortValidator,
setDefaultSort,
- asyncMiddleware(cache(ROUTE_CACHE_LIFETIME.FEEDS)),
+ asyncMiddleware(cacheRoute(ROUTE_CACHE_LIFETIME.FEEDS)),
+ commonVideosFiltersValidator,
asyncMiddleware(videoFeedsValidator),
asyncMiddleware(generateVideoFeed)
)
// Adding video items to the feed, one at a time
comments.forEach(comment => {
- const link = CONFIG.WEBSERVER.URL + '/videos/watch/' + comment.Video.uuid + ';threadId=' + comment.getThreadId()
+ const link = CONFIG.WEBSERVER.URL + comment.getCommentStaticPath()
feed.addItem({
title: `${comment.Video.name} - ${comment.Account.getDisplayName()}`,
start,
count: FEEDS.COUNT,
sort: req.query.sort,
+ includeLocalVideos: true,
nsfw,
filter: req.query.filter,
withFiles: true,