diff options
Diffstat (limited to 'server/controllers/api/accounts.ts')
-rw-r--r-- | server/controllers/api/accounts.ts | 19 |
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 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { getFormattedObjects, getServerActor } from '../../helpers/utils' | 2 | import { getFormattedObjects } from '../../helpers/utils' |
3 | import { | 3 | import { |
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' |
22 | import { AccountModel } from '../../models/account/account' | 23 | import { AccountModel } from '../../models/account/account' |
23 | import { AccountVideoRateModel } from '../../models/account/account-video-rate' | 24 | import { AccountVideoRateModel } from '../../models/account/account-video-rate' |
24 | import { VideoModel } from '../../models/video/video' | 25 | import { VideoModel } from '../../models/video/video' |
25 | import { buildNSFWFilter, isUserAbleToSearchRemoteURI, getCountVideos } from '../../helpers/express-utils' | 26 | import { buildNSFWFilter, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils' |
26 | import { VideoChannelModel } from '../../models/video/video-channel' | 27 | import { VideoChannelModel } from '../../models/video/video-channel' |
27 | import { JobQueue } from '../../lib/job-queue' | 28 | import { JobQueue } from '../../lib/job-queue' |
28 | import { logger } from '../../helpers/logger' | ||
29 | import { VideoPlaylistModel } from '../../models/video/video-playlist' | 29 | import { VideoPlaylistModel } from '../../models/video/video-playlist' |
30 | import { | 30 | import { commonVideoPlaylistFiltersValidator, videoPlaylistsSearchValidator } from '../../middlewares/validators/videos/video-playlists' |
31 | commonVideoPlaylistFiltersValidator, | 31 | import { getServerActor } from '@server/models/application/application' |
32 | videoPlaylistsSearchValidator | ||
33 | } from '../../middlewares/validators/videos/video-playlists' | ||
34 | 32 | ||
35 | const accountsRouter = express.Router() | 33 | const accountsRouter = express.Router() |
36 | 34 | ||
@@ -60,6 +58,7 @@ accountsRouter.get('/:accountName/videos', | |||
60 | 58 | ||
61 | accountsRouter.get('/:accountName/video-channels', | 59 | accountsRouter.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) |