Only return nodeinfo data if site is public
This commit is contained in:
parent
19a7bddc5f
commit
3d573aa140
1 changed files with 8 additions and 3 deletions
|
@ -13,10 +13,12 @@ class Nodeinfo {
|
|||
* Initialize the class, registering WordPress hooks
|
||||
*/
|
||||
public static function init() {
|
||||
if ( 1 === get_option('blog_public') ) {
|
||||
\add_action( 'rest_api_init', array( '\Activitypub\Rest\Nodeinfo', 'register_routes' ) );
|
||||
\add_filter( 'nodeinfo_data', array( '\Activitypub\Rest\Nodeinfo', 'add_nodeinfo_discovery' ), 10, 2 );
|
||||
\add_filter( 'nodeinfo2_data', array( '\Activitypub\Rest\Nodeinfo', 'add_nodeinfo2_discovery' ), 10 );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register routes
|
||||
|
@ -90,6 +92,9 @@ class Nodeinfo {
|
|||
'email' => \get_option( 'admin_email' ),
|
||||
);
|
||||
|
||||
$nodeinfo['blog_public'] = array(
|
||||
'blog_public' => \get_option('blog_public') );
|
||||
|
||||
return new \WP_REST_Response( $nodeinfo, 200 );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue