This commit is contained in:
Matthias Pfefferle 2019-02-28 19:31:55 +01:00
parent f0483a1928
commit e2d708d23c
6 changed files with 27 additions and 0 deletions

View file

@ -15,6 +15,7 @@ class Admin {
add_action( 'admin_init', array( '\Activitypub\Admin', 'register_settings' ) );
add_action( 'show_user_profile', array( '\Activitypub\Admin', 'add_fediverse_profile' ) );
}
/**
* Add admin menu entry
*/

View file

@ -31,6 +31,13 @@ class Followers {
);
}
/**
* Handle GET request
*
* @param WP_REST_Request $request
*
* @return WP_REST_Response
*/
public static function get( $request ) {
$user_id = $request->get_param( 'id' );
$user = get_user_by( 'ID', $user_id );

View file

@ -21,6 +21,7 @@ class Inbox {
//add_action( 'activitypub_inbox_announce', array( '\Activitypub\Rest\Inbox', 'handle_reaction' ), 10, 2 );
add_action( 'activitypub_inbox_create', array( '\Activitypub\Rest\Inbox', 'handle_create' ), 10, 2 );
}
/**
* Register routes
*/
@ -81,6 +82,7 @@ class Inbox {
* Renders the user-inbox
*
* @param WP_REST_Request $request
*
* @return WP_REST_Response
*/
public static function user_inbox( $request ) {

View file

@ -17,6 +17,7 @@ class Nodeinfo {
add_filter( 'nodeinfo_data', array( '\Activitypub\Rest\Nodeinfo', 'add_nodeinfo_discovery' ), 10, 2 );
add_filter( 'nodeinfo2_data', array( '\Activitypub\Rest\Nodeinfo', 'add_nodeinfo2_discovery' ), 10 );
}
/**
* Register routes
*/

View file

@ -106,6 +106,11 @@ class Outbox {
return $response;
}
/**
* The supported parameters
*
* @return array list of parameters
*/
public static function request_parameters() {
$params = array();
@ -121,6 +126,11 @@ class Outbox {
return $params;
}
/**
* Send "create" activities
*
* @param int $post_id
*/
public static function send_post_activity( $post_id ) {
$post = get_post( $post_id );
$user_id = $post->post_author;
@ -138,6 +148,11 @@ class Outbox {
}
}
/**
* Send "update" activities
*
* @param int $post_id
*/
public static function send_update_activity( $post_id ) {
$post = get_post( $post_id );
$user_id = $post->post_author;

View file

@ -16,6 +16,7 @@ class Webfinger {
add_action( 'rest_api_init', array( '\Activitypub\Rest\Webfinger', 'register_routes' ) );
add_action( 'webfinger_user_data', array( '\Activitypub\Rest\Webfinger', 'add_webfinger_discovery' ), 10, 3 );
}
/**
* Register routes
*/