diff options
| author | winter | 2024-12-20 13:38:14 +0000 |
|---|---|---|
| committer | winter | 2024-12-20 13:38:14 +0000 |
| commit | 70185d75fe665695485b783972484bbe097f30f3 (patch) | |
| tree | 5842943ef74648242f52dc4f3959d76ff24f224c /routes | |
| parent | df051a7524a93f96bfc69924c202a51286517ce2 (diff) | |
accepting/rejecting follow requests
Diffstat (limited to 'routes')
| -rw-r--r-- | routes/actor.php | 24 |
1 files changed, 24 insertions, 0 deletions
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 |
