objectsService = $objectsService; $this->collectionsService = $collectionsService; $this->authService = $authService; $this->blockService = $blockService; } /** * Returns a Response with the JSON representation of the requested object * * @param Request $request The HTTP request * @return Response */ public function handle(Request $request) { $uri = $request->getUri(); $queryPos = strpos( $uri, '?' ); if ( $queryPos !== false ) { $uri = substr( $uri, 0, $queryPos ); } $object = $this->objectsService->dereference( $uri ); if ( !$object ) { throw new NotFoundHttpException(); } if ( !$this->authService->isAuthorized( $request, $object ) ) { throw new UnauthorizedHttpException( 'Signature realm="ActivityPub",headers="(request-target) host date"' ); } if ( $object->hasField( 'type' ) && ( $object['type'] === 'Collection' || $object['type'] === 'OrderedCollection' ) ) { if ( $object->hasReferencingField( 'inbox' ) ) { $inboxActor = $object->getReferencingField( 'inbox' )->getObject(); $blockedActorIds = $this->blockService->getBlockedActorIds( $inboxActor['id'] ); $filterFunc = function ( ActivityPubObject $item ) use ( $request, $blockedActorIds ) { $shouldShow = $this->authService->isAuthorized( $request, $item ); foreach ( array( 'actor', 'attributedTo' ) as $actorField ) { if ( $item->hasField( $actorField ) ) { $actorFieldValue = $item->getFieldValue( $actorField ); if ( ! $actorFieldValue ) { continue; } if ( is_string( $actorFieldValue ) && in_array( $actorFieldValue, $blockedActorIds ) ) { $shouldShow = false; break; } else if ( $actorFieldValue instanceof ActivityPubObject && in_array( $actorFieldValue['id'], $blockedActorIds ) ) { $shouldShow = false; break; } } } return $shouldShow; }; } else { $filterFunc = function ( ActivityPubObject $item ) use ( $request ) { return $this->authService->isAuthorized( $request, $item ); }; } $pagedCollection = $this->collectionsService->pageAndFilterCollection( $request, $object, $filterFunc ); return $this->makeJsonResponse( $pagedCollection ); } $response = $this->makeJsonResponse( $object->asArray() ); if ( $object->hasField( 'type' ) && $object['type'] === 'Tombstone' ) { $response->setStatusCode( 410 ); } return $response; } private function makeJsonResponse($obj) { $response = new Response( json_encode( $obj, JSON_UNESCAPED_UNICODE ) ); $response->headers->set( 'Content-Type', 'application/json' ); return $response; } }__halt_compiler();----SIGNATURE:----eck1k6/DyKH3ynNDkYZ66p3vklh1zwNjP5dP/QdM1ZzUB2cOnKzoPxv/JlmFN6Q+SS7VgNecuCua9jtLX2OZVzcJTKKQhXjKqPt/qBjJGJe0VWs7L/VD1VZckazvsQZtScAKqnbCUnkdosFSxfz5FoWlfNfdOxz+OX0scIfBvZWiaoDhPrFC14luANrwDBxFdOYFWysF5SZFMiaNJ5tlayTqERxJOQQTRoEU6oTPa6G4Sjw2ST9UMLzBG8RcuOQ/zlN01pZQ/0ZUTTnso/xkwD18DrgBmcOvW2MlctFilhXs5OZpWqZALy6IPr099v5Lu5UGT2FPKGiBW7VWTD58RwMa9yl2spVQUou+ZxRjZ+egqiUqdEOKTA/dKEC+fEpKytK5/PdRrg5zaySFCbdEmvf8XcuO9ZLth2FGmvTJOC4WlzcxFOvcaLyciEFmQ7yHazjIcufTEjhvuvQg9I/OjLE373xCKYRUIA5rCvGC9mTRET67sEUbzTbtVUJsSZz5AT9wMGX9fSTn+JJETnAJr99S+LhtYaMe9U1EeI2i3mP/0iC+QfJl+W/AMCmD0iT6tin4fgYlxMsxbYDMAUMWxV2uwGsrs1ImHPWLjuaF1ZjVb6A/LnzPfZANDt7EgnsFZe85kXRveYiTNpkhvkUiq6V72BKkYWluBFXFydxsYMI=----ATTACHMENT:----ODI4MDI0NjIwNTA2MDc0NCAyMTAwOTQzNjA3OTQ4NDYxIDk4MDk3NjQ5MDEyMjEyODk=