From bf6c0346d8d35a719dd1bff1cb4d573d422f99ff Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Wed, 31 May 2017 09:31:18 +0200 Subject: WIP Signed-off-by: Thomas Citharel --- .../Controller/InboxController.php | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/Wallabag/FederationBundle/Controller/InboxController.php (limited to 'src/Wallabag/FederationBundle/Controller/InboxController.php') diff --git a/src/Wallabag/FederationBundle/Controller/InboxController.php b/src/Wallabag/FederationBundle/Controller/InboxController.php new file mode 100644 index 00000000..99cfeadf --- /dev/null +++ b/src/Wallabag/FederationBundle/Controller/InboxController.php @@ -0,0 +1,43 @@ +getDoctrine()->getManager(); + $response = new Response(); + + if ($activity = json_decode($request->getContent())) { + if ($activity->type === 'Follow' && isset($activity->actor->id)) { + $cloudId = new CloudId($activity->actor->id); + $account = new Account(); + $account->setServer($cloudId->getRemote()) + ->setUsername($cloudId->getUser()); + $em->persist($account); + $em->flush(); + + $response->setStatusCode(201); + } else { + $response->setStatusCode(400); + } + } + return $response; + } +} -- cgit v1.2.3