aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers')
-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)