From 1cd3facc3de899ac864e979cd6d6a704b712cce3 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 10 Oct 2018 11:46:50 +0200 Subject: Add ability to list all local videos Including private/unlisted for moderators/admins --- server/controllers/api/accounts.ts | 4 +++- server/controllers/api/search.ts | 1 + server/controllers/api/video-channel.ts | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) (limited to 'server/controllers/api') diff --git a/server/controllers/api/accounts.ts b/server/controllers/api/accounts.ts index b7691ccba..8e3f60010 100644 --- a/server/controllers/api/accounts.ts +++ b/server/controllers/api/accounts.ts @@ -86,9 +86,11 @@ async function listAccountVideos (req: express.Request, res: express.Response, n languageOneOf: req.query.languageOneOf, tagsOneOf: req.query.tagsOneOf, tagsAllOf: req.query.tagsAllOf, + filter: req.query.filter, nsfw: buildNSFWFilter(res, req.query.nsfw), withFiles: false, - accountId: account.id + accountId: account.id, + userId: res.locals.oauth ? res.locals.oauth.token.User.id : undefined }) return res.json(getFormattedObjects(resultList.data, resultList.total)) diff --git a/server/controllers/api/search.ts b/server/controllers/api/search.ts index 4be2b5ef7..a8a6cfb08 100644 --- a/server/controllers/api/search.ts +++ b/server/controllers/api/search.ts @@ -118,6 +118,7 @@ async function searchVideosDB (query: VideosSearchQuery, res: express.Response) const options = Object.assign(query, { includeLocalVideos: true, nsfw: buildNSFWFilter(res, query.nsfw), + filter: query.filter, userId: res.locals.oauth ? res.locals.oauth.token.User.id : undefined }) const resultList = await VideoModel.searchAndPopulateAccountAndServer(options) diff --git a/server/controllers/api/video-channel.ts b/server/controllers/api/video-channel.ts index 1fa842d9c..c84d1be58 100644 --- a/server/controllers/api/video-channel.ts +++ b/server/controllers/api/video-channel.ts @@ -215,9 +215,11 @@ async function listVideoChannelVideos (req: express.Request, res: express.Respon languageOneOf: req.query.languageOneOf, tagsOneOf: req.query.tagsOneOf, tagsAllOf: req.query.tagsAllOf, + filter: req.query.filter, nsfw: buildNSFWFilter(res, req.query.nsfw), withFiles: false, - videoChannelId: videoChannelInstance.id + videoChannelId: videoChannelInstance.id, + userId: res.locals.oauth ? res.locals.oauth.token.User.id : undefined }) return res.json(getFormattedObjects(resultList.data, resultList.total)) -- cgit v1.2.3