From 350e31d6b64e4973dfa5e9f7b46841cb09aeb1ad Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 14 Nov 2017 17:31:26 +0100 Subject: Follow works --- server/controllers/activitypub/client.ts | 4 ++-- server/controllers/activitypub/inbox.ts | 4 +++- server/controllers/activitypub/index.ts | 10 +++++----- 3 files changed, 10 insertions(+), 8 deletions(-) (limited to 'server/controllers/activitypub') diff --git a/server/controllers/activitypub/client.ts b/server/controllers/activitypub/client.ts index 461a619dd..56a4054fa 100644 --- a/server/controllers/activitypub/client.ts +++ b/server/controllers/activitypub/client.ts @@ -16,12 +16,12 @@ activityPubClientRouter.get('/account/:name', executeIfActivityPub(asyncMiddleware(accountController)) ) -activityPubClientRouter.get('/account/:nameWithHost/followers', +activityPubClientRouter.get('/account/:name/followers', executeIfActivityPub(localAccountValidator), executeIfActivityPub(asyncMiddleware(accountFollowersController)) ) -activityPubClientRouter.get('/account/:nameWithHost/following', +activityPubClientRouter.get('/account/:name/following', executeIfActivityPub(localAccountValidator), executeIfActivityPub(asyncMiddleware(accountFollowingController)) ) diff --git a/server/controllers/activitypub/inbox.ts b/server/controllers/activitypub/inbox.ts index eedb518b9..e62125d85 100644 --- a/server/controllers/activitypub/inbox.ts +++ b/server/controllers/activitypub/inbox.ts @@ -30,7 +30,7 @@ inboxRouter.post('/inbox', asyncMiddleware(inboxController) ) -inboxRouter.post('/:nameWithHost/inbox', +inboxRouter.post('/account/:name/inbox', signatureValidator, asyncMiddleware(checkSignature), localAccountValidator, @@ -59,7 +59,9 @@ async function inboxController (req: express.Request, res: express.Response, nex } // Only keep activities we are able to process + logger.debug('Filtering activities...', { activities }) activities = activities.filter(a => isActivityValid(a)) + logger.debug('We keep %d activities.', activities.length, { activities }) await processActivities(activities, res.locals.account) diff --git a/server/controllers/activitypub/index.ts b/server/controllers/activitypub/index.ts index 6c7bafc6e..0c8574ef7 100644 --- a/server/controllers/activitypub/index.ts +++ b/server/controllers/activitypub/index.ts @@ -4,14 +4,14 @@ import { badRequest } from '../../helpers' import { inboxRouter } from './inbox' import { activityPubClientRouter } from './client' -const remoteRouter = express.Router() +const activityPubRouter = express.Router() -remoteRouter.use('/', inboxRouter) -remoteRouter.use('/', activityPubClientRouter) -remoteRouter.use('/*', badRequest) +activityPubRouter.use('/', inboxRouter) +activityPubRouter.use('/', activityPubClientRouter) +activityPubRouter.use('/*', badRequest) // --------------------------------------------------------------------------- export { - remoteRouter + activityPubRouter } -- cgit v1.2.3