aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/accounts.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/accounts.ts')
-rw-r--r--server/controllers/api/accounts.ts11
1 files changed, 9 insertions, 2 deletions
diff --git a/server/controllers/api/accounts.ts b/server/controllers/api/accounts.ts
index 0a73dfcbf..9eb29d330 100644
--- a/server/controllers/api/accounts.ts
+++ b/server/controllers/api/accounts.ts
@@ -2,6 +2,7 @@ import * as express from 'express'
2import { getServerActor } from '@server/models/application/application' 2import { getServerActor } from '@server/models/application/application'
3import { buildNSFWFilter, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils' 3import { buildNSFWFilter, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils'
4import { getFormattedObjects } from '../../helpers/utils' 4import { getFormattedObjects } from '../../helpers/utils'
5import { Hooks } from '../../lib/plugins/hooks'
5import { JobQueue } from '../../lib/job-queue' 6import { JobQueue } from '../../lib/job-queue'
6import { 7import {
7 asyncMiddleware, 8 asyncMiddleware,
@@ -158,7 +159,7 @@ async function listAccountVideos (req: express.Request, res: express.Response) {
158 const followerActorId = isUserAbleToSearchRemoteURI(res) ? null : undefined 159 const followerActorId = isUserAbleToSearchRemoteURI(res) ? null : undefined
159 const countVideos = getCountVideos(req) 160 const countVideos = getCountVideos(req)
160 161
161 const resultList = await VideoModel.listForApi({ 162 const apiOptions = await Hooks.wrapObject({
162 followerActorId, 163 followerActorId,
163 start: req.query.start, 164 start: req.query.start,
164 count: req.query.count, 165 count: req.query.count,
@@ -175,7 +176,13 @@ async function listAccountVideos (req: express.Request, res: express.Response) {
175 accountId: account.id, 176 accountId: account.id,
176 user: res.locals.oauth ? res.locals.oauth.token.User : undefined, 177 user: res.locals.oauth ? res.locals.oauth.token.User : undefined,
177 countVideos 178 countVideos
178 }) 179 }, 'filter:api.videos.list.params')
180
181 const resultList = await Hooks.wrapPromiseFun(
182 VideoModel.listForApi,
183 apiOptions,
184 'filter:api.videos.list.result'
185 )
179 186
180 return res.json(getFormattedObjects(resultList.data, resultList.total)) 187 return res.json(getFormattedObjects(resultList.data, resultList.total))
181} 188}