diff --git a/app/Util/ActivityPub/Helpers.php b/app/Util/ActivityPub/Helpers.php index a70d828de..e6d85baec 100644 --- a/app/Util/ActivityPub/Helpers.php +++ b/app/Util/ActivityPub/Helpers.php @@ -406,7 +406,6 @@ class Helpers { $remoteUsername = "@{$username}@{$domain}"; abort_if(!self::validateUrl($res['inbox']), 400); - abort_if(!self::validateUrl($res['outbox']), 400); abort_if(!self::validateUrl($res['id']), 400); $profile = Profile::whereRemoteUrl($res['id'])->first(); @@ -451,4 +450,20 @@ class Helpers { $response = curl_exec($ch); return; } + + public static function apSignedPostRequest($senderProfile, $url, $body) + { + abort_if(!self::validateUrl($url), 400); + + $payload = json_encode($body); + $headers = HttpSignature::sign($senderProfile, $url, $body); + + $ch = curl_init($url); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); + curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); + curl_setopt($ch, CURLOPT_HEADER, true); + $response = curl_exec($ch); + return; + } }