aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/activitypub
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-05-13 14:49:11 +0200
committerChocobozzz <me@florianbigard.com>2020-05-13 14:49:11 +0200
commit7405b6ba897dbce1b4fd50c92174f1df5ac15adc (patch)
tree88816a1e713801e06ec50fb98c4bb3d05b612d1c /server/controllers/activitypub
parent63748ad00517022de1d89f9dc3003135b2f10629 (diff)
downloadPeerTube-7405b6ba897dbce1b4fd50c92174f1df5ac15adc.tar.gz
PeerTube-7405b6ba897dbce1b4fd50c92174f1df5ac15adc.tar.zst
PeerTube-7405b6ba897dbce1b4fd50c92174f1df5ac15adc.zip
Add missing channel playlists AP endpoint
Diffstat (limited to 'server/controllers/activitypub')
-rw-r--r--server/controllers/activitypub/client.ts20
1 files changed, 16 insertions, 4 deletions
diff --git a/server/controllers/activitypub/client.ts b/server/controllers/activitypub/client.ts
index e44f1c6ab..f94abf808 100644
--- a/server/controllers/activitypub/client.ts
+++ b/server/controllers/activitypub/client.ts
@@ -35,7 +35,7 @@ import { buildDislikeActivity } from '../../lib/activitypub/send/send-dislike'
35import { videoPlaylistElementAPGetValidator, videoPlaylistsGetValidator } from '../../middlewares/validators/videos/video-playlists' 35import { videoPlaylistElementAPGetValidator, videoPlaylistsGetValidator } from '../../middlewares/validators/videos/video-playlists'
36import { VideoPlaylistModel } from '../../models/video/video-playlist' 36import { VideoPlaylistModel } from '../../models/video/video-playlist'
37import { VideoPlaylistPrivacy } from '../../../shared/models/videos/playlist/video-playlist-privacy.model' 37import { VideoPlaylistPrivacy } from '../../../shared/models/videos/playlist/video-playlist-privacy.model'
38import { MAccountId, MActorId, MVideoAPWithoutCaption, MVideoId } from '@server/typings/models' 38import { MAccountId, MActorId, MVideoAPWithoutCaption, MVideoId, MChannelId } from '@server/typings/models'
39import { getServerActor } from '@server/models/application/application' 39import { getServerActor } from '@server/models/application/application'
40import { getRateUrl } from '@server/lib/activitypub/video-rates' 40import { getRateUrl } from '@server/lib/activitypub/video-rates'
41 41
@@ -137,6 +137,11 @@ activityPubClientRouter.get('/video-channels/:name/following',
137 asyncMiddleware(localVideoChannelValidator), 137 asyncMiddleware(localVideoChannelValidator),
138 asyncMiddleware(videoChannelFollowingController) 138 asyncMiddleware(videoChannelFollowingController)
139) 139)
140activityPubClientRouter.get('/video-channels/:name/playlists',
141 executeIfActivityPub,
142 asyncMiddleware(localVideoChannelValidator),
143 asyncMiddleware(videoChannelPlaylistsController)
144)
140 145
141activityPubClientRouter.get('/redundancy/videos/:videoId/:resolution([0-9]+)(-:fps([0-9]+))?', 146activityPubClientRouter.get('/redundancy/videos/:videoId/:resolution([0-9]+)(-:fps([0-9]+))?',
142 executeIfActivityPub, 147 executeIfActivityPub,
@@ -190,7 +195,14 @@ async function accountFollowingController (req: express.Request, res: express.Re
190 195
191async function accountPlaylistsController (req: express.Request, res: express.Response) { 196async function accountPlaylistsController (req: express.Request, res: express.Response) {
192 const account = res.locals.account 197 const account = res.locals.account
193 const activityPubResult = await actorPlaylists(req, account) 198 const activityPubResult = await actorPlaylists(req, { account })
199
200 return activityPubResponse(activityPubContextify(activityPubResult), res)
201}
202
203async function videoChannelPlaylistsController (req: express.Request, res: express.Response) {
204 const channel = res.locals.videoChannel
205 const activityPubResult = await actorPlaylists(req, { channel })
194 206
195 return activityPubResponse(activityPubContextify(activityPubResult), res) 207 return activityPubResponse(activityPubContextify(activityPubResult), res)
196} 208}
@@ -381,9 +393,9 @@ async function actorFollowers (req: express.Request, actor: MActorId) {
381 return activityPubCollectionPagination(WEBSERVER.URL + req.path, handler, req.query.page) 393 return activityPubCollectionPagination(WEBSERVER.URL + req.path, handler, req.query.page)
382} 394}
383 395
384async function actorPlaylists (req: express.Request, account: MAccountId) { 396async function actorPlaylists (req: express.Request, options: { account: MAccountId } | { channel: MChannelId }) {
385 const handler = (start: number, count: number) => { 397 const handler = (start: number, count: number) => {
386 return VideoPlaylistModel.listPublicUrlsOfForAP(account.id, start, count) 398 return VideoPlaylistModel.listPublicUrlsOfForAP(options, start, count)
387 } 399 }
388 400
389 return activityPubCollectionPagination(WEBSERVER.URL + req.path, handler, req.query.page) 401 return activityPubCollectionPagination(WEBSERVER.URL + req.path, handler, req.query.page)