media($allowedContentTypes) === '') { throw PageNotFoundException::forPageNotFound(); } } if (in_array('verify-blocks', $params)) { $payload = $request->getJSON(); $actorUri = $payload->actor; $domain = (new URI($actorUri))->getHost(); // check first if domain is blocked if (model('BlockedDomainModel')->isDomainBlocked($domain)) { throw PageNotFoundException::forPageNotFound(); } // check if actor is blocked if (model('ActorModel')->isActorBlocked($actorUri)) { throw PageNotFoundException::forPageNotFound(); } } if (in_array('verify-signature', $params)) { try { // securityCheck: check activity signature before handling it (new HttpSignature())->verify(); } catch (Exception) { // Invalid HttpSignature (401 = unauthorized) // TODO: show error message? return service('response')->setStatusCode(401); } } } //-------------------------------------------------------------------- /** * Allows After filters to inspect and modify the response * object as needed. This method does not allow any way * to stop execution of other after filters, short of * throwing an Exception or Error. * * @param string[]|null $arguments */ public function after( RequestInterface $request, ResponseInterface $response, $arguments = null ): void { } //-------------------------------------------------------------------- }