aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/videos
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/videos')
-rw-r--r--server/controllers/api/videos/index.ts10
1 files changed, 8 insertions, 2 deletions
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts
index c0c77f3f7..821ed7ff3 100644
--- a/server/controllers/api/videos/index.ts
+++ b/server/controllers/api/videos/index.ts
@@ -5,6 +5,7 @@ import { doJSONRequest } from '@server/helpers/requests'
5import { LiveManager } from '@server/lib/live' 5import { LiveManager } from '@server/lib/live'
6import { openapiOperationDoc } from '@server/middlewares/doc' 6import { openapiOperationDoc } from '@server/middlewares/doc'
7import { getServerActor } from '@server/models/application/application' 7import { getServerActor } from '@server/models/application/application'
8import { guessAdditionalAttributesFromQuery } from '@server/models/video/formatter/video-format-utils'
8import { MVideoAccountLight } from '@server/types/models' 9import { MVideoAccountLight } from '@server/types/models'
9import { HttpStatusCode } from '../../../../shared/models' 10import { HttpStatusCode } from '../../../../shared/models'
10import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger' 11import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger'
@@ -211,13 +212,18 @@ async function getVideoFileMetadata (req: express.Request, res: express.Response
211} 212}
212 213
213async function listVideos (req: express.Request, res: express.Response) { 214async function listVideos (req: express.Request, res: express.Response) {
215 const serverActor = await getServerActor()
216
214 const query = pickCommonVideoQuery(req.query) 217 const query = pickCommonVideoQuery(req.query)
215 const countVideos = getCountVideos(req) 218 const countVideos = getCountVideos(req)
216 219
217 const apiOptions = await Hooks.wrapObject({ 220 const apiOptions = await Hooks.wrapObject({
218 ...query, 221 ...query,
219 222
220 includeLocalVideos: true, 223 displayOnlyForFollower: {
224 actorId: serverActor.id,
225 orLocalVideos: true
226 },
221 nsfw: buildNSFWFilter(res, query.nsfw), 227 nsfw: buildNSFWFilter(res, query.nsfw),
222 withFiles: false, 228 withFiles: false,
223 user: res.locals.oauth ? res.locals.oauth.token.User : undefined, 229 user: res.locals.oauth ? res.locals.oauth.token.User : undefined,
@@ -230,7 +236,7 @@ async function listVideos (req: express.Request, res: express.Response) {
230 'filter:api.videos.list.result' 236 'filter:api.videos.list.result'
231 ) 237 )
232 238
233 return res.json(getFormattedObjects(resultList.data, resultList.total)) 239 return res.json(getFormattedObjects(resultList.data, resultList.total, guessAdditionalAttributesFromQuery(query)))
234} 240}
235 241
236async function removeVideo (_req: express.Request, res: express.Response) { 242async function removeVideo (_req: express.Request, res: express.Response) {