diff options
| author | winter | 2024-12-17 23:05:43 +0000 |
|---|---|---|
| committer | winter | 2024-12-17 23:05:43 +0000 |
| commit | 6f844ff40d936fb6591c2469dd9ff922bc4e575f (patch) | |
| tree | 007dc0372c2c999bdcf6ea1ba80f6eb93a161a7f /routes | |
| parent | 801778a295df2b026391483faa390cf87e68b1ad (diff) | |
implement interactions
Diffstat (limited to 'routes')
| -rw-r--r-- | routes/interaction.php | 16 | ||||
| -rw-r--r-- | routes/push.php | 3 |
2 files changed, 19 insertions, 0 deletions
diff --git a/routes/interaction.php b/routes/interaction.php new file mode 100644 index 0000000..c50dec2 --- /dev/null +++ b/routes/interaction.php @@ -0,0 +1,16 @@ +<?php + +use Digitigrade\HttpResponseStatus\NotFound; +use Digitigrade\Model\Interaction; +use Digitigrade\Router; + +Router::getInstance()->mount('/interaction/:id', function (array $args) { + $interaction = Interaction::find($args['id']); + if ($interaction == null) { + throw new NotFound("i don't know that interaction"); + } + if (!$interaction->author->isLocal) { + throw new NotFound("i don't want to tell you about non-local interactions!"); + } + json_response($interaction); +});
\ No newline at end of file diff --git a/routes/push.php b/routes/push.php index 6712fb4..6fc8229 100644 --- a/routes/push.php +++ b/routes/push.php @@ -5,6 +5,7 @@ use Digitigrade\HttpResponseStatus\Forbidden; use Digitigrade\HttpResponseStatus\Unauthorized; use Digitigrade\Model\Actor; use Digitigrade\Model\Instance; +use Digitigrade\Model\Interaction; use Digitigrade\Model\Note; use Digitigrade\Router; @@ -41,6 +42,8 @@ Router::getInstance()->mount('/push', function (array $args) { Note::importFromReceivedObject($obj); break; case 'interaction': + Interaction::importFromReceivedObject($obj); + break; case 'extension': case 'tombstone': throw new \RuntimeException('object type not yet implemented :('); |
