updated plugin ActivityPub version 2.0.1

This commit is contained in:
2024-02-08 12:31:25 +00:00
committed by Gitium
parent 6e1c54f7ba
commit 50bf15833c
58 changed files with 1772 additions and 543 deletions

View File

@ -14,8 +14,8 @@ class Webfinger {
* Initialize the class, registering WordPress hooks
*/
public static function init() {
\add_filter( 'webfinger_user_data', array( self::class, 'add_user_discovery' ), 10, 3 );
\add_filter( 'webfinger_data', array( self::class, 'add_pseudo_user_discovery' ), 99, 2 );
\add_filter( 'webfinger_user_data', array( self::class, 'add_user_discovery' ), 1, 3 );
\add_filter( 'webfinger_data', array( self::class, 'add_pseudo_user_discovery' ), 1, 2 );
}
/**
@ -34,6 +34,11 @@ class Webfinger {
return $array;
}
$array['subject'] = sprintf( 'acct:%s', $user->get_webfinger() );
$array['aliases'][] = $user->get_url();
$array['aliases'][] = $user->get_alternate_url();
$array['links'][] = array(
'rel' => 'self',
'type' => 'application/activity+json',
@ -53,10 +58,12 @@ class Webfinger {
* @return array the jrd array
*/
public static function add_pseudo_user_discovery( $array, $resource ) {
if ( $array ) {
$user = Webfinger_Rest::get_profile( $resource );
if ( ! $user || is_wp_error( $user ) ) {
return $array;
}
return Webfinger_Rest::get_profile( $resource );
return $user;
}
}