diff options
author | Chocobozzz <me@florianbigard.com> | 2021-10-27 14:37:04 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-10-29 11:48:21 +0200 |
commit | 2760b454a761f6af3138b2fb5f34340772ab0d1e (patch) | |
tree | 2b3a2d81478f8b432eb54cce4caa5a760c494627 /server/controllers/api/videos/index.ts | |
parent | e4611b54910d8e7f2b4f8a97ee2d9cc8e1054127 (diff) | |
download | PeerTube-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.ts | 10 |
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' | |||
5 | import { LiveManager } from '@server/lib/live' | 5 | import { LiveManager } from '@server/lib/live' |
6 | import { openapiOperationDoc } from '@server/middlewares/doc' | 6 | import { openapiOperationDoc } from '@server/middlewares/doc' |
7 | import { getServerActor } from '@server/models/application/application' | 7 | import { getServerActor } from '@server/models/application/application' |
8 | import { guessAdditionalAttributesFromQuery } from '@server/models/video/formatter/video-format-utils' | ||
8 | import { MVideoAccountLight } from '@server/types/models' | 9 | import { MVideoAccountLight } from '@server/types/models' |
9 | import { HttpStatusCode } from '../../../../shared/models' | 10 | import { HttpStatusCode } from '../../../../shared/models' |
10 | import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger' | 11 | import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger' |
@@ -211,13 +212,18 @@ async function getVideoFileMetadata (req: express.Request, res: express.Response | |||
211 | } | 212 | } |
212 | 213 | ||
213 | async function listVideos (req: express.Request, res: express.Response) { | 214 | async 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 | ||
236 | async function removeVideo (_req: express.Request, res: express.Response) { | 242 | async function removeVideo (_req: express.Request, res: express.Response) { |