aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/videos/index.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/api/videos/index.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/api/videos/index.ts')
-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) {