mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 22:41:27 +00:00
Update activitypub deliver
This commit is contained in:
parent
691cc991c6
commit
feeb60eb94
2 changed files with 133 additions and 135 deletions
|
@ -63,8 +63,6 @@ class StatusActivityPubDeliver implements ShouldQueue
|
||||||
|
|
||||||
$profile = $status->profile;
|
$profile = $status->profile;
|
||||||
|
|
||||||
Cache::forget('status:transformer:media:attachments:'.$status->id);
|
|
||||||
|
|
||||||
$fractal = new Fractal\Manager();
|
$fractal = new Fractal\Manager();
|
||||||
$fractal->setSerializer(new ArraySerializer());
|
$fractal->setSerializer(new ArraySerializer());
|
||||||
$resource = new Fractal\Resource\Item($status, new CreateNote());
|
$resource = new Fractal\Resource\Item($status, new CreateNote());
|
||||||
|
@ -94,10 +92,8 @@ class StatusActivityPubDeliver implements ShouldQueue
|
||||||
$pool = new Pool($client, $requests($audience), [
|
$pool = new Pool($client, $requests($audience), [
|
||||||
'concurrency' => config('pixelfed.ap_delivery_concurrency'),
|
'concurrency' => config('pixelfed.ap_delivery_concurrency'),
|
||||||
'fulfilled' => function ($response, $index) {
|
'fulfilled' => function ($response, $index) {
|
||||||
Log::info('AP:deliver:success - ' . json_encode($response));
|
|
||||||
},
|
},
|
||||||
'rejected' => function ($reason, $index) {
|
'rejected' => function ($reason, $index) {
|
||||||
Log::info('AP:deliver:rejected - ' . json_encode($reason));
|
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,6 @@ class Helpers {
|
||||||
|
|
||||||
public static function validateObject($data)
|
public static function validateObject($data)
|
||||||
{
|
{
|
||||||
// todo: undo
|
|
||||||
$verbs = ['Create', 'Announce', 'Like', 'Follow', 'Delete', 'Accept', 'Reject', 'Undo'];
|
$verbs = ['Create', 'Announce', 'Like', 'Follow', 'Delete', 'Accept', 'Reject', 'Undo'];
|
||||||
|
|
||||||
$valid = Validator::make($data, [
|
$valid = Validator::make($data, [
|
||||||
|
@ -302,6 +301,9 @@ class Helpers {
|
||||||
return Profile::whereUsername($id)->firstOrFail();
|
return Profile::whereUsername($id)->firstOrFail();
|
||||||
}
|
}
|
||||||
$res = self::fetchProfileFromUrl($url);
|
$res = self::fetchProfileFromUrl($url);
|
||||||
|
if(isset($res['id']) == false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
$domain = parse_url($res['id'], PHP_URL_HOST);
|
$domain = parse_url($res['id'], PHP_URL_HOST);
|
||||||
$username = $res['preferredUsername'];
|
$username = $res['preferredUsername'];
|
||||||
$remoteUsername = "@{$username}@{$domain}";
|
$remoteUsername = "@{$username}@{$domain}";
|
||||||
|
|
Loading…
Reference in a new issue