diff options
-rw-r--r-- | appinfo/routes.php | 2 | ||||
-rw-r--r-- | lib/Controller/LocalController.php | 20 |
2 files changed, 22 insertions, 0 deletions
diff --git a/appinfo/routes.php b/appinfo/routes.php index 32306f89..310ac3b7 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -70,6 +70,8 @@ return [ ['name' => 'Local#streamDirect', 'url' => '/api/v1/stream/direct', 'verb' => 'GET'], ['name' => 'Local#streamAccount', 'url' => '/api/v1/account/{username}/stream', 'verb' => 'GET'], + ['name' => 'Local#postData', 'url' => '/local/v1/post', 'verb' => 'GET'], + ['name' => 'Local#postCreate', 'url' => '/api/v1/post', 'verb' => 'POST'], ['name' => 'Local#postDelete', 'url' => '/api/v1/post', 'verb' => 'DELETE'], diff --git a/lib/Controller/LocalController.php b/lib/Controller/LocalController.php index 69294bf8..9b91131c 100644 --- a/lib/Controller/LocalController.php +++ b/lib/Controller/LocalController.php @@ -183,6 +183,26 @@ class LocalController extends Controller { /** + * get info about a post (limited to viewer rights). + * + * @NoAdminRequired + * + * @param string $id + * + * @return DataResponse + */ + public function postData(string $id): DataResponse { + try { + $this->initViewer(true); + + return $this->directSuccess($this->noteService->getNoteById($id, true)); + } catch (Exception $e) { + return $this->fail($e); + } + } + + + /** * Delete your own post. * * @NoAdminRequired |