aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/activitypub/client.ts27
-rw-r--r--server/controllers/api/videos/channel.ts4
2 files changed, 28 insertions, 3 deletions
diff --git a/server/controllers/activitypub/client.ts b/server/controllers/activitypub/client.ts
index 76049f496..7b3921770 100644
--- a/server/controllers/activitypub/client.ts
+++ b/server/controllers/activitypub/client.ts
@@ -4,10 +4,13 @@ import * as express from 'express'
4import { database as db } from '../../initializers' 4import { database as db } from '../../initializers'
5import { executeIfActivityPub, localAccountValidator } from '../../middlewares' 5import { executeIfActivityPub, localAccountValidator } from '../../middlewares'
6import { pageToStartAndCount } from '../../helpers' 6import { pageToStartAndCount } from '../../helpers'
7import { AccountInstance } from '../../models' 7import { AccountInstance, VideoChannelInstance } from '../../models'
8import { activityPubCollectionPagination } from '../../helpers/activitypub' 8import { activityPubCollectionPagination } from '../../helpers/activitypub'
9import { ACTIVITY_PUB } from '../../initializers/constants' 9import { ACTIVITY_PUB } from '../../initializers/constants'
10import { asyncMiddleware } from '../../middlewares/async' 10import { asyncMiddleware } from '../../middlewares/async'
11import { videosGetValidator } from '../../middlewares/validators/videos'
12import { VideoInstance } from '../../models/video/video-interface'
13import { videoChannelsGetValidator } from '../../middlewares/validators/video-channels'
11 14
12const activityPubClientRouter = express.Router() 15const activityPubClientRouter = express.Router()
13 16
@@ -26,6 +29,16 @@ activityPubClientRouter.get('/account/:name/following',
26 executeIfActivityPub(asyncMiddleware(accountFollowingController)) 29 executeIfActivityPub(asyncMiddleware(accountFollowingController))
27) 30)
28 31
32activityPubClientRouter.get('/videos/watch/:id',
33 executeIfActivityPub(videosGetValidator),
34 executeIfActivityPub(asyncMiddleware(videoController))
35)
36
37activityPubClientRouter.get('/video-channels/:id',
38 executeIfActivityPub(videoChannelsGetValidator),
39 executeIfActivityPub(asyncMiddleware(videoChannelController))
40)
41
29// --------------------------------------------------------------------------- 42// ---------------------------------------------------------------------------
30 43
31export { 44export {
@@ -63,3 +76,15 @@ async function accountFollowingController (req: express.Request, res: express.Re
63 76
64 return res.json(activityPubResult) 77 return res.json(activityPubResult)
65} 78}
79
80async function videoController (req: express.Request, res: express.Response, next: express.NextFunction) {
81 const video: VideoInstance = res.locals.video
82
83 return res.json(video.toActivityPubObject())
84}
85
86async function videoChannelController (req: express.Request, res: express.Response, next: express.NextFunction) {
87 const videoChannel: VideoChannelInstance = res.locals.videoChannel
88
89 return res.json(videoChannel.toActivityPubObject())
90}
diff --git a/server/controllers/api/videos/channel.ts b/server/controllers/api/videos/channel.ts
index 656bc3129..8f3df2550 100644
--- a/server/controllers/api/videos/channel.ts
+++ b/server/controllers/api/videos/channel.ts
@@ -10,7 +10,7 @@ import {
10 paginationValidator, 10 paginationValidator,
11 setPagination, 11 setPagination,
12 setVideoChannelsSort, 12 setVideoChannelsSort,
13 videoChannelGetValidator, 13 videoChannelsGetValidator,
14 videoChannelsAddValidator, 14 videoChannelsAddValidator,
15 videoChannelsRemoveValidator, 15 videoChannelsRemoveValidator,
16 videoChannelsSortValidator, 16 videoChannelsSortValidator,
@@ -53,7 +53,7 @@ videoChannelRouter.delete('/channels/:id',
53) 53)
54 54
55videoChannelRouter.get('/channels/:id', 55videoChannelRouter.get('/channels/:id',
56 videoChannelGetValidator, 56 videoChannelsGetValidator,
57 asyncMiddleware(getVideoChannel) 57 asyncMiddleware(getVideoChannel)
58) 58)
59 59