Skip to content

Commit

Permalink
added FEP-2677 (#613)
Browse files Browse the repository at this point in the history
* added FEP-2677

This PR enables [FEP-2677: Identifying the Application Actor](https://codeberg.org/fediverse/fep/src/branch/main/fep/2677/fep-2677.md)

@Menrath I needed a small task for in between ;)

* update changelog
  • Loading branch information
pfefferle committed Dec 21, 2023
1 parent 39c9288 commit 6f1a9a1
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 4 deletions.
1 change: 1 addition & 0 deletions FEDERATION.md
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -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 ###
Expand Down
4 changes: 4 additions & 0 deletions includes/rest/class-nodeinfo.php
Expand Up @@ -169,6 +169,10 @@ public static function discovery( $request ) {
'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 );
Expand Down
27 changes: 23 additions & 4 deletions integration/class-nodeinfo.php
Expand Up @@ -3,6 +3,7 @@

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

/**
Expand All @@ -26,7 +29,7 @@ public static function init() {
*
* @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 {
Expand All @@ -50,7 +53,7 @@ public static function add_nodeinfo_discovery( $nodeinfo, $version ) {
*
* @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(
Expand All @@ -61,4 +64,20 @@ public static function add_nodeinfo2_discovery( $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;
}
}
1 change: 1 addition & 0 deletions readme.txt
Expand Up @@ -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 =
Expand Down

0 comments on commit 6f1a9a1

Please sign in to comment.