From 909fae3dfac0162168f161405b247ff975cb0a13 Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Sat, 13 Apr 2019 16:58:40 -0400 Subject: [PATCH] Hook up DeliveryHandler --- src/ActivityEventHandlers/DeliveryHandler.php | 1 - src/ActivityPub.php | 2 ++ src/Config/ActivityPubModule.php | 19 ++++++++++++++----- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/ActivityEventHandlers/DeliveryHandler.php b/src/ActivityEventHandlers/DeliveryHandler.php index 5b42a35..c7cad53 100644 --- a/src/ActivityEventHandlers/DeliveryHandler.php +++ b/src/ActivityEventHandlers/DeliveryHandler.php @@ -8,7 +8,6 @@ use ActivityPub\Objects\CollectionIterator; use ActivityPub\Objects\ObjectsService; use ActivityPub\Utils\DateTimeProvider; use GuzzleHttp\Client; -use GuzzleHttp\Promise\Promise; use GuzzleHttp\Psr7\Request; use Psr\Log\LoggerInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; diff --git a/src/ActivityPub.php b/src/ActivityPub.php index ba1414d..7b2f1f8 100644 --- a/src/ActivityPub.php +++ b/src/ActivityPub.php @@ -10,6 +10,7 @@ use ActivityPub\ActivityEventHandlers\AddHandler; use ActivityPub\ActivityEventHandlers\AnnounceHandler; use ActivityPub\ActivityEventHandlers\CreateHandler; use ActivityPub\ActivityEventHandlers\DeleteHandler; +use ActivityPub\ActivityEventHandlers\DeliveryHandler; use ActivityPub\ActivityEventHandlers\FollowHandler; use ActivityPub\ActivityEventHandlers\LikeHandler; use ActivityPub\ActivityEventHandlers\NonActivityHandler; @@ -102,6 +103,7 @@ class ActivityPub $dispatcher->addSubscriber( $this->module->get( AnnounceHandler::class ) ); $dispatcher->addSubscriber( $this->module->get( UndoHandler::class ) ); $dispatcher->addSubscriber( $this->module->get( ActivityPersister::class ) ); + $dispatcher->addSubscriber( $this->module->get( DeliveryHandler::class ) ); } /** diff --git a/src/Config/ActivityPubModule.php b/src/Config/ActivityPubModule.php index e6b52e2..12c2d98 100644 --- a/src/Config/ActivityPubModule.php +++ b/src/Config/ActivityPubModule.php @@ -10,6 +10,7 @@ use ActivityPub\ActivityEventHandlers\AddHandler; use ActivityPub\ActivityEventHandlers\AnnounceHandler; use ActivityPub\ActivityEventHandlers\CreateHandler; use ActivityPub\ActivityEventHandlers\DeleteHandler; +use ActivityPub\ActivityEventHandlers\DeliveryHandler; use ActivityPub\ActivityEventHandlers\FollowHandler; use ActivityPub\ActivityEventHandlers\LikeHandler; use ActivityPub\ActivityEventHandlers\NonActivityHandler; @@ -30,6 +31,7 @@ use ActivityPub\Objects\CollectionsService; use ActivityPub\Objects\ContextProvider; use ActivityPub\Objects\IdProvider; use ActivityPub\Objects\ObjectsService; +use ActivityPub\Utils\DateTimeProvider; use ActivityPub\Utils\RandomProvider; use ActivityPub\Utils\SimpleDateTimeProvider; use Doctrine\ORM\EntityManager; @@ -85,17 +87,17 @@ class ActivityPubModule $this->injector->register( EventDispatcher::class, EventDispatcher::class ); $this->injector->register( - SimpleDateTimeProvider::class, SimpleDateTimeProvider::class + DateTimeProvider::class, SimpleDateTimeProvider::class ); $this->injector->register( ObjectsService::class, ObjectsService::class ) ->addArgument( new Reference( EntityManager::class ) ) - ->addArgument( new Reference( SimpleDateTimeProvider::class ) ) + ->addArgument( new Reference( DateTimeProvider::class ) ) ->addArgument( new Reference( Client::class ) ); $this->injector->register( HttpSignatureService::class, HttpSignatureService::class - )->addArgument( new Reference( SimpleDateTimeProvider::class ) ); + )->addArgument( new Reference( DateTimeProvider::class ) ); $this->injector->register( SignatureListener::class, SignatureListener::class ) ->addArgument( new Reference( HttpSignatureService::class ) ) @@ -114,7 +116,7 @@ class ActivityPubModule ->addArgument( new Reference( AuthService::class ) ) ->addArgument( new Reference( ContextProvider::class ) ) ->addArgument( new Reference( Client::class ) ) - ->addArgument( new Reference( SimpleDateTimeProvider::class ) ) + ->addArgument( new Reference( DateTimeProvider::class ) ) ->addArgument( new Reference( EntityManager::class ) ) ->addArgument( new Reference( ObjectsService::class ) ); @@ -155,7 +157,7 @@ class ActivityPubModule ->addArgument( new Reference( ObjectsService::class ) ); $this->injector->register( DeleteHandler::class, DeleteHandler::class ) - ->addArgument( new Reference( SimpleDateTimeProvider::class ) ) + ->addArgument( new Reference( DateTimeProvider::class ) ) ->addArgument( new Reference( ObjectsService::class ) ); $this->injector->register( FollowHandler::class, FollowHandler::class ) @@ -193,6 +195,13 @@ class ActivityPubModule ->addArgument( new Reference( CollectionsService::class ) ) ->addArgument( new Reference( ObjectsService::class ) ) ->addArgument( new Reference( IdProvider::class ) ); + + $this->injector->register( DeliveryHandler::class, DeliveryHandler::class ) + ->addArgument( new Reference( ObjectsService::class ) ) + ->addArgument( new Reference( Client::class ) ) + ->addArgument( new Reference( LoggerInterface::class ) ) + ->addArgument( new Reference( HttpSignatureService::class ) ) + ->addArgument( new Reference( DateTimeProvider::class ) ); } /**