From b00185ddbac9ac3de975a3954f2ede2f24458f6a Mon Sep 17 00:00:00 2001 From: winter Date: Sun, 8 Dec 2024 18:04:37 +0000 Subject: implement notes --- routes/note.php | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'routes/note.php') diff --git a/routes/note.php b/routes/note.php index 9c5e507..e43c2a1 100644 --- a/routes/note.php +++ b/routes/note.php @@ -1,20 +1,18 @@ mount('/post/:id', function (array $args) { - json_response([ - 'type' => 'note', - 'self' => path_to_uri('/post/' . $args['id']), - 'created' => '2024-12-06T20:14:00+00:00', - 'author' => path_to_uri('/user/winter'), - 'plainContent' => 'meow :3', - 'language' => 'eng', - 'inReplyTo' => null, - 'threadApex' => path_to_uri('/post/' . $args['id']), - 'privacy' => [ - 'scope' => 'public', - 'indexable' => true - ] - ]); + $note = Note::find($args['id']); + if ($note == null) { + throw new NotFound("i don't know that note"); + } + if (!$note->author->isLocal) { + throw new NotFound("i don't want to tell you about non local posts sorry"); + } + json_response($note); }); -- cgit v1.3