Optimize videos feed endpoint
This commit is contained in:
parent
fd5586b337
commit
649e812947
|
@ -167,7 +167,7 @@ async function generateVideoFeed (req: express.Request, res: express.Response) {
|
||||||
videoChannelId: videoChannel ? videoChannel.id : null
|
videoChannelId: videoChannel ? videoChannel.id : null
|
||||||
}
|
}
|
||||||
|
|
||||||
const resultList = await VideoModel.listForApi({
|
const { data } = await VideoModel.listForApi({
|
||||||
start,
|
start,
|
||||||
count: FEEDS.COUNT,
|
count: FEEDS.COUNT,
|
||||||
sort: req.query.sort,
|
sort: req.query.sort,
|
||||||
|
@ -175,10 +175,11 @@ async function generateVideoFeed (req: express.Request, res: express.Response) {
|
||||||
nsfw,
|
nsfw,
|
||||||
filter: req.query.filter as VideoFilter,
|
filter: req.query.filter as VideoFilter,
|
||||||
withFiles: true,
|
withFiles: true,
|
||||||
|
countVideos: false,
|
||||||
...options
|
...options
|
||||||
})
|
})
|
||||||
|
|
||||||
addVideosToFeed(feed, resultList.data)
|
addVideosToFeed(feed, data)
|
||||||
|
|
||||||
// Now the feed generation is done, let's send it!
|
// Now the feed generation is done, let's send it!
|
||||||
return sendFeed(feed, req, res)
|
return sendFeed(feed, req, res)
|
||||||
|
@ -198,20 +199,22 @@ async function generateVideoFeedForSubscriptions (req: express.Request, res: exp
|
||||||
queryString: new URL(WEBSERVER.URL + req.url).search
|
queryString: new URL(WEBSERVER.URL + req.url).search
|
||||||
})
|
})
|
||||||
|
|
||||||
const resultList = await VideoModel.listForApi({
|
const { data } = await VideoModel.listForApi({
|
||||||
start,
|
start,
|
||||||
count: FEEDS.COUNT,
|
count: FEEDS.COUNT,
|
||||||
sort: req.query.sort,
|
sort: req.query.sort,
|
||||||
includeLocalVideos: false,
|
includeLocalVideos: false,
|
||||||
nsfw,
|
nsfw,
|
||||||
filter: req.query.filter as VideoFilter,
|
filter: req.query.filter as VideoFilter,
|
||||||
|
|
||||||
withFiles: true,
|
withFiles: true,
|
||||||
|
countVideos: false,
|
||||||
|
|
||||||
followerActorId: res.locals.user.Account.Actor.id,
|
followerActorId: res.locals.user.Account.Actor.id,
|
||||||
user: res.locals.user
|
user: res.locals.user
|
||||||
})
|
})
|
||||||
|
|
||||||
addVideosToFeed(feed, resultList.data)
|
addVideosToFeed(feed, data)
|
||||||
|
|
||||||
// Now the feed generation is done, let's send it!
|
// Now the feed generation is done, let's send it!
|
||||||
return sendFeed(feed, req, res)
|
return sendFeed(feed, req, res)
|
||||||
|
|
Loading…
Reference in New Issue