diff --git a/FEDERATION.md b/FEDERATION.md index 078fef4..831d5af 100644 --- a/FEDERATION.md +++ b/FEDERATION.md @@ -14,6 +14,7 @@ The WordPress plugin largely follows ActivityPub's server-to-server specificatio - [FEP-f1d5: NodeInfo in Fediverse Software](https://codeberg.org/fediverse/fep/src/branch/main/fep/f1d5/fep-f1d5.md) - [FEP-67ff: FEDERATION.md](https://codeberg.org/fediverse/fep/src/branch/main/fep/67ff/fep-67ff.md) - [FEP-5feb: Search indexing consent for actors](https://codeberg.org/fediverse/fep/src/branch/main/fep/5feb/fep-5feb.md) +- [FEP-2677: Identifying the Application Actor](https://codeberg.org/fediverse/fep/src/branch/main/fep/2677/fep-2677.md) Partially supported FEPs diff --git a/README.md b/README.md index 73223e4..7947c21 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,7 @@ Project maintained on GitHub at [automattic/wordpress-activitypub](https://githu * Added: URL support for WebFinger * Added: Make Post-Template filterable * Added: CSS class for ActivityPub comments to allow custom designs +* Added: FEP-2677: Identifying the Application Actor * Improved: WebFinger endpoints ### 1.3.0 ### diff --git a/includes/rest/class-nodeinfo.php b/includes/rest/class-nodeinfo.php index 62151ff..7f1f094 100644 --- a/includes/rest/class-nodeinfo.php +++ b/includes/rest/class-nodeinfo.php @@ -169,6 +169,10 @@ class Nodeinfo { 'rel' => 'http://nodeinfo.diaspora.software/ns/schema/2.0', 'href' => get_rest_url_by_path( 'nodeinfo' ), ), + array( + 'rel' => 'https://www.w3.org/ns/activitystreams#Application', + 'href' => get_rest_url_by_path( 'application' ), + ), ); return new \WP_REST_Response( $discovery, 200 ); diff --git a/integration/class-nodeinfo.php b/integration/class-nodeinfo.php index dea6c67..59492c1 100644 --- a/integration/class-nodeinfo.php +++ b/integration/class-nodeinfo.php @@ -3,6 +3,7 @@ namespace Activitypub\Integration; use function Activitypub\get_total_users; use function Activitypub\get_active_users; +use function Activitypub\get_rest_url_by_path; /** * Compatibility with the NodeInfo plugin @@ -14,8 +15,10 @@ class Nodeinfo { * Initialize the class, registering WordPress hooks */ public static function init() { - \add_filter( 'nodeinfo_data', array( self::class, 'add_nodeinfo_discovery' ), 10, 2 ); - \add_filter( 'nodeinfo2_data', array( self::class, 'add_nodeinfo2_discovery' ), 10 ); + \add_filter( 'nodeinfo_data', array( self::class, 'add_nodeinfo_data' ), 10, 2 ); + \add_filter( 'nodeinfo2_data', array( self::class, 'add_nodeinfo2_data' ), 10 ); + + \add_filter( 'wellknown_nodeinfo_data', array( self::class, 'add_wellknown_nodeinfo_data' ), 10, 2 ); } /** @@ -26,7 +29,7 @@ class Nodeinfo { * * @return array The extended array */ - public static function add_nodeinfo_discovery( $nodeinfo, $version ) { + public static function nodeinfo_data( $nodeinfo, $version ) { if ( $version >= '2.0' ) { $nodeinfo['protocols'][] = 'activitypub'; } else { @@ -50,7 +53,7 @@ class Nodeinfo { * * @return array The extended array */ - public static function add_nodeinfo2_discovery( $nodeinfo ) { + public static function nodeinfo2_data( $nodeinfo ) { $nodeinfo['protocols'][] = 'activitypub'; $nodeinfo['usage']['users'] = array( @@ -61,4 +64,20 @@ class Nodeinfo { return $nodeinfo; } + + /** + * Extend the well-known nodeinfo data + * + * @param array $data The well-known nodeinfo data + * + * @return array The extended array + */ + public static function add_wellknown_nodeinfo_data( $data ) { + $data['links'][] = array( + 'rel' => 'https://www.w3.org/ns/activitystreams#Application', + 'href' => get_rest_url_by_path( 'application' ), + ); + + return $data; + } } diff --git a/readme.txt b/readme.txt index e0797d2..c15b43f 100644 --- a/readme.txt +++ b/readme.txt @@ -112,6 +112,7 @@ Project maintained on GitHub at [automattic/wordpress-activitypub](https://githu * Added: URL support for WebFinger * Added: Make Post-Template filterable * Added: CSS class for ActivityPub comments to allow custom designs +* Added: FEP-2677: Identifying the Application Actor * Improved: WebFinger endpoints = 1.3.0 =