aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/videos
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-01-08 14:15:16 +0100
committerChocobozzz <me@florianbigard.com>2020-01-08 14:15:16 +0100
commitfe98765624cdd6695739bda719fcb726b71c2b2a (patch)
tree18b19d427e5c25fc9e5290062f307e668f4c9e45 /server/controllers/api/videos
parentddc07312b041c1c533b68a919681fc9bce83430d (diff)
downloadPeerTube-fe98765624cdd6695739bda719fcb726b71c2b2a.tar.gz
PeerTube-fe98765624cdd6695739bda719fcb726b71c2b2a.tar.zst
PeerTube-fe98765624cdd6695739bda719fcb726b71c2b2a.zip
Add ability to skip count query
Diffstat (limited to 'server/controllers/api/videos')
-rw-r--r--server/controllers/api/videos/index.ts7
1 files changed, 5 insertions, 2 deletions
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts
index 35f0b3152..8d4ff07eb 100644
--- a/server/controllers/api/videos/index.ts
+++ b/server/controllers/api/videos/index.ts
@@ -48,7 +48,7 @@ import { videoCommentRouter } from './comment'
48import { rateVideoRouter } from './rate' 48import { rateVideoRouter } from './rate'
49import { ownershipVideoRouter } from './ownership' 49import { ownershipVideoRouter } from './ownership'
50import { VideoFilter } from '../../../../shared/models/videos/video-query.type' 50import { VideoFilter } from '../../../../shared/models/videos/video-query.type'
51import { buildNSFWFilter, createReqFiles } from '../../../helpers/express-utils' 51import { buildNSFWFilter, createReqFiles, getCountVideos } from '../../../helpers/express-utils'
52import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update' 52import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update'
53import { videoCaptionsRouter } from './captions' 53import { videoCaptionsRouter } from './captions'
54import { videoImportsRouter } from './import' 54import { videoImportsRouter } from './import'
@@ -495,6 +495,8 @@ async function getVideoDescription (req: express.Request, res: express.Response)
495} 495}
496 496
497async function listVideos (req: express.Request, res: express.Response) { 497async function listVideos (req: express.Request, res: express.Response) {
498 const countVideos = getCountVideos(req)
499
498 const apiOptions = await Hooks.wrapObject({ 500 const apiOptions = await Hooks.wrapObject({
499 start: req.query.start, 501 start: req.query.start,
500 count: req.query.count, 502 count: req.query.count,
@@ -508,7 +510,8 @@ async function listVideos (req: express.Request, res: express.Response) {
508 nsfw: buildNSFWFilter(res, req.query.nsfw), 510 nsfw: buildNSFWFilter(res, req.query.nsfw),
509 filter: req.query.filter as VideoFilter, 511 filter: req.query.filter as VideoFilter,
510 withFiles: false, 512 withFiles: false,
511 user: res.locals.oauth ? res.locals.oauth.token.User : undefined 513 user: res.locals.oauth ? res.locals.oauth.token.User : undefined,
514 countVideos
512 }, 'filter:api.videos.list.params') 515 }, 'filter:api.videos.list.params')
513 516
514 const resultList = await Hooks.wrapPromiseFun( 517 const resultList = await Hooks.wrapPromiseFun(