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:----h8Tk6KcZrZSNIyfQUYYkbwyV8x2/du3phPI02BEkgxm0BQh+yLae01nLaMXk6mIzx4qNvk0rbP8IDNSttPI0Uy89NhPgLMgJ/v8zo9jG69/HRJYloDF24NiHCR+lk6wKmIEVOTu1tf8oG+Z0vjurtMg2uXMx3QF8uWLB7vSlzYRoRRXWpjCMnPCaSBRkpqoWzPSRY44ZSo/FoCShW4ni6kZDfonvf/LRGndTQlid001+hpoAlcBVNjy/AKckciR3DxN8QWCEyLT/FwtiA6c8vVzKaGoqb1aHRs0cfjgywA9iNuqkXgmh1cDv6LDCKLQ0yVOgsMAIlczvg2W1ldt8yKH6Ex11VeLgnZux6mrp0vV0814nscs5rDvKg//HkyRW4ZW5h/GCC+9ToEDG/ebaMgnV/UJW3Xw/woR3g9RHUCtJzg7XTORkGmWCwa5KmupE5htyERp2h3GTLBJeAXAt0WiXfFEB9ifbH3UBcf+GDugjaOsXumALWjQzImTPshIlD2O/RQasNh/EvCCsErzY7kFXS71dPPH50RlGZxX22TPBTRzjxz8pomsAsvPcKNo9dmafI5aQkBSGX0J1rLgA6n2DQWa5pFVK+L6zG0L3wakKyycgffJkoIrW1saah0fYYyxM0jYR+gQheb04Smp7U6p0w9iV4MWhzLnyI1TDQpw=----ATTACHMENT:----ODE5ODc2MDQ4NjkyNzYyOCA3MDI1OTE0NDQ0NTI5MzM3IDI4MDY0NDYwODQxMzM3Nzc=