aboutsummaryrefslogtreecommitdiffhomepage
path: root/routes
diff options
context:
space:
mode:
Diffstat (limited to 'routes')
-rw-r--r--routes/interaction.php16
-rw-r--r--routes/push.php3
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 :(');