]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/controllers/feeds.ts
Try to reduce CSS size
[github/Chocobozzz/PeerTube.git] / server / controllers / feeds.ts
index 5c95069fc2cc8fc035941ee2c79ab553af4c0c48..921067e655623924b63b80439b9bceda281c879c 100644 (file)
@@ -1,8 +1,9 @@
 import * as express from 'express'
 import * as Feed from 'pfeed'
+import { VideoFilter } from '../../shared/models/videos/video-query.type'
 import { buildNSFWFilter } from '../helpers/express-utils'
 import { CONFIG } from '../initializers/config'
-import { FEEDS, ROUTE_CACHE_LIFETIME, THUMBNAILS_SIZE, WEBSERVER } from '../initializers/constants'
+import { FEEDS, PREVIEWS_SIZE, ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers/constants'
 import {
   asyncMiddleware,
   commonVideosFiltersValidator,
@@ -12,12 +13,11 @@ import {
   videoCommentsFeedsValidator,
   videoFeedsValidator,
   videosSortValidator,
-  videoSubscriptonFeedsValidator
+  videoSubscriptionFeedsValidator
 } from '../middlewares'
 import { cacheRoute } from '../middlewares/cache'
 import { VideoModel } from '../models/video/video'
 import { VideoCommentModel } from '../models/video/video-comment'
-import { VideoFilter } from '../../shared/models/videos/video-query.type'
 
 const feedsRouter = express.Router()
 
@@ -60,7 +60,7 @@ feedsRouter.get('/feeds/subscriptions.:format',
     ]
   })(ROUTE_CACHE_LIFETIME.FEEDS)),
   commonVideosFiltersValidator,
-  asyncMiddleware(videoSubscriptonFeedsValidator),
+  asyncMiddleware(videoSubscriptionFeedsValidator),
   asyncMiddleware(generateVideoFeedForSubscriptions)
 )
 
@@ -198,20 +198,17 @@ async function generateVideoFeedForSubscriptions (req: express.Request, res: exp
     queryString: new URL(WEBSERVER.URL + req.url).search
   })
 
-  const options = {
-    followerActorId: res.locals.user.Account.Actor.id,
-    user: res.locals.user
-  }
-
   const resultList = await VideoModel.listForApi({
     start,
     count: FEEDS.COUNT,
     sort: req.query.sort,
-    includeLocalVideos: true,
+    includeLocalVideos: false,
     nsfw,
     filter: req.query.filter as VideoFilter,
     withFiles: true,
-    ...options
+
+    followerActorId: res.locals.user.Account.Actor.id,
+    user: res.locals.user
   })
 
   addVideosToFeed(feed, resultList.data)
@@ -258,7 +255,7 @@ function addVideosToFeed (feed, videos: VideoModel[]) {
    * Adding video items to the feed object, one at a time
    */
   for (const video of videos) {
-    const formattedVideoFiles = video.getFormattedVideoFilesJSON()
+    const formattedVideoFiles = video.getFormattedVideoFilesJSON(false)
 
     const torrents = formattedVideoFiles.map(videoFile => ({
       title: video.name,
@@ -321,9 +318,9 @@ function addVideosToFeed (feed, videos: VideoModel[]) {
       },
       thumbnail: [
         {
-          url: WEBSERVER.URL + video.getMiniatureStaticPath(),
-          height: THUMBNAILS_SIZE.height,
-          width: THUMBNAILS_SIZE.width
+          url: WEBSERVER.URL + video.getPreviewStaticPath(),
+          height: PREVIEWS_SIZE.height,
+          width: PREVIEWS_SIZE.width
         }
       ]
     })