added FEP-2677 (#613)

* 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
This commit is contained in:
Matthias Pfefferle 2023-12-21 10:06:37 +01:00 committed by GitHub
parent 39c9288987
commit 6f1a9a1f7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 4 deletions

View file

@ -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-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-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-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 Partially supported FEPs

View file

@ -112,6 +112,7 @@ Project maintained on GitHub at [automattic/wordpress-activitypub](https://githu
* Added: URL support for WebFinger * Added: URL support for WebFinger
* Added: Make Post-Template filterable * Added: Make Post-Template filterable
* Added: CSS class for ActivityPub comments to allow custom designs * Added: CSS class for ActivityPub comments to allow custom designs
* Added: FEP-2677: Identifying the Application Actor
* Improved: WebFinger endpoints * Improved: WebFinger endpoints
### 1.3.0 ### ### 1.3.0 ###

View file

@ -169,6 +169,10 @@ class Nodeinfo {
'rel' => 'http://nodeinfo.diaspora.software/ns/schema/2.0', 'rel' => 'http://nodeinfo.diaspora.software/ns/schema/2.0',
'href' => get_rest_url_by_path( 'nodeinfo' ), '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 ); return new \WP_REST_Response( $discovery, 200 );

View file

@ -3,6 +3,7 @@ namespace Activitypub\Integration;
use function Activitypub\get_total_users; use function Activitypub\get_total_users;
use function Activitypub\get_active_users; use function Activitypub\get_active_users;
use function Activitypub\get_rest_url_by_path;
/** /**
* Compatibility with the NodeInfo plugin * Compatibility with the NodeInfo plugin
@ -14,8 +15,10 @@ class Nodeinfo {
* Initialize the class, registering WordPress hooks * Initialize the class, registering WordPress hooks
*/ */
public static function init() { public static function init() {
\add_filter( 'nodeinfo_data', array( self::class, 'add_nodeinfo_discovery' ), 10, 2 ); \add_filter( 'nodeinfo_data', array( self::class, 'add_nodeinfo_data' ), 10, 2 );
\add_filter( 'nodeinfo2_data', array( self::class, 'add_nodeinfo2_discovery' ), 10 ); \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 * @return array The extended array
*/ */
public static function add_nodeinfo_discovery( $nodeinfo, $version ) { public static function nodeinfo_data( $nodeinfo, $version ) {
if ( $version >= '2.0' ) { if ( $version >= '2.0' ) {
$nodeinfo['protocols'][] = 'activitypub'; $nodeinfo['protocols'][] = 'activitypub';
} else { } else {
@ -50,7 +53,7 @@ class Nodeinfo {
* *
* @return array The extended array * @return array The extended array
*/ */
public static function add_nodeinfo2_discovery( $nodeinfo ) { public static function nodeinfo2_data( $nodeinfo ) {
$nodeinfo['protocols'][] = 'activitypub'; $nodeinfo['protocols'][] = 'activitypub';
$nodeinfo['usage']['users'] = array( $nodeinfo['usage']['users'] = array(
@ -61,4 +64,20 @@ class Nodeinfo {
return $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;
}
} }

View file

@ -112,6 +112,7 @@ Project maintained on GitHub at [automattic/wordpress-activitypub](https://githu
* Added: URL support for WebFinger * Added: URL support for WebFinger
* Added: Make Post-Template filterable * Added: Make Post-Template filterable
* Added: CSS class for ActivityPub comments to allow custom designs * Added: CSS class for ActivityPub comments to allow custom designs
* Added: FEP-2677: Identifying the Application Actor
* Improved: WebFinger endpoints * Improved: WebFinger endpoints
= 1.3.0 = = 1.3.0 =