aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/videos/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/videos/index.ts')
-rw-r--r--server/controllers/api/videos/index.ts25
1 files changed, 13 insertions, 12 deletions
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts
index 7fee278f2..6ec6478e4 100644
--- a/server/controllers/api/videos/index.ts
+++ b/server/controllers/api/videos/index.ts
@@ -10,9 +10,8 @@ import { addOptimizeOrMergeAudioJob, buildLocalVideoFromReq, buildVideoThumbnail
10import { generateVideoFilename, getVideoFilePath } from '@server/lib/video-paths' 10import { generateVideoFilename, getVideoFilePath } from '@server/lib/video-paths'
11import { getServerActor } from '@server/models/application/application' 11import { getServerActor } from '@server/models/application/application'
12import { MVideo, MVideoFile, MVideoFullLight } from '@server/types/models' 12import { MVideo, MVideoFile, MVideoFullLight } from '@server/types/models'
13import { VideoCreate, VideoState, VideoUpdate } from '../../../../shared' 13import { VideoCreate, VideosCommonQuery, VideoState, VideoUpdate } from '../../../../shared'
14import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' 14import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
15import { VideoFilter } from '../../../../shared/models/videos/video-query.type'
16import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger' 15import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger'
17import { resetSequelizeInstance, retryTransactionWrapper } from '../../../helpers/database-utils' 16import { resetSequelizeInstance, retryTransactionWrapper } from '../../../helpers/database-utils'
18import { buildNSFWFilter, createReqFiles, getCountVideos } from '../../../helpers/express-utils' 17import { buildNSFWFilter, createReqFiles, getCountVideos } from '../../../helpers/express-utils'
@@ -494,20 +493,22 @@ async function getVideoFileMetadata (req: express.Request, res: express.Response
494} 493}
495 494
496async function listVideos (req: express.Request, res: express.Response) { 495async function listVideos (req: express.Request, res: express.Response) {
496 const query = req.query as VideosCommonQuery
497 const countVideos = getCountVideos(req) 497 const countVideos = getCountVideos(req)
498 498
499 const apiOptions = await Hooks.wrapObject({ 499 const apiOptions = await Hooks.wrapObject({
500 start: req.query.start, 500 start: query.start,
501 count: req.query.count, 501 count: query.count,
502 sort: req.query.sort, 502 sort: query.sort,
503 includeLocalVideos: true, 503 includeLocalVideos: true,
504 categoryOneOf: req.query.categoryOneOf, 504 categoryOneOf: query.categoryOneOf,
505 licenceOneOf: req.query.licenceOneOf, 505 licenceOneOf: query.licenceOneOf,
506 languageOneOf: req.query.languageOneOf, 506 languageOneOf: query.languageOneOf,
507 tagsOneOf: req.query.tagsOneOf, 507 tagsOneOf: query.tagsOneOf,
508 tagsAllOf: req.query.tagsAllOf, 508 tagsAllOf: query.tagsAllOf,
509 nsfw: buildNSFWFilter(res, req.query.nsfw), 509 nsfw: buildNSFWFilter(res, query.nsfw),
510 filter: req.query.filter as VideoFilter, 510 isLive: query.isLive,
511 filter: query.filter,
511 withFiles: false, 512 withFiles: false,
512 user: res.locals.oauth ? res.locals.oauth.token.User : undefined, 513 user: res.locals.oauth ? res.locals.oauth.token.User : undefined,
513 countVideos 514 countVideos