X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fcontrollers%2Factivitypub%2Foutbox.ts;h=cdef8e9699b495825b5e80cbac60f2272abb939f;hb=a37e9e74ff07b057370d1ed6c0b391a02be8a6d2;hp=f3dd2ad7d3e5fed8e1be89003813054cde20a24b;hpb=8d5e65349deebd499c0be10fe02d535a77d58ddb;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/controllers/activitypub/outbox.ts b/server/controllers/activitypub/outbox.ts index f3dd2ad7d..cdef8e969 100644 --- a/server/controllers/activitypub/outbox.ts +++ b/server/controllers/activitypub/outbox.ts @@ -1,24 +1,28 @@ -import * as express from 'express' +import express from 'express' +import { MActorLight } from '@server/types/models' import { Activity } from '../../../shared/models/activitypub/activity' import { VideoPrivacy } from '../../../shared/models/videos' import { activityPubCollectionPagination, activityPubContextify } from '../../helpers/activitypub' import { logger } from '../../helpers/logger' -import { buildAnnounceActivity, buildCreateActivity } from '../../lib/activitypub/send' import { buildAudience } from '../../lib/activitypub/audience' -import { asyncMiddleware, localAccountValidator, localVideoChannelValidator } from '../../middlewares' +import { buildAnnounceActivity, buildCreateActivity } from '../../lib/activitypub/send' +import { asyncMiddleware, ensureIsLocalChannel, localAccountValidator, videoChannelsNameWithHostValidator } from '../../middlewares' +import { apPaginationValidator } from '../../middlewares/validators/activitypub' import { VideoModel } from '../../models/video/video' import { activityPubResponse } from './utils' -import { MActorLight } from '@server/typings/models' const outboxRouter = express.Router() outboxRouter.get('/accounts/:name/outbox', + apPaginationValidator, localAccountValidator, asyncMiddleware(outboxController) ) -outboxRouter.get('/video-channels/:name/outbox', - localVideoChannelValidator, +outboxRouter.get('/video-channels/:nameWithHost/outbox', + apPaginationValidator, + asyncMiddleware(videoChannelsNameWithHostValidator), + ensureIsLocalChannel, asyncMiddleware(outboxController) ) @@ -38,7 +42,7 @@ async function outboxController (req: express.Request, res: express.Response) { logger.info('Receiving outbox request for %s.', actorOutboxUrl) const handler = (start: number, count: number) => buildActivities(actor, start, count) - const json = await activityPubCollectionPagination(actorOutboxUrl, handler, req.query.page) + const json = await activityPubCollectionPagination(actorOutboxUrl, handler, req.query.page, req.query.size) return activityPubResponse(activityPubContextify(json), res) }