+ const videoChannel: VideoChannelModel = res.locals.videoChannel
+
+ return activityPubResponse(activityPubContextify(videoChannel.toActivityPubObject()), res)
+}
+
+async function videoChannelFollowersController (req: express.Request, res: express.Response, next: express.NextFunction) {
+ const videoChannel: VideoChannelModel = res.locals.videoChannel
+ const activityPubResult = await actorFollowers(req, videoChannel.Actor)
+
+ return activityPubResponse(activityPubContextify(activityPubResult), res)
+}
+
+async function videoChannelFollowingController (req: express.Request, res: express.Response, next: express.NextFunction) {
+ const videoChannel: VideoChannelModel = res.locals.videoChannel
+ const activityPubResult = await actorFollowing(req, videoChannel.Actor)
+
+ return activityPubResponse(activityPubContextify(activityPubResult), res)
+}
+
+async function videoCommentController (req: express.Request, res: express.Response, next: express.NextFunction) {
+ const videoComment: VideoCommentModel = res.locals.videoComment
+
+ const threadParentComments = await VideoCommentModel.listThreadParentComments(videoComment, undefined)
+ const isPublic = true // Comments are always public
+ const audience = await getAudience(videoComment.Account.Actor, undefined, isPublic)
+
+ const videoCommentObject = audiencify(videoComment.toActivityPubObject(threadParentComments), audience)
+
+ if (req.path.endsWith('/activity')) {
+ const data = await createActivityData(videoComment.url, videoComment.Account.Actor, videoCommentObject, undefined, audience)
+ return activityPubResponse(activityPubContextify(data), res)
+ }
+
+ return activityPubResponse(activityPubContextify(videoCommentObject), res)
+}
+
+// ---------------------------------------------------------------------------
+
+async function actorFollowing (req: express.Request, actor: ActorModel) {
+ const page = req.query.page || 1
+ const { start, count } = pageToStartAndCount(page, ACTIVITY_PUB.COLLECTION_ITEMS_PER_PAGE)
+
+ const result = await ActorFollowModel.listAcceptedFollowingUrlsForApi([ actor.id ], undefined, start, count)
+ return activityPubCollectionPagination(CONFIG.WEBSERVER.URL + req.url, page, result)
+}
+
+async function actorFollowers (req: express.Request, actor: ActorModel) {
+ const page = req.query.page || 1
+ const { start, count } = pageToStartAndCount(page, ACTIVITY_PUB.COLLECTION_ITEMS_PER_PAGE)
+
+ const result = await ActorFollowModel.listAcceptedFollowerUrlsForApi([ actor.id ], undefined, start, count)
+ return activityPubCollectionPagination(CONFIG.WEBSERVER.URL + req.url, page, result)
+}