forked from mirror/pixelfed
Update AP Inbox
This commit is contained in:
parent
36b88901f3
commit
31fc65fc74
|
@ -69,16 +69,8 @@ class DeleteWorker implements ShouldQueue
|
||||||
))
|
))
|
||||||
) {
|
) {
|
||||||
$actor = $payload['actor'];
|
$actor = $payload['actor'];
|
||||||
$hash = strlen($actor) <= 48 ?
|
if($this->verifySignature($headers, $payload) == true) {
|
||||||
'b:' . base64_encode($actor) :
|
$actorDelete = Profile::whereRemoteUrl($actor)->exists();
|
||||||
'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($actorDelete) {
|
if($actorDelete) {
|
||||||
if($this->verifySignature($headers, $payload) == true) {
|
if($this->verifySignature($headers, $payload) == true) {
|
||||||
Cache::set($key, false);
|
Cache::set($key, false);
|
||||||
|
@ -99,19 +91,23 @@ class DeleteWorker implements ShouldQueue
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
$profile = null;
|
$profile = null;
|
||||||
|
|
||||||
if($this->verifySignature($headers, $payload) == true) {
|
if($this->verifySignature($headers, $payload) == true) {
|
||||||
ActivityHandler::dispatch($headers, $profile, $payload)->onQueue('inbox');
|
ActivityHandler::dispatch($headers, $profile, $payload)->onQueue('delete');
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
protected function verifySignature($headers, $payload)
|
protected function verifySignature($headers, $payload)
|
||||||
{
|
{
|
||||||
$body = $this->payload;
|
$body = $this->payload;
|
||||||
|
|
Loading…
Reference in New Issue