mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-18 19:13:17 +00:00
Update AP Inbox
This commit is contained in:
parent
909a6c725b
commit
3e88b7c890
1 changed files with 37 additions and 0 deletions
|
@ -3,6 +3,7 @@
|
||||||
namespace App\Util\ActivityPub;
|
namespace App\Util\ActivityPub;
|
||||||
|
|
||||||
use Cache, DB, Log, Purify, Redis, Storage, Validator;
|
use Cache, DB, Log, Purify, Redis, Storage, Validator;
|
||||||
|
use Illuminate\Support\Facades\Bus;
|
||||||
use App\{
|
use App\{
|
||||||
Activity,
|
Activity,
|
||||||
DirectMessage,
|
DirectMessage,
|
||||||
|
@ -30,6 +31,10 @@ use App\Jobs\StoryPipeline\StoryExpire;
|
||||||
use App\Jobs\StoryPipeline\StoryFetch;
|
use App\Jobs\StoryPipeline\StoryFetch;
|
||||||
use App\Jobs\StatusPipeline\StatusRemoteUpdatePipeline;
|
use App\Jobs\StatusPipeline\StatusRemoteUpdatePipeline;
|
||||||
use App\Jobs\ProfilePipeline\HandleUpdateActivity;
|
use App\Jobs\ProfilePipeline\HandleUpdateActivity;
|
||||||
|
use App\Jobs\MovePipeline\ProcessMovePipeline;
|
||||||
|
use App\Jobs\MovePipeline\MoveMigrateFollowersPipeline;
|
||||||
|
use App\Jobs\MovePipeline\UnfollowLegacyAccountMovePipeline;
|
||||||
|
use App\Jobs\MovePipeline\CleanupLegacyAccountMovePipeline;
|
||||||
|
|
||||||
use App\Util\ActivityPub\Validator\Accept as AcceptValidator;
|
use App\Util\ActivityPub\Validator\Accept as AcceptValidator;
|
||||||
use App\Util\ActivityPub\Validator\Add as AddValidator;
|
use App\Util\ActivityPub\Validator\Add as AddValidator;
|
||||||
|
@ -38,6 +43,7 @@ use App\Util\ActivityPub\Validator\Follow as FollowValidator;
|
||||||
use App\Util\ActivityPub\Validator\Like as LikeValidator;
|
use App\Util\ActivityPub\Validator\Like as LikeValidator;
|
||||||
use App\Util\ActivityPub\Validator\UndoFollow as UndoFollowValidator;
|
use App\Util\ActivityPub\Validator\UndoFollow as UndoFollowValidator;
|
||||||
use App\Util\ActivityPub\Validator\UpdatePersonValidator;
|
use App\Util\ActivityPub\Validator\UpdatePersonValidator;
|
||||||
|
use App\Util\ActivityPub\Validator\MoveValidator;
|
||||||
|
|
||||||
use App\Services\AccountService;
|
use App\Services\AccountService;
|
||||||
use App\Services\PollService;
|
use App\Services\PollService;
|
||||||
|
@ -135,6 +141,14 @@ class Inbox
|
||||||
$this->handleUpdateActivity();
|
$this->handleUpdateActivity();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'Move':
|
||||||
|
if(MoveValidator::validate($this->payload) == false) {
|
||||||
|
\Log::info('[AP][INBOX][MOVE] VALIDATE_FAILURE ' . json_encode($this->payload));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$this->handleMoveActivity();
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// TODO: decide how to handle invalid verbs.
|
// TODO: decide how to handle invalid verbs.
|
||||||
break;
|
break;
|
||||||
|
@ -1347,4 +1361,27 @@ class Inbox
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function handleMoveActivity()
|
||||||
|
{
|
||||||
|
$actor = $this->payload['actor'];
|
||||||
|
$activity = $this->payload['object'];
|
||||||
|
$target = $this->payload['target'];
|
||||||
|
if(
|
||||||
|
!Helpers::validateUrl($actor) ||
|
||||||
|
!Helpers::validateUrl($activity) ||
|
||||||
|
!Helpers::validateUrl($target)
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Bus::chain([
|
||||||
|
new ProcessMoveActivity,
|
||||||
|
new MoveMigrateFollowersPipeline,
|
||||||
|
new UnfollowLegacyAccountMovePipeline,
|
||||||
|
new CleanupLegacyAccountMovePipeline
|
||||||
|
])
|
||||||
|
->onQueue('move')
|
||||||
|
->dispatch($target, $activity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue