aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/activitypub
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/activitypub')
-rw-r--r--server/controllers/activitypub/client.ts56
1 files changed, 56 insertions, 0 deletions
diff --git a/server/controllers/activitypub/client.ts b/server/controllers/activitypub/client.ts
index 7b60cc311..55bd85c48 100644
--- a/server/controllers/activitypub/client.ts
+++ b/server/controllers/activitypub/client.ts
@@ -36,10 +36,26 @@ activityPubClientRouter.get('/videos/watch/:id',
36 executeIfActivityPub(asyncMiddleware(videosGetValidator)), 36 executeIfActivityPub(asyncMiddleware(videosGetValidator)),
37 executeIfActivityPub(asyncMiddleware(videoController)) 37 executeIfActivityPub(asyncMiddleware(videoController))
38) 38)
39activityPubClientRouter.get('/videos/watch/:id/announces',
40 executeIfActivityPub(asyncMiddleware(videosGetValidator)),
41 executeIfActivityPub(asyncMiddleware(videoAnnouncesController))
42)
39activityPubClientRouter.get('/videos/watch/:id/announces/:accountId', 43activityPubClientRouter.get('/videos/watch/:id/announces/:accountId',
40 executeIfActivityPub(asyncMiddleware(videosShareValidator)), 44 executeIfActivityPub(asyncMiddleware(videosShareValidator)),
41 executeIfActivityPub(asyncMiddleware(videoAnnounceController)) 45 executeIfActivityPub(asyncMiddleware(videoAnnounceController))
42) 46)
47activityPubClientRouter.get('/videos/watch/:id/likes',
48 executeIfActivityPub(asyncMiddleware(videosGetValidator)),
49 executeIfActivityPub(asyncMiddleware(videoLikesController))
50)
51activityPubClientRouter.get('/videos/watch/:id/dislikes',
52 executeIfActivityPub(asyncMiddleware(videosGetValidator)),
53 executeIfActivityPub(asyncMiddleware(videoDislikesController))
54)
55activityPubClientRouter.get('/videos/watch/:id/comments',
56 executeIfActivityPub(asyncMiddleware(videosGetValidator)),
57 executeIfActivityPub(asyncMiddleware(videoCommentsController))
58)
43activityPubClientRouter.get('/videos/watch/:videoId/comments/:commentId', 59activityPubClientRouter.get('/videos/watch/:videoId/comments/:commentId',
44 executeIfActivityPub(asyncMiddleware(videoCommentGetValidator)), 60 executeIfActivityPub(asyncMiddleware(videoCommentGetValidator)),
45 executeIfActivityPub(asyncMiddleware(videoCommentController)) 61 executeIfActivityPub(asyncMiddleware(videoCommentController))
@@ -105,6 +121,46 @@ async function videoAnnounceController (req: express.Request, res: express.Respo
105 return res.json(activityPubContextify(object)) 121 return res.json(activityPubContextify(object))
106} 122}
107 123
124async function videoAnnouncesController (req: express.Request, res: express.Response, next: express.NextFunction) {
125 const video: VideoModel = res.locals.video
126
127 // We need more attributes
128 const videoAll = await VideoModel.loadAndPopulateAll(video.id)
129 const object = videoAll.toAnnouncesActivityPubObject()
130
131 return res.json(activityPubContextify(object))
132}
133
134async function videoLikesController (req: express.Request, res: express.Response, next: express.NextFunction) {
135 const video: VideoModel = res.locals.video
136
137 // We need more attributes
138 const videoAll = await VideoModel.loadAndPopulateAll(video.id)
139 const { likesObject } = videoAll.toRatesActivityPubObjects()
140
141 return res.json(activityPubContextify(likesObject))
142}
143
144async function videoDislikesController (req: express.Request, res: express.Response, next: express.NextFunction) {
145 const video: VideoModel = res.locals.video
146
147 // We need more attributes
148 const videoAll = await VideoModel.loadAndPopulateAll(video.id)
149 const { dislikesObject } = videoAll.toRatesActivityPubObjects()
150
151 return res.json(activityPubContextify(dislikesObject))
152}
153
154async function videoCommentsController (req: express.Request, res: express.Response, next: express.NextFunction) {
155 const video: VideoModel = res.locals.video
156
157 // We need more attributes
158 const videoAll = await VideoModel.loadAndPopulateAll(video.id)
159 const commentsObject = videoAll.toCommentsActivityPubObject()
160
161 return res.json(activityPubContextify(commentsObject))
162}
163
108async function videoChannelController (req: express.Request, res: express.Response, next: express.NextFunction) { 164async function videoChannelController (req: express.Request, res: express.Response, next: express.NextFunction) {
109 const videoChannel: VideoChannelModel = res.locals.videoChannel 165 const videoChannel: VideoChannelModel = res.locals.videoChannel
110 166