[COMPONENT][FreeNetwork] Start using queues
[COMPONENT][Notification] Start using queues [PLUGIN][ActivityPub] Start using queues
This commit is contained in:
@@ -34,17 +34,14 @@ namespace Plugin\ActivityPub\Controller;
|
||||
|
||||
use App\Core\Controller;
|
||||
use App\Core\DB\DB;
|
||||
use App\Core\Event;
|
||||
use function App\Core\I18n\_m;
|
||||
use App\Core\Log;
|
||||
use App\Core\Queue\Queue;
|
||||
use App\Core\Router\Router;
|
||||
use App\Entity\Actor;
|
||||
use App\Util\Common;
|
||||
use App\Util\Exception\ClientException;
|
||||
use Component\FreeNetwork\Entity\FreeNetworkActorProtocol;
|
||||
use Component\FreeNetwork\Util\Discovery;
|
||||
use Exception;
|
||||
use const PHP_URL_HOST;
|
||||
use Plugin\ActivityPub\Entity\ActivitypubActor;
|
||||
use Plugin\ActivityPub\Entity\ActivitypubRsa;
|
||||
use Plugin\ActivityPub\Util\Explorer;
|
||||
@@ -150,7 +147,7 @@ class Inbox extends Controller
|
||||
try {
|
||||
ActivitypubActor::update_profile($ap_actor, $actor, $activitypub_rsa, $res);
|
||||
} catch (Exception $e) {
|
||||
return $error('Failed to updated remote actor information.', $e);
|
||||
return $error('Failed to update remote actor information.', $e);
|
||||
}
|
||||
|
||||
[$verified, /*$headers*/] = HTTPSignature::verify($actor_public_key, $signatureData, $headers, $path, $body);
|
||||
@@ -165,26 +162,11 @@ class Inbox extends Controller
|
||||
// HTTP signature checked out, make sure the "actor" of the activity matches that of the signature
|
||||
Log::debug('ActivityPub Inbox: HTTP Signature: Authorised request. Will now start the inbox handler.');
|
||||
|
||||
// TODO: Check if Actor has authority over payload
|
||||
|
||||
// Store Activity
|
||||
$ap_act = Model\Activity::fromJson($type, ['source' => 'ActivityPub']);
|
||||
FreeNetworkActorProtocol::protocolSucceeded(
|
||||
'activitypub',
|
||||
$ap_actor->getActorId(),
|
||||
Discovery::normalize($actor->getNickname() . '@' . parse_url($ap_actor->getInboxUri(), PHP_URL_HOST)),
|
||||
Queue::enqueue(
|
||||
payload: [$ap_actor, $actor, $type],
|
||||
queue: 'activitypub_inbox',
|
||||
priority: false,
|
||||
);
|
||||
$already_known_ids = [];
|
||||
if (!empty($ap_act->_object_mention_ids)) {
|
||||
$already_known_ids = $ap_act->_object_mention_ids;
|
||||
}
|
||||
|
||||
DB::flush();
|
||||
if (Event::handle('ActivityPubNewNotification', [$actor, $ap_act->getActivity(), $already_known_ids, _m('{nickname} attentioned you.', ['{nickname}' => $actor->getNickname()])]) === Event::next) {
|
||||
Event::handle('NewNotification', [$actor, $ap_act->getActivity(), $already_known_ids, _m('{nickname} attentioned you.', ['{nickname}' => $actor->getNickname()])]);
|
||||
}
|
||||
|
||||
dd($ap_act, $act = $ap_act->getActivity(), $act->getActor(), $act->getObject());
|
||||
|
||||
return new TypeResponse($type, status: 202);
|
||||
}
|
||||
|
Reference in New Issue
Block a user