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:
parent
36b88901f3
commit
31fc65fc74
1 changed files with 50 additions and 54 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue