1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-23 08:14:10 +00:00

Update AP Inbox

This commit is contained in:
Daniel Supernault 2022-12-24 05:35:35 -07:00
parent 36b88901f3
commit 31fc65fc74
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -69,16 +69,8 @@ class DeleteWorker implements ShouldQueue
))
) {
$actor = $payload['actor'];
$hash = strlen($actor) <= 48 ?
'b:' . base64_encode($actor) :
'h:' . hash('sha256', $actor);
$key = 'ap:inbox:actor-delete-exists:' . $hash;
$actorDelete = Cache::remember($key, now()->addMinutes(15), function() use($actor) {
return Profile::whereRemoteUrl($actor)
->whereNotNull('domain')
->exists();
});
if($this->verifySignature($headers, $payload) == true) {
$actorDelete = Profile::whereRemoteUrl($actor)->exists();
if($actorDelete) {
if($this->verifySignature($headers, $payload) == true) {
Cache::set($key, false);
@ -99,19 +91,23 @@ class DeleteWorker implements ShouldQueue
return 1;
}
return 1;
} else {
return 1;
}
} else {
$profile = null;
if($this->verifySignature($headers, $payload) == true) {
ActivityHandler::dispatch($headers, $profile, $payload)->onQueue('inbox');
ActivityHandler::dispatch($headers, $profile, $payload)->onQueue('delete');
return 1;
} else {
return 1;
}
}
}
protected function verifySignature($headers, $payload)
{
$body = $this->payload;