updated plugin ActivityPub
version 2.6.1
This commit is contained in:
@ -123,7 +123,7 @@ class Actors {
|
||||
$url = str_replace( '{uri}', $resource, $template );
|
||||
|
||||
return new WP_REST_Response(
|
||||
array( 'url' => $url ),
|
||||
array( 'url' => $url, 'template' => $template ),
|
||||
200
|
||||
);
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ class Comment {
|
||||
public static function register_routes() {
|
||||
\register_rest_route(
|
||||
ACTIVITYPUB_REST_NAMESPACE,
|
||||
'/(users|actors)/(?P<comment_id>\d+)/remote-reply',
|
||||
'/comments/(?P<comment_id>\d+)/remote-reply',
|
||||
array(
|
||||
array(
|
||||
'methods' => WP_REST_Server::READABLE,
|
||||
@ -88,7 +88,7 @@ class Comment {
|
||||
$url = str_replace( '{uri}', $resource, $template );
|
||||
|
||||
return new WP_REST_Response(
|
||||
array( 'url' => $url ),
|
||||
array( 'url' => $url, 'template' => $template ),
|
||||
200
|
||||
);
|
||||
}
|
||||
|
@ -55,10 +55,28 @@ class Webfinger {
|
||||
*/
|
||||
\do_action( 'activitypub_rest_webfinger_pre' );
|
||||
|
||||
$code = 200;
|
||||
|
||||
$resource = $request->get_param( 'resource' );
|
||||
$response = self::get_profile( $resource );
|
||||
|
||||
return new WP_REST_Response( $response, 200 );
|
||||
if ( \is_wp_error( $response ) ) {
|
||||
$code = 400;
|
||||
$error_data = $response->get_error_data();
|
||||
|
||||
if ( isset( $error_data['status'] ) ) {
|
||||
$code = $error_data['status'];
|
||||
}
|
||||
}
|
||||
|
||||
return new WP_REST_Response(
|
||||
$response,
|
||||
$code,
|
||||
array(
|
||||
'Access-Control-Allow-Origin' => '*',
|
||||
'Content-Type' => 'application/jrd+json; charset=' . get_option( 'blog_charset' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -88,7 +106,7 @@ class Webfinger {
|
||||
public static function get_profile( $resource ) {
|
||||
$user = User_Collection::get_by_resource( $resource );
|
||||
|
||||
if ( is_wp_error( $user ) ) {
|
||||
if ( \is_wp_error( $user ) ) {
|
||||
return $user;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user