Skip to content

Commit 8cdbbe7

Browse files
authored
Fix NodeInfo rel (#1275)
* Fix NodeInfo rel * fix tests
1 parent 1f4b54d commit 8cdbbe7

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
* Cleanup of option values when the plugin is uninstalled.
1313
* Third-party plugins can filter settings tabs to add their own settings pages for ActivityPub.
1414
* Show ActivityPub preview in row actions when Block Editor is enabled but not used for the post type.
15-
*
15+
1616
### Changed
1717

1818
* Manually granting `activitypub` cap no longer requires the receiving user to have `publish_post`.
@@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2525
* Negotiation of ActivityPub requests for custom post types when queried by the ActivityPub ID.
2626
* Avoid PHP warnings when using Debug mode and when the `actor` is not set.
2727
* No longer creates Outbox items when importing content/users.
28+
* Fix NodeInfo 2.0 URL to be HTTP instead of HTTPS.
2829

2930
## [5.0.0] - 2025-02-03
3031

includes/rest/class-nodeinfo-controller.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ public function register_routes() {
7979
public function get_items( $request ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
8080
$response = array(
8181
'links' => array(
82+
array(
83+
'rel' => 'http://nodeinfo.diaspora.software/ns/schema/2.0',
84+
'href' => get_rest_url_by_path( '/nodeinfo/2.0' ),
85+
),
8286
array(
8387
'rel' => 'https://nodeinfo.diaspora.software/ns/schema/2.0',
8488
'href' => get_rest_url_by_path( '/nodeinfo/2.0' ),

readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ For reasons of data protection, it is not possible to see the followers of other
143143
* Fixed: Negotiation of ActivityPub requests for custom post types when queried by the ActivityPub ID.
144144
* Fixed: Avoid PHP warnings when using Debug mode and when the `actor` is not set.
145145
* Fixed: No longer creates Outbox items when importing content/users.
146+
* Fixed: NodeInfo 2.0 URL to be HTTP instead of HTTPS.
146147

147148
= 5.0.0 =
148149

tests/includes/rest/class-test-nodeinfo-controller.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,16 @@ public function test_get_items() {
4040
$this->assertCount( 3, $data['links'] );
4141

4242
// Test first link.
43-
$this->assertEquals( 'https://nodeinfo.diaspora.software/ns/schema/2.0', $data['links'][0]['rel'] );
43+
$this->assertEquals( 'http://nodeinfo.diaspora.software/ns/schema/2.0', $data['links'][0]['rel'] );
4444
$this->assertStringEndsWith( '/nodeinfo/2.0', $data['links'][0]['href'] );
4545

4646
// Test second link.
47-
$this->assertEquals( 'https://www.w3.org/ns/activitystreams#Application', $data['links'][1]['rel'] );
48-
$this->assertStringEndsWith( '/application', $data['links'][1]['href'] );
47+
$this->assertEquals( 'https://nodeinfo.diaspora.software/ns/schema/2.0', $data['links'][1]['rel'] );
48+
$this->assertStringEndsWith( '/nodeinfo/2.0', $data['links'][1]['href'] );
49+
50+
// Test third link.
51+
$this->assertEquals( 'https://www.w3.org/ns/activitystreams#Application', $data['links'][2]['rel'] );
52+
$this->assertStringEndsWith( '/application', $data['links'][2]['href'] );
4953

5054
// Make sure the links work.
5155
$request = new \WP_REST_Request( 'GET', str_replace( \get_rest_url(), '/', $data['links'][0]['href'] ) );

0 commit comments

Comments
 (0)