X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fcontrollers%2Ffeeds.ts;h=29502a15458d8fd91aba60b893a5dd5e32f0bab4;hb=6ba93fa6392429f22d338f3cdce50707995ced3b;hp=cdc6bfb8be176047b3dde2cd271b9c2daf8c3ebd;hpb=20bafcb61bee2a9a10a500908850c9a7d5e3c8c5;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/controllers/feeds.ts b/server/controllers/feeds.ts index cdc6bfb8b..29502a154 100644 --- a/server/controllers/feeds.ts +++ b/server/controllers/feeds.ts @@ -1,7 +1,8 @@ -import * as express from 'express' -import * as Feed from 'pfeed' +import express from 'express' +import Feed from 'pfeed' +import { getServerActor } from '@server/models/application/application' import { getCategoryLabel } from '@server/models/video/formatter/video-format-utils' -import { VideoFilter } from '../../shared/models/videos/video-query.type' +import { VideoInclude } from '@shared/models' import { buildNSFWFilter } from '../helpers/express-utils' import { CONFIG } from '../initializers/config' import { FEEDS, PREVIEWS_SIZE, ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers/constants' @@ -160,14 +161,19 @@ async function generateVideoFeed (req: express.Request, res: express.Response) { videoChannelId: videoChannel ? videoChannel.id : null } + const server = await getServerActor() const { data } = await VideoModel.listForApi({ start, count: FEEDS.COUNT, sort: req.query.sort, - includeLocalVideos: true, + displayOnlyForFollower: { + actorId: server.id, + orLocalVideos: true + }, nsfw, - filter: req.query.filter as VideoFilter, - withFiles: true, + isLocal: req.query.isLocal, + include: req.query.include | VideoInclude.FILES, + hasFiles: true, countVideos: false, ...options }) @@ -196,14 +202,19 @@ async function generateVideoFeedForSubscriptions (req: express.Request, res: exp start, count: FEEDS.COUNT, sort: req.query.sort, - includeLocalVideos: false, nsfw, - filter: req.query.filter as VideoFilter, - withFiles: true, + isLocal: req.query.isLocal, + + hasFiles: true, + include: req.query.include | VideoInclude.FILES, + countVideos: false, - followerActorId: res.locals.user.Account.Actor.id, + displayOnlyForFollower: { + actorId: res.locals.user.Account.Actor.id, + orLocalVideos: false + }, user: res.locals.user }) @@ -286,7 +297,7 @@ function addVideosToFeed (feed, videos: VideoModel[]) { feed.addItem({ title: video.name, id: video.url, - link: WEBSERVER.URL + '/w/' + video.uuid, + link: WEBSERVER.URL + video.getWatchStaticPath(), description: video.getTruncatedDescription(), content: video.description, author: [