diff --git a/includes/model/class-user.php b/includes/model/class-user.php index 5bb1e77..2cee714 100644 --- a/includes/model/class-user.php +++ b/includes/model/class-user.php @@ -100,6 +100,10 @@ class User { return $this->get_url(); } + public function get_at_url() { + return \esc_url( \trailingslashit( get_home_url() ) . '@' . $this->get_username() ); + } + public function get_username() { return \esc_attr( \get_the_author_meta( 'login', $this->user_id ) ); } diff --git a/includes/rest/class-webfinger.php b/includes/rest/class-webfinger.php index 9b07a95..ec76686 100644 --- a/includes/rest/class-webfinger.php +++ b/includes/rest/class-webfinger.php @@ -53,12 +53,16 @@ class Webfinger { return $user; } + $aliases = array( + $user->get_url(), + $user->get_canonical_url(), + $user->get_at_url(), + ); + $json = array( 'subject' => $resource, - 'aliases' => array( - $user->get_url(), - ), - 'links' => array( + 'aliases' => array_values( array_unique( $aliases ) ), + 'links' => array( array( 'rel' => 'self', 'type' => 'application/activity+json',