X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fcontrollers%2Factivitypub%2Finbox.ts;h=66a38e05569ebe65cddb6f8b3e0cce787dc5e139;hb=a5a79d15427372b581e34ac3999c73fc316699d5;hp=14f301ab726c5ba3959536e68e510102a3c3b9ed;hpb=99afa081bc6ae7f34b2105075bd43e3625434fa8;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/controllers/activitypub/inbox.ts b/server/controllers/activitypub/inbox.ts index 14f301ab7..66a38e055 100644 --- a/server/controllers/activitypub/inbox.ts +++ b/server/controllers/activitypub/inbox.ts @@ -1,10 +1,17 @@ -import * as express from 'express' +import express from 'express' import { InboxManager } from '@server/lib/activitypub/inbox-manager' -import { Activity, ActivityPubCollection, ActivityPubOrderedCollection, RootActivity } from '../../../shared' -import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' +import { Activity, ActivityPubCollection, ActivityPubOrderedCollection, RootActivity } from '@shared/models' +import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' import { isActivityValid } from '../../helpers/custom-validators/activitypub/activity' import { logger } from '../../helpers/logger' -import { asyncMiddleware, checkSignature, localAccountValidator, localVideoChannelValidator, signatureValidator } from '../../middlewares' +import { + asyncMiddleware, + checkSignature, + ensureIsLocalChannel, + localAccountValidator, + signatureValidator, + videoChannelsNameWithHostValidator +} from '../../middlewares' import { activityPubValidator } from '../../middlewares/validators/activitypub/activity' const inboxRouter = express.Router() @@ -23,10 +30,11 @@ inboxRouter.post('/accounts/:name/inbox', asyncMiddleware(activityPubValidator), inboxController ) -inboxRouter.post('/video-channels/:name/inbox', +inboxRouter.post('/video-channels/:nameWithHost/inbox', signatureValidator, asyncMiddleware(checkSignature), - asyncMiddleware(localVideoChannelValidator), + asyncMiddleware(videoChannelsNameWithHostValidator), + ensureIsLocalChannel, asyncMiddleware(activityPubValidator), inboxController )