diff options
Diffstat (limited to 'server/controllers/api/videos/index.ts')
-rw-r--r-- | server/controllers/api/videos/index.ts | 25 |
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 | |||
10 | import { generateVideoFilename, getVideoFilePath } from '@server/lib/video-paths' | 10 | import { generateVideoFilename, getVideoFilePath } from '@server/lib/video-paths' |
11 | import { getServerActor } from '@server/models/application/application' | 11 | import { getServerActor } from '@server/models/application/application' |
12 | import { MVideo, MVideoFile, MVideoFullLight } from '@server/types/models' | 12 | import { MVideo, MVideoFile, MVideoFullLight } from '@server/types/models' |
13 | import { VideoCreate, VideoState, VideoUpdate } from '../../../../shared' | 13 | import { VideoCreate, VideosCommonQuery, VideoState, VideoUpdate } from '../../../../shared' |
14 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | 14 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' |
15 | import { VideoFilter } from '../../../../shared/models/videos/video-query.type' | ||
16 | import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger' | 15 | import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger' |
17 | import { resetSequelizeInstance, retryTransactionWrapper } from '../../../helpers/database-utils' | 16 | import { resetSequelizeInstance, retryTransactionWrapper } from '../../../helpers/database-utils' |
18 | import { buildNSFWFilter, createReqFiles, getCountVideos } from '../../../helpers/express-utils' | 17 | import { buildNSFWFilter, createReqFiles, getCountVideos } from '../../../helpers/express-utils' |
@@ -494,20 +493,22 @@ async function getVideoFileMetadata (req: express.Request, res: express.Response | |||
494 | } | 493 | } |
495 | 494 | ||
496 | async function listVideos (req: express.Request, res: express.Response) { | 495 | async 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 |