add @-urls to webfinger aliases

This commit is contained in:
Matthias Pfefferle 2023-05-30 11:37:21 +02:00
parent 2feca1388a
commit 7b9b3dbc37
2 changed files with 12 additions and 4 deletions

View file

@ -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 ) );
}

View file

@ -53,11 +53,15 @@ 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(),
),
'aliases' => array_values( array_unique( $aliases ) ),
'links' => array(
array(
'rel' => 'self',