From 70185d75fe665695485b783972484bbe097f30f3 Mon Sep 17 00:00:00 2001 From: winter Date: Fri, 20 Dec 2024 13:38:14 +0000 Subject: accepting/rejecting follow requests --- routes/actor.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'routes/actor.php') diff --git a/routes/actor.php b/routes/actor.php index 98e8f4e..65a3837 100644 --- a/routes/actor.php +++ b/routes/actor.php @@ -68,4 +68,28 @@ Router::getInstance()->mount('/user/:handle/unfollow', function (array $args) { throw new Unauthorized('please authenticate yourself on behalf of the initiating actor'); } $initiator->unfollow($target); +}); + +Router::getInstance()->mount('/user/:handle/acceptedFollow', function (array $args) { + $initiator = Actor::findLocalByHandle($args['handle']); + if ($initiator == null) { + throw new NotFound(); + } + $target = Actor::findByRequestHeaders(); + if ($target == null) { + throw new Unauthorized('please authenticate yourself on behalf of the followed actor'); + } + $target->acceptPendingFollowFrom($initiator); +}); + +Router::getInstance()->mount('/user/:handle/rejectedFollow', function (array $args) { + $initiator = Actor::findLocalByHandle($args['handle']); + if ($initiator == null) { + throw new NotFound(); + } + $target = Actor::findByRequestHeaders(); + if ($target == null) { + throw new Unauthorized('please authenticate yourself on behalf of the followed actor'); + } + $target->rejectPendingFollowFrom($initiator); }); \ No newline at end of file -- cgit v1.3