mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-23 00:05:29 +00:00
Update AP Helpers
This commit is contained in:
parent
01dd5db7f5
commit
b08b36127c
1 changed files with 16 additions and 1 deletions
|
@ -406,7 +406,6 @@ class Helpers {
|
||||||
$remoteUsername = "@{$username}@{$domain}";
|
$remoteUsername = "@{$username}@{$domain}";
|
||||||
|
|
||||||
abort_if(!self::validateUrl($res['inbox']), 400);
|
abort_if(!self::validateUrl($res['inbox']), 400);
|
||||||
abort_if(!self::validateUrl($res['outbox']), 400);
|
|
||||||
abort_if(!self::validateUrl($res['id']), 400);
|
abort_if(!self::validateUrl($res['id']), 400);
|
||||||
|
|
||||||
$profile = Profile::whereRemoteUrl($res['id'])->first();
|
$profile = Profile::whereRemoteUrl($res['id'])->first();
|
||||||
|
@ -451,4 +450,20 @@ class Helpers {
|
||||||
$response = curl_exec($ch);
|
$response = curl_exec($ch);
|
||||||
return;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue