aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/accounts.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/accounts.ts')
-rw-r--r--server/controllers/api/accounts.ts18
1 files changed, 13 insertions, 5 deletions
diff --git a/server/controllers/api/accounts.ts b/server/controllers/api/accounts.ts
index 8eb880d59..44edffe38 100644
--- a/server/controllers/api/accounts.ts
+++ b/server/controllers/api/accounts.ts
@@ -2,6 +2,7 @@ import express from 'express'
2import { pickCommonVideoQuery } from '@server/helpers/query' 2import { pickCommonVideoQuery } from '@server/helpers/query'
3import { ActorFollowModel } from '@server/models/actor/actor-follow' 3import { ActorFollowModel } from '@server/models/actor/actor-follow'
4import { getServerActor } from '@server/models/application/application' 4import { getServerActor } from '@server/models/application/application'
5import { guessAdditionalAttributesFromQuery } from '@server/models/video/formatter/video-format-utils'
5import { buildNSFWFilter, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils' 6import { buildNSFWFilter, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils'
6import { getFormattedObjects } from '../../helpers/utils' 7import { getFormattedObjects } from '../../helpers/utils'
7import { JobQueue } from '../../lib/job-queue' 8import { JobQueue } from '../../lib/job-queue'
@@ -169,17 +170,24 @@ async function listAccountPlaylists (req: express.Request, res: express.Response
169} 170}
170 171
171async function listAccountVideos (req: express.Request, res: express.Response) { 172async function listAccountVideos (req: express.Request, res: express.Response) {
173 const serverActor = await getServerActor()
174
172 const account = res.locals.account 175 const account = res.locals.account
173 const followerActorId = isUserAbleToSearchRemoteURI(res) ? null : undefined 176
177 const displayOnlyForFollower = isUserAbleToSearchRemoteURI(res)
178 ? null
179 : {
180 actorId: serverActor.id,
181 orLocalVideos: true
182 }
183
174 const countVideos = getCountVideos(req) 184 const countVideos = getCountVideos(req)
175 const query = pickCommonVideoQuery(req.query) 185 const query = pickCommonVideoQuery(req.query)
176 186
177 const apiOptions = await Hooks.wrapObject({ 187 const apiOptions = await Hooks.wrapObject({
178 ...query, 188 ...query,
179 189
180 followerActorId, 190 displayOnlyForFollower,
181 search: req.query.search,
182 includeLocalVideos: true,
183 nsfw: buildNSFWFilter(res, query.nsfw), 191 nsfw: buildNSFWFilter(res, query.nsfw),
184 withFiles: false, 192 withFiles: false,
185 accountId: account.id, 193 accountId: account.id,
@@ -193,7 +201,7 @@ async function listAccountVideos (req: express.Request, res: express.Response) {
193 'filter:api.accounts.videos.list.result' 201 'filter:api.accounts.videos.list.result'
194 ) 202 )
195 203
196 return res.json(getFormattedObjects(resultList.data, resultList.total)) 204 return res.json(getFormattedObjects(resultList.data, resultList.total, guessAdditionalAttributesFromQuery(query)))
197} 205}
198 206
199async function listAccountRatings (req: express.Request, res: express.Response) { 207async function listAccountRatings (req: express.Request, res: express.Response) {