aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/activitypub
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-01-29 08:37:25 +0100
committerChocobozzz <chocobozzz@cpy.re>2019-02-11 09:13:02 +0100
commit092092969633bbcf6d4891a083ea497a7d5c3154 (patch)
tree69e82fe4f60c444cca216830e96afe143a9dac71 /server/controllers/activitypub
parent4348a27d252a3349bafa7ef4859c0e2cf060c255 (diff)
downloadPeerTube-092092969633bbcf6d4891a083ea497a7d5c3154.tar.gz
PeerTube-092092969633bbcf6d4891a083ea497a7d5c3154.tar.zst
PeerTube-092092969633bbcf6d4891a083ea497a7d5c3154.zip
Add hls support on server
Diffstat (limited to 'server/controllers/activitypub')
-rw-r--r--server/controllers/activitypub/client.ts15
1 files changed, 10 insertions, 5 deletions
diff --git a/server/controllers/activitypub/client.ts b/server/controllers/activitypub/client.ts
index 1a4e28dc8..32a83aa5f 100644
--- a/server/controllers/activitypub/client.ts
+++ b/server/controllers/activitypub/client.ts
@@ -37,7 +37,7 @@ import {
37 getVideoSharesActivityPubUrl 37 getVideoSharesActivityPubUrl
38} from '../../lib/activitypub' 38} from '../../lib/activitypub'
39import { VideoCaptionModel } from '../../models/video/video-caption' 39import { VideoCaptionModel } from '../../models/video/video-caption'
40import { videoRedundancyGetValidator } from '../../middlewares/validators/redundancy' 40import { videoFileRedundancyGetValidator, videoPlaylistRedundancyGetValidator } from '../../middlewares/validators/redundancy'
41import { getServerActor } from '../../helpers/utils' 41import { getServerActor } from '../../helpers/utils'
42import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy' 42import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy'
43 43
@@ -66,11 +66,11 @@ activityPubClientRouter.get('/accounts?/:name/dislikes/:videoId',
66 66
67activityPubClientRouter.get('/videos/watch/:id', 67activityPubClientRouter.get('/videos/watch/:id',
68 executeIfActivityPub(asyncMiddleware(cacheRoute(ROUTE_CACHE_LIFETIME.ACTIVITY_PUB.VIDEOS))), 68 executeIfActivityPub(asyncMiddleware(cacheRoute(ROUTE_CACHE_LIFETIME.ACTIVITY_PUB.VIDEOS))),
69 executeIfActivityPub(asyncMiddleware(videosGetValidator)), 69 executeIfActivityPub(asyncMiddleware(videosCustomGetValidator('only-video-with-rights'))),
70 executeIfActivityPub(asyncMiddleware(videoController)) 70 executeIfActivityPub(asyncMiddleware(videoController))
71) 71)
72activityPubClientRouter.get('/videos/watch/:id/activity', 72activityPubClientRouter.get('/videos/watch/:id/activity',
73 executeIfActivityPub(asyncMiddleware(videosGetValidator)), 73 executeIfActivityPub(asyncMiddleware(videosCustomGetValidator('only-video-with-rights'))),
74 executeIfActivityPub(asyncMiddleware(videoController)) 74 executeIfActivityPub(asyncMiddleware(videoController))
75) 75)
76activityPubClientRouter.get('/videos/watch/:id/announces', 76activityPubClientRouter.get('/videos/watch/:id/announces',
@@ -116,7 +116,11 @@ activityPubClientRouter.get('/video-channels/:name/following',
116) 116)
117 117
118activityPubClientRouter.get('/redundancy/videos/:videoId/:resolution([0-9]+)(-:fps([0-9]+))?', 118activityPubClientRouter.get('/redundancy/videos/:videoId/:resolution([0-9]+)(-:fps([0-9]+))?',
119 executeIfActivityPub(asyncMiddleware(videoRedundancyGetValidator)), 119 executeIfActivityPub(asyncMiddleware(videoFileRedundancyGetValidator)),
120 executeIfActivityPub(asyncMiddleware(videoRedundancyController))
121)
122activityPubClientRouter.get('/redundancy/video-playlists/:streamingPlaylistType/:videoId',
123 executeIfActivityPub(asyncMiddleware(videoPlaylistRedundancyGetValidator)),
120 executeIfActivityPub(asyncMiddleware(videoRedundancyController)) 124 executeIfActivityPub(asyncMiddleware(videoRedundancyController))
121) 125)
122 126
@@ -163,7 +167,8 @@ function getAccountVideoRate (rateType: VideoRateType) {
163} 167}
164 168
165async function videoController (req: express.Request, res: express.Response) { 169async function videoController (req: express.Request, res: express.Response) {
166 const video: VideoModel = res.locals.video 170 // We need more attributes
171 const video: VideoModel = await VideoModel.loadForGetAPI(res.locals.video.id)
167 172
168 if (video.url.startsWith(CONFIG.WEBSERVER.URL) === false) return res.redirect(video.url) 173 if (video.url.startsWith(CONFIG.WEBSERVER.URL) === false) return res.redirect(video.url)
169 174