From 10419ade57fdc23dbd3d40250c0ba0b4bacaa40a Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Wed, 29 Aug 2018 17:18:45 -0400 Subject: [PATCH] Restructure api.php --- inc/api.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/inc/api.php b/inc/api.php index 918625c..c5f4d21 100644 --- a/inc/api.php +++ b/inc/api.php @@ -12,7 +12,7 @@ function get_actor( $request ) { return \actors\get_actor( $user ); } -function post_to_outbox( $request ) { +function handle_activity( $request ) { $actor = $request['actor']; $activity = json_decode( $request->get_body(), true ); return \outbox\handle_activity( $actor, $activity ); @@ -29,14 +29,14 @@ function get_activity( $request ) { } function register_routes() { + register_rest_route( 'activitypub/v1', '/actor/(?P[a-zA-Z0-9-]+)/outbox', array( + 'methods' => 'POST', + 'callback' => __NAMESPACE__ . '\handle_activity', + ) ); register_rest_route( 'activitypub/v1', '/actor/(?P[a-zA-Z0-9-]+)', array( 'methods' => 'GET', 'callback' => __NAMESPACE__ . '\get_actor', ) ); - register_rest_route( 'activitypub/v1', '/actor/(?P[a-zA-Z0-9-]+)/outbox', array( - 'methods' => 'POST', - 'callback' => __NAMESPACE__ . '\post_to_outbox', - ) ); register_rest_route( 'activitypub/v1', '/object/(?P[0-9]+)', array( 'methods' => 'GET', 'callback' => __NAMESPACE__ . '\get_object',