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.ts16
1 files changed, 4 insertions, 12 deletions
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts
index 5a2ff81dc..49490f79b 100644
--- a/server/controllers/api/videos/index.ts
+++ b/server/controllers/api/videos/index.ts
@@ -1,11 +1,11 @@
1import * as express from 'express' 1import * as express from 'express'
2import toInt from 'validator/lib/toInt' 2import toInt from 'validator/lib/toInt'
3import { pickCommonVideoQuery } from '@server/helpers/query'
3import { doJSONRequest } from '@server/helpers/requests' 4import { doJSONRequest } from '@server/helpers/requests'
4import { LiveManager } from '@server/lib/live' 5import { LiveManager } from '@server/lib/live'
5import { openapiOperationDoc } from '@server/middlewares/doc' 6import { openapiOperationDoc } from '@server/middlewares/doc'
6import { getServerActor } from '@server/models/application/application' 7import { getServerActor } from '@server/models/application/application'
7import { MVideoAccountLight } from '@server/types/models' 8import { MVideoAccountLight } from '@server/types/models'
8import { VideosCommonQuery } from '../../../../shared'
9import { HttpStatusCode } from '../../../../shared/models' 9import { HttpStatusCode } from '../../../../shared/models'
10import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger' 10import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger'
11import { buildNSFWFilter, getCountVideos } from '../../../helpers/express-utils' 11import { buildNSFWFilter, getCountVideos } from '../../../helpers/express-utils'
@@ -211,22 +211,14 @@ async function getVideoFileMetadata (req: express.Request, res: express.Response
211} 211}
212 212
213async function listVideos (req: express.Request, res: express.Response) { 213async function listVideos (req: express.Request, res: express.Response) {
214 const query = req.query as VideosCommonQuery 214 const query = pickCommonVideoQuery(req.query)
215 const countVideos = getCountVideos(req) 215 const countVideos = getCountVideos(req)
216 216
217 const apiOptions = await Hooks.wrapObject({ 217 const apiOptions = await Hooks.wrapObject({
218 start: query.start, 218 ...query,
219 count: query.count, 219
220 sort: query.sort,
221 includeLocalVideos: true, 220 includeLocalVideos: true,
222 categoryOneOf: query.categoryOneOf,
223 licenceOneOf: query.licenceOneOf,
224 languageOneOf: query.languageOneOf,
225 tagsOneOf: query.tagsOneOf,
226 tagsAllOf: query.tagsAllOf,
227 nsfw: buildNSFWFilter(res, query.nsfw), 221 nsfw: buildNSFWFilter(res, query.nsfw),
228 isLive: query.isLive,
229 filter: query.filter,
230 withFiles: false, 222 withFiles: false,
231 user: res.locals.oauth ? res.locals.oauth.token.User : undefined, 223 user: res.locals.oauth ? res.locals.oauth.token.User : undefined,
232 countVideos 224 countVideos