forked from mirror/pixelfed
Merge pull request #989 from pixelfed/frontend-ui-refactor
Frontend ui refactor
This commit is contained in:
commit
b51fcc9922
3 changed files with 169 additions and 138 deletions
|
@ -63,8 +63,6 @@ class StatusActivityPubDeliver implements ShouldQueue
|
|||
|
||||
$profile = $status->profile;
|
||||
|
||||
Cache::forget('status:transformer:media:attachments:'.$status->id);
|
||||
|
||||
$fractal = new Fractal\Manager();
|
||||
$fractal->setSerializer(new ArraySerializer());
|
||||
$resource = new Fractal\Resource\Item($status, new CreateNote());
|
||||
|
@ -94,10 +92,8 @@ class StatusActivityPubDeliver implements ShouldQueue
|
|||
$pool = new Pool($client, $requests($audience), [
|
||||
'concurrency' => config('pixelfed.ap_delivery_concurrency'),
|
||||
'fulfilled' => function ($response, $index) {
|
||||
Log::info('AP:deliver:success - ' . json_encode($response));
|
||||
},
|
||||
'rejected' => function ($reason, $index) {
|
||||
Log::info('AP:deliver:rejected - ' . json_encode($reason));
|
||||
}
|
||||
]);
|
||||
|
||||
|
|
|
@ -17,6 +17,10 @@ use League\Fractal;
|
|||
use League\Fractal\Serializer\ArraySerializer;
|
||||
use App\Transformer\ActivityPub\Verb\DeleteNote;
|
||||
use App\Util\ActivityPub\Helpers;
|
||||
use GuzzleHttp\Pool;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Promise;
|
||||
use App\Util\ActivityPub\HttpSignature;
|
||||
|
||||
class StatusDelete implements ShouldQueue
|
||||
{
|
||||
|
@ -109,9 +113,38 @@ class StatusDelete implements ShouldQueue
|
|||
|
||||
$this->unlinkRemoveMedia($status);
|
||||
|
||||
$payload = json_encode($activity);
|
||||
|
||||
$client = new Client([
|
||||
'timeout' => config('pixelfed.ap_delivery_timeout')
|
||||
]);
|
||||
|
||||
$requests = function($audience) use ($client, $activity, $profile, $payload) {
|
||||
foreach($audience as $url) {
|
||||
Helpers::sendSignedObject($profile, $url, $activity);
|
||||
$headers = HttpSignature::sign($profile, $url, $activity);
|
||||
yield function() use ($client, $url, $headers, $payload) {
|
||||
return $client->postAsync($url, [
|
||||
'curl' => [
|
||||
CURLOPT_HTTPHEADER => $headers,
|
||||
CURLOPT_POSTFIELDS => $payload,
|
||||
CURLOPT_HEADER => true
|
||||
]
|
||||
]);
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
$pool = new Pool($client, $requests($audience), [
|
||||
'concurrency' => config('pixelfed.ap_delivery_concurrency'),
|
||||
'fulfilled' => function ($response, $index) {
|
||||
},
|
||||
'rejected' => function ($reason, $index) {
|
||||
}
|
||||
]);
|
||||
|
||||
$promise = $pool->promise();
|
||||
|
||||
$promise->wait();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ class Helpers {
|
|||
|
||||
public static function validateObject($data)
|
||||
{
|
||||
// todo: undo
|
||||
$verbs = ['Create', 'Announce', 'Like', 'Follow', 'Delete', 'Accept', 'Reject', 'Undo'];
|
||||
|
||||
$valid = Validator::make($data, [
|
||||
|
@ -302,6 +301,9 @@ class Helpers {
|
|||
return Profile::whereUsername($id)->firstOrFail();
|
||||
}
|
||||
$res = self::fetchProfileFromUrl($url);
|
||||
if(isset($res['id']) == false) {
|
||||
return;
|
||||
}
|
||||
$domain = parse_url($res['id'], PHP_URL_HOST);
|
||||
$username = $res['preferredUsername'];
|
||||
$remoteUsername = "@{$username}@{$domain}";
|
||||
|
|
Loading…
Reference in a new issue