aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/activitypub
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-16 15:22:39 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:52 +0100
commit20494f122186bb1bfd82f4c598c4744acea27b0c (patch)
tree097652a31ecf70491b970b6c8e06b22380ee004f /server/controllers/activitypub
parentefc32059d980c51793e8e9ac0fb6a885a8026f94 (diff)
downloadPeerTube-20494f122186bb1bfd82f4c598c4744acea27b0c.tar.gz
PeerTube-20494f122186bb1bfd82f4c598c4744acea27b0c.tar.zst
PeerTube-20494f122186bb1bfd82f4c598c4744acea27b0c.zip
Server shares user videos
Diffstat (limited to 'server/controllers/activitypub')
-rw-r--r--server/controllers/activitypub/client.ts27
1 files changed, 26 insertions, 1 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}