diff options
author | Chocobozzz <me@florianbigard.com> | 2021-05-03 11:06:19 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-05-03 16:42:15 +0200 |
commit | 1fd61899eaea245a5844e33e21f04b2562f16e5e (patch) | |
tree | 2a1d51b37b12219cade35e189d62686cd0fec105 /server/controllers/api/accounts.ts | |
parent | dfcb6f50a607b6b402b4f8fa3d43792d61c912a5 (diff) | |
download | PeerTube-1fd61899eaea245a5844e33e21f04b2562f16e5e.tar.gz PeerTube-1fd61899eaea245a5844e33e21f04b2562f16e5e.tar.zst PeerTube-1fd61899eaea245a5844e33e21f04b2562f16e5e.zip |
Add ability to filter my videos by live
Diffstat (limited to 'server/controllers/api/accounts.ts')
-rw-r--r-- | server/controllers/api/accounts.ts | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/server/controllers/api/accounts.ts b/server/controllers/api/accounts.ts index e31924a94..49a8e3195 100644 --- a/server/controllers/api/accounts.ts +++ b/server/controllers/api/accounts.ts | |||
@@ -1,9 +1,10 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { getServerActor } from '@server/models/application/application' | 2 | import { getServerActor } from '@server/models/application/application' |
3 | import { VideosWithSearchCommonQuery } from '@shared/models' | ||
3 | import { buildNSFWFilter, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils' | 4 | import { buildNSFWFilter, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils' |
4 | import { getFormattedObjects } from '../../helpers/utils' | 5 | import { getFormattedObjects } from '../../helpers/utils' |
5 | import { Hooks } from '../../lib/plugins/hooks' | ||
6 | import { JobQueue } from '../../lib/job-queue' | 6 | import { JobQueue } from '../../lib/job-queue' |
7 | import { Hooks } from '../../lib/plugins/hooks' | ||
7 | import { | 8 | import { |
8 | asyncMiddleware, | 9 | asyncMiddleware, |
9 | authenticate, | 10 | authenticate, |
@@ -158,25 +159,27 @@ async function listAccountVideos (req: express.Request, res: express.Response) { | |||
158 | const account = res.locals.account | 159 | const account = res.locals.account |
159 | const followerActorId = isUserAbleToSearchRemoteURI(res) ? null : undefined | 160 | const followerActorId = isUserAbleToSearchRemoteURI(res) ? null : undefined |
160 | const countVideos = getCountVideos(req) | 161 | const countVideos = getCountVideos(req) |
162 | const query = req.query as VideosWithSearchCommonQuery | ||
161 | 163 | ||
162 | const apiOptions = await Hooks.wrapObject({ | 164 | const apiOptions = await Hooks.wrapObject({ |
163 | followerActorId, | 165 | followerActorId, |
164 | start: req.query.start, | 166 | start: query.start, |
165 | count: req.query.count, | 167 | count: query.count, |
166 | sort: req.query.sort, | 168 | sort: query.sort, |
167 | includeLocalVideos: true, | 169 | includeLocalVideos: true, |
168 | categoryOneOf: req.query.categoryOneOf, | 170 | categoryOneOf: query.categoryOneOf, |
169 | licenceOneOf: req.query.licenceOneOf, | 171 | licenceOneOf: query.licenceOneOf, |
170 | languageOneOf: req.query.languageOneOf, | 172 | languageOneOf: query.languageOneOf, |
171 | tagsOneOf: req.query.tagsOneOf, | 173 | tagsOneOf: query.tagsOneOf, |
172 | tagsAllOf: req.query.tagsAllOf, | 174 | tagsAllOf: query.tagsAllOf, |
173 | filter: req.query.filter, | 175 | filter: query.filter, |
174 | nsfw: buildNSFWFilter(res, req.query.nsfw), | 176 | isLive: query.isLive, |
177 | nsfw: buildNSFWFilter(res, query.nsfw), | ||
175 | withFiles: false, | 178 | withFiles: false, |
176 | accountId: account.id, | 179 | accountId: account.id, |
177 | user: res.locals.oauth ? res.locals.oauth.token.User : undefined, | 180 | user: res.locals.oauth ? res.locals.oauth.token.User : undefined, |
178 | countVideos, | 181 | countVideos, |
179 | search: req.query.search | 182 | search: query.search |
180 | }, 'filter:api.accounts.videos.list.params') | 183 | }, 'filter:api.accounts.videos.list.params') |
181 | 184 | ||
182 | const resultList = await Hooks.wrapPromiseFun( | 185 | const resultList = await Hooks.wrapPromiseFun( |