aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/feeds.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-10-27 14:37:04 +0200
committerChocobozzz <chocobozzz@cpy.re>2021-10-29 11:48:21 +0200
commit2760b454a761f6af3138b2fb5f34340772ab0d1e (patch)
tree2b3a2d81478f8b432eb54cce4caa5a760c494627 /server/controllers/feeds.ts
parente4611b54910d8e7f2b4f8a97ee2d9cc8e1054127 (diff)
downloadPeerTube-2760b454a761f6af3138b2fb5f34340772ab0d1e.tar.gz
PeerTube-2760b454a761f6af3138b2fb5f34340772ab0d1e.tar.zst
PeerTube-2760b454a761f6af3138b2fb5f34340772ab0d1e.zip
Deprecate filter video query
Introduce include and isLocal instead
Diffstat (limited to 'server/controllers/feeds.ts')
-rw-r--r--server/controllers/feeds.ts21
1 files changed, 15 insertions, 6 deletions
diff --git a/server/controllers/feeds.ts b/server/controllers/feeds.ts
index 5ac2e43a1..1f6aebac3 100644
--- a/server/controllers/feeds.ts
+++ b/server/controllers/feeds.ts
@@ -1,7 +1,7 @@
1import express from 'express' 1import express from 'express'
2import Feed from 'pfeed' 2import Feed from 'pfeed'
3import { getServerActor } from '@server/models/application/application'
3import { getCategoryLabel } from '@server/models/video/formatter/video-format-utils' 4import { getCategoryLabel } from '@server/models/video/formatter/video-format-utils'
4import { VideoFilter } from '../../shared/models/videos/video-query.type'
5import { buildNSFWFilter } from '../helpers/express-utils' 5import { buildNSFWFilter } from '../helpers/express-utils'
6import { CONFIG } from '../initializers/config' 6import { CONFIG } from '../initializers/config'
7import { FEEDS, PREVIEWS_SIZE, ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers/constants' 7import { FEEDS, PREVIEWS_SIZE, ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers/constants'
@@ -160,13 +160,18 @@ async function generateVideoFeed (req: express.Request, res: express.Response) {
160 videoChannelId: videoChannel ? videoChannel.id : null 160 videoChannelId: videoChannel ? videoChannel.id : null
161 } 161 }
162 162
163 const server = await getServerActor()
163 const { data } = await VideoModel.listForApi({ 164 const { data } = await VideoModel.listForApi({
164 start, 165 start,
165 count: FEEDS.COUNT, 166 count: FEEDS.COUNT,
166 sort: req.query.sort, 167 sort: req.query.sort,
167 includeLocalVideos: true, 168 displayOnlyForFollower: {
169 actorId: server.id,
170 orLocalVideos: true
171 },
168 nsfw, 172 nsfw,
169 filter: req.query.filter as VideoFilter, 173 isLocal: req.query.isLocal,
174 include: req.query.include,
170 withFiles: true, 175 withFiles: true,
171 countVideos: false, 176 countVideos: false,
172 ...options 177 ...options
@@ -196,14 +201,18 @@ async function generateVideoFeedForSubscriptions (req: express.Request, res: exp
196 start, 201 start,
197 count: FEEDS.COUNT, 202 count: FEEDS.COUNT,
198 sort: req.query.sort, 203 sort: req.query.sort,
199 includeLocalVideos: false,
200 nsfw, 204 nsfw,
201 filter: req.query.filter as VideoFilter, 205
206 isLocal: req.query.isLocal,
207 include: req.query.include,
202 208
203 withFiles: true, 209 withFiles: true,
204 countVideos: false, 210 countVideos: false,
205 211
206 followerActorId: res.locals.user.Account.Actor.id, 212 displayOnlyForFollower: {
213 actorId: res.locals.user.Account.Actor.id,
214 orLocalVideos: false
215 },
207 user: res.locals.user 216 user: res.locals.user
208 }) 217 })
209 218