do not load NodeInfo class if blog is private
This commit is contained in:
parent
827aacc450
commit
2a1cc45124
2 changed files with 8 additions and 7 deletions
|
@ -52,8 +52,11 @@ function init() {
|
||||||
require_once \dirname( __FILE__ ) . '/includes/rest/class-webfinger.php';
|
require_once \dirname( __FILE__ ) . '/includes/rest/class-webfinger.php';
|
||||||
\Activitypub\Rest\Webfinger::init();
|
\Activitypub\Rest\Webfinger::init();
|
||||||
|
|
||||||
|
// load NodeInfo endpoints only if blog is public
|
||||||
|
if ( 1 === get_option( 'blog_public', 1 ) ) {
|
||||||
require_once \dirname( __FILE__ ) . '/includes/rest/class-nodeinfo.php';
|
require_once \dirname( __FILE__ ) . '/includes/rest/class-nodeinfo.php';
|
||||||
\Activitypub\Rest\NodeInfo::init();
|
\Activitypub\Rest\NodeInfo::init();
|
||||||
|
}
|
||||||
|
|
||||||
require_once \dirname( __FILE__ ) . '/includes/class-admin.php';
|
require_once \dirname( __FILE__ ) . '/includes/class-admin.php';
|
||||||
\Activitypub\Admin::init();
|
\Activitypub\Admin::init();
|
||||||
|
|
|
@ -13,12 +13,10 @@ class Nodeinfo {
|
||||||
* Initialize the class, registering WordPress hooks
|
* Initialize the class, registering WordPress hooks
|
||||||
*/
|
*/
|
||||||
public static function init() {
|
public static function init() {
|
||||||
if ( 1 === get_option( 'blog_public', 1 ) ) {
|
|
||||||
\add_action( 'rest_api_init', array( '\Activitypub\Rest\Nodeinfo', 'register_routes' ) );
|
\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( 'nodeinfo_data', array( '\Activitypub\Rest\Nodeinfo', 'add_nodeinfo_discovery' ), 10, 2 );
|
||||||
\add_filter( 'nodeinfo2_data', array( '\Activitypub\Rest\Nodeinfo', 'add_nodeinfo2_discovery' ), 10 );
|
\add_filter( 'nodeinfo2_data', array( '\Activitypub\Rest\Nodeinfo', 'add_nodeinfo2_discovery' ), 10 );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register routes
|
* Register routes
|
||||||
|
|
Loading…
Reference in a new issue