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.ts19
1 files changed, 9 insertions, 10 deletions
diff --git a/server/controllers/api/accounts.ts b/server/controllers/api/accounts.ts
index 05740318e..ccdc610a2 100644
--- a/server/controllers/api/accounts.ts
+++ b/server/controllers/api/accounts.ts
@@ -1,5 +1,5 @@
1import * as express from 'express' 1import * as express from 'express'
2import { getFormattedObjects, getServerActor } from '../../helpers/utils' 2import { getFormattedObjects } from '../../helpers/utils'
3import { 3import {
4 asyncMiddleware, 4 asyncMiddleware,
5 authenticate, 5 authenticate,
@@ -16,21 +16,19 @@ import {
16 accountNameWithHostGetValidator, 16 accountNameWithHostGetValidator,
17 accountsSortValidator, 17 accountsSortValidator,
18 ensureAuthUserOwnsAccountValidator, 18 ensureAuthUserOwnsAccountValidator,
19 videoChannelsSortValidator,
19 videosSortValidator, 20 videosSortValidator,
20 videoChannelsSortValidator 21 videoChannelStatsValidator
21} from '../../middlewares/validators' 22} from '../../middlewares/validators'
22import { AccountModel } from '../../models/account/account' 23import { AccountModel } from '../../models/account/account'
23import { AccountVideoRateModel } from '../../models/account/account-video-rate' 24import { AccountVideoRateModel } from '../../models/account/account-video-rate'
24import { VideoModel } from '../../models/video/video' 25import { VideoModel } from '../../models/video/video'
25import { buildNSFWFilter, isUserAbleToSearchRemoteURI, getCountVideos } from '../../helpers/express-utils' 26import { buildNSFWFilter, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils'
26import { VideoChannelModel } from '../../models/video/video-channel' 27import { VideoChannelModel } from '../../models/video/video-channel'
27import { JobQueue } from '../../lib/job-queue' 28import { JobQueue } from '../../lib/job-queue'
28import { logger } from '../../helpers/logger'
29import { VideoPlaylistModel } from '../../models/video/video-playlist' 29import { VideoPlaylistModel } from '../../models/video/video-playlist'
30import { 30import { commonVideoPlaylistFiltersValidator, videoPlaylistsSearchValidator } from '../../middlewares/validators/videos/video-playlists'
31 commonVideoPlaylistFiltersValidator, 31import { getServerActor } from '@server/models/application/application'
32 videoPlaylistsSearchValidator
33} from '../../middlewares/validators/videos/video-playlists'
34 32
35const accountsRouter = express.Router() 33const accountsRouter = express.Router()
36 34
@@ -60,6 +58,7 @@ accountsRouter.get('/:accountName/videos',
60 58
61accountsRouter.get('/:accountName/video-channels', 59accountsRouter.get('/:accountName/video-channels',
62 asyncMiddleware(accountNameWithHostGetValidator), 60 asyncMiddleware(accountNameWithHostGetValidator),
61 videoChannelStatsValidator,
63 paginationValidator, 62 paginationValidator,
64 videoChannelsSortValidator, 63 videoChannelsSortValidator,
65 setDefaultSort, 64 setDefaultSort,
@@ -104,7 +103,6 @@ function getAccount (req: express.Request, res: express.Response) {
104 103
105 if (account.isOutdated()) { 104 if (account.isOutdated()) {
106 JobQueue.Instance.createJob({ type: 'activitypub-refresher', payload: { type: 'actor', url: account.Actor.url } }) 105 JobQueue.Instance.createJob({ type: 'activitypub-refresher', payload: { type: 'actor', url: account.Actor.url } })
107 .catch(err => logger.error('Cannot create AP refresher job for actor %s.', account.Actor.url, { err }))
108 } 106 }
109 107
110 return res.json(account.toFormattedJSON()) 108 return res.json(account.toFormattedJSON())
@@ -121,7 +119,8 @@ async function listAccountChannels (req: express.Request, res: express.Response)
121 accountId: res.locals.account.id, 119 accountId: res.locals.account.id,
122 start: req.query.start, 120 start: req.query.start,
123 count: req.query.count, 121 count: req.query.count,
124 sort: req.query.sort 122 sort: req.query.sort,
123 withStats: req.query.withStats
125 } 124 }
126 125
127 const resultList = await VideoChannelModel.listByAccount(options) 126 const resultList = await VideoChannelModel.listByAccount(options)