aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/activitypub/client.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/activitypub/client.ts')
-rw-r--r--server/controllers/activitypub/client.ts22
1 files changed, 11 insertions, 11 deletions
diff --git a/server/controllers/activitypub/client.ts b/server/controllers/activitypub/client.ts
index def320730..750e3091c 100644
--- a/server/controllers/activitypub/client.ts
+++ b/server/controllers/activitypub/client.ts
@@ -48,7 +48,7 @@ activityPubClientRouter.get(
48 [ '/accounts?/:name', '/accounts?/:name/video-channels', '/a/:name', '/a/:name/video-channels' ], 48 [ '/accounts?/:name', '/accounts?/:name/video-channels', '/a/:name', '/a/:name/video-channels' ],
49 executeIfActivityPub, 49 executeIfActivityPub,
50 asyncMiddleware(localAccountValidator), 50 asyncMiddleware(localAccountValidator),
51 accountController 51 asyncMiddleware(accountController)
52) 52)
53activityPubClientRouter.get('/accounts?/:name/followers', 53activityPubClientRouter.get('/accounts?/:name/followers',
54 executeIfActivityPub, 54 executeIfActivityPub,
@@ -69,13 +69,13 @@ activityPubClientRouter.get('/accounts?/:name/likes/:videoId',
69 executeIfActivityPub, 69 executeIfActivityPub,
70 cacheRoute(ROUTE_CACHE_LIFETIME.ACTIVITY_PUB.VIDEOS), 70 cacheRoute(ROUTE_CACHE_LIFETIME.ACTIVITY_PUB.VIDEOS),
71 asyncMiddleware(getAccountVideoRateValidatorFactory('like')), 71 asyncMiddleware(getAccountVideoRateValidatorFactory('like')),
72 getAccountVideoRateFactory('like') 72 asyncMiddleware(getAccountVideoRateFactory('like'))
73) 73)
74activityPubClientRouter.get('/accounts?/:name/dislikes/:videoId', 74activityPubClientRouter.get('/accounts?/:name/dislikes/:videoId',
75 executeIfActivityPub, 75 executeIfActivityPub,
76 cacheRoute(ROUTE_CACHE_LIFETIME.ACTIVITY_PUB.VIDEOS), 76 cacheRoute(ROUTE_CACHE_LIFETIME.ACTIVITY_PUB.VIDEOS),
77 asyncMiddleware(getAccountVideoRateValidatorFactory('dislike')), 77 asyncMiddleware(getAccountVideoRateValidatorFactory('dislike')),
78 getAccountVideoRateFactory('dislike') 78 asyncMiddleware(getAccountVideoRateFactory('dislike'))
79) 79)
80 80
81activityPubClientRouter.get( 81activityPubClientRouter.get(
@@ -131,7 +131,7 @@ activityPubClientRouter.get(
131 executeIfActivityPub, 131 executeIfActivityPub,
132 asyncMiddleware(videoChannelsNameWithHostValidator), 132 asyncMiddleware(videoChannelsNameWithHostValidator),
133 ensureIsLocalChannel, 133 ensureIsLocalChannel,
134 videoChannelController 134 asyncMiddleware(videoChannelController)
135) 135)
136activityPubClientRouter.get('/video-channels/:nameWithHost/followers', 136activityPubClientRouter.get('/video-channels/:nameWithHost/followers',
137 executeIfActivityPub, 137 executeIfActivityPub,
@@ -172,13 +172,13 @@ activityPubClientRouter.get(
172activityPubClientRouter.get('/video-playlists/:playlistId/videos/:playlistElementId', 172activityPubClientRouter.get('/video-playlists/:playlistId/videos/:playlistElementId',
173 executeIfActivityPub, 173 executeIfActivityPub,
174 asyncMiddleware(videoPlaylistElementAPGetValidator), 174 asyncMiddleware(videoPlaylistElementAPGetValidator),
175 videoPlaylistElementController 175 asyncMiddleware(videoPlaylistElementController)
176) 176)
177 177
178activityPubClientRouter.get('/videos/local-viewer/:localViewerId', 178activityPubClientRouter.get('/videos/local-viewer/:localViewerId',
179 executeIfActivityPub, 179 executeIfActivityPub,
180 asyncMiddleware(getVideoLocalViewerValidator), 180 asyncMiddleware(getVideoLocalViewerValidator),
181 getVideoLocalViewerController 181 asyncMiddleware(getVideoLocalViewerController)
182) 182)
183 183
184// --------------------------------------------------------------------------- 184// ---------------------------------------------------------------------------
@@ -189,10 +189,10 @@ export {
189 189
190// --------------------------------------------------------------------------- 190// ---------------------------------------------------------------------------
191 191
192function accountController (req: express.Request, res: express.Response) { 192async function accountController (req: express.Request, res: express.Response) {
193 const account = res.locals.account 193 const account = res.locals.account
194 194
195 return activityPubResponse(activityPubContextify(account.toActivityPubObject(), 'Actor'), res) 195 return activityPubResponse(activityPubContextify(await account.toActivityPubObject(), 'Actor'), res)
196} 196}
197 197
198async function accountFollowersController (req: express.Request, res: express.Response) { 198async function accountFollowersController (req: express.Request, res: express.Response) {
@@ -246,7 +246,7 @@ async function videoController (req: express.Request, res: express.Response) {
246 const videoWithCaptions = Object.assign(video, { VideoCaptions: captions }) 246 const videoWithCaptions = Object.assign(video, { VideoCaptions: captions })
247 247
248 const audience = getAudience(videoWithCaptions.VideoChannel.Account.Actor, videoWithCaptions.privacy === VideoPrivacy.PUBLIC) 248 const audience = getAudience(videoWithCaptions.VideoChannel.Account.Actor, videoWithCaptions.privacy === VideoPrivacy.PUBLIC)
249 const videoObject = audiencify(videoWithCaptions.toActivityPubObject(), audience) 249 const videoObject = audiencify(await videoWithCaptions.toActivityPubObject(), audience)
250 250
251 if (req.path.endsWith('/activity')) { 251 if (req.path.endsWith('/activity')) {
252 const data = buildCreateActivity(videoWithCaptions.url, video.VideoChannel.Account.Actor, videoObject, audience) 252 const data = buildCreateActivity(videoWithCaptions.url, video.VideoChannel.Account.Actor, videoObject, audience)
@@ -321,10 +321,10 @@ async function videoCommentsController (req: express.Request, res: express.Respo
321 return activityPubResponse(activityPubContextify(json, 'Collection'), res) 321 return activityPubResponse(activityPubContextify(json, 'Collection'), res)
322} 322}
323 323
324function videoChannelController (req: express.Request, res: express.Response) { 324async function videoChannelController (req: express.Request, res: express.Response) {
325 const videoChannel = res.locals.videoChannel 325 const videoChannel = res.locals.videoChannel
326 326
327 return activityPubResponse(activityPubContextify(videoChannel.toActivityPubObject(), 'Actor'), res) 327 return activityPubResponse(activityPubContextify(await videoChannel.toActivityPubObject(), 'Actor'), res)
328} 328}
329 329
330async function videoChannelFollowersController (req: express.Request, res: express.Response) { 330async function videoChannelFollowersController (req: express.Request, res: express.Response) {