Allow for example2-style domains
This commit is contained in:
parent
b3e71ff803
commit
6c03ab1704
2 changed files with 3 additions and 4 deletions
|
@ -159,7 +159,6 @@ add_action(
|
||||||
/**
|
/**
|
||||||
* Disable webfinger for known example domains.
|
* Disable webfinger for known example domains.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
add_filter(
|
add_filter(
|
||||||
'pre_get_remote_metadata_by_actor',
|
'pre_get_remote_metadata_by_actor',
|
||||||
function( $metadata, $actor ) {
|
function( $metadata, $actor ) {
|
||||||
|
@ -181,7 +180,7 @@ add_filter(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( strtok( $domain, '.' ) === 'example' ) {
|
if ( rtrim( strtok( $domain, '.' ), '0123456789' ) === 'example' ) {
|
||||||
$metadata = array(
|
$metadata = array(
|
||||||
'url' => sprintf( 'https://%s/users/%s/', $domain, $username ),
|
'url' => sprintf( 'https://%s/users/%s/', $domain, $username ),
|
||||||
'name' => $username,
|
'name' => $username,
|
||||||
|
@ -190,6 +189,6 @@ add_filter(
|
||||||
}
|
}
|
||||||
return $metadata;
|
return $metadata;
|
||||||
},
|
},
|
||||||
10,
|
9,
|
||||||
2
|
2
|
||||||
);
|
);
|
||||||
|
|
|
@ -12,7 +12,7 @@ class Test_Functions extends ActivityPub_TestCase_Cache_HTTP {
|
||||||
|
|
||||||
add_filter( 'pre_http_request', array( $this, 'invalid_http_response' ), 8, 3 );
|
add_filter( 'pre_http_request', array( $this, 'invalid_http_response' ), 8, 3 );
|
||||||
foreach ( array( 'user', 'test' ) as $username ) {
|
foreach ( array( 'user', 'test' ) as $username ) {
|
||||||
foreach ( array( 'example.org', 'example.net' ) as $domain ) {
|
foreach ( array( 'example.org', 'example.net', 'example2.com' ) as $domain ) {
|
||||||
foreach ( array( '@', '' ) as $leading_at ) {
|
foreach ( array( '@', '' ) as $leading_at ) {
|
||||||
$metadata = \ActivityPub\get_remote_metadata_by_actor( $username . '@' . $domain );
|
$metadata = \ActivityPub\get_remote_metadata_by_actor( $username . '@' . $domain );
|
||||||
$this->assertEquals( sprintf( 'https://%s/users/%s/', $domain, $username ), $metadata['url'], $username . '@' . $domain );
|
$this->assertEquals( sprintf( 'https://%s/users/%s/', $domain, $username ), $metadata['url'], $username . '@' . $domain );
|
||||||
|
|
Loading…
Reference in a new issue