+ return activityPubResponse(activityPubContextify(object), res)
+}
+
+async function videoAnnouncesController (req: express.Request, res: express.Response, next: express.NextFunction) {
+ const video: VideoModel = res.locals.video
+
+ const handler = async (start: number, count: number) => {
+ const result = await VideoShareModel.listAndCountByVideoId(video.id, start, count)
+ return {
+ total: result.count,
+ data: result.rows.map(r => r.url)
+ }
+ }
+ const json = await activityPubCollectionPagination(getVideoSharesActivityPubUrl(video), handler, req.query.page)
+
+ return activityPubResponse(activityPubContextify(json), res)
+}
+
+async function videoLikesController (req: express.Request, res: express.Response, next: express.NextFunction) {
+ const video: VideoModel = res.locals.video
+ const json = await videoRates(req, 'like', video, getVideoLikesActivityPubUrl(video))
+
+ return activityPubResponse(activityPubContextify(json), res)
+}
+
+async function videoDislikesController (req: express.Request, res: express.Response, next: express.NextFunction) {
+ const video: VideoModel = res.locals.video
+ const json = await videoRates(req, 'dislike', video, getVideoDislikesActivityPubUrl(video))
+
+ return activityPubResponse(activityPubContextify(json), res)
+}
+
+async function videoCommentsController (req: express.Request, res: express.Response, next: express.NextFunction) {
+ const video: VideoModel = res.locals.video
+
+ const handler = async (start: number, count: number) => {
+ const result = await VideoCommentModel.listAndCountByVideoId(video.id, start, count)
+ return {
+ total: result.count,
+ data: result.rows.map(r => r.url)
+ }
+ }
+ const json = await activityPubCollectionPagination(getVideoCommentsActivityPubUrl(video), handler, req.query.page)
+
+ return activityPubResponse(activityPubContextify(json), res)