Skip to content
This repository has been archived by the owner on Mar 7, 2023. It is now read-only.

Commit

Permalink
add NodeInfo(2) support
Browse files Browse the repository at this point in the history
  • Loading branch information
pfefferle committed Nov 28, 2018
1 parent 88b75e5 commit 6f2c78e
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 6 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
**Donate link:** https://notiz.blog/donate/
**Requires at least:** 4.5
**Tested up to:** 4.9.9
**Stable tag:** 2.5.3
**Stable tag:** 2.5.4
**License:** MIT
**License URI:** https://opensource.org/licenses/MIT

Expand Down Expand Up @@ -68,6 +68,10 @@ If you are the author of a relevant plugin, or are planning one, contact us to g

## Changelog ##

### 2.5.4 ###

* Add NodeInfo support

### 2.5.3 ###

* Fixed GNU.social compatibility
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ services:
links:
- db
ports:
- "80:80"
- "8099:80"
volumes:
- .:/var/www/html/wp-content/plugins/ostatus-for-wordpress
restart: always
Expand Down
56 changes: 56 additions & 0 deletions includes/class-ostatus-discovery.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,60 @@ public static function host_meta( $array ) {

return $array;
}

/**
* Extend NodeInfo data
*
* @param array $nodeinfo NodeInfo data
* @param array $version updated data
*/
public static function nodeinfo( $nodeinfo, $version ) {
if ( '2.0' == $version) {
$nodeinfo['protocols'][] = 'ostatus';
} else {
$nodeinfo['protocols']['inbound'] = array_merge(
$nodeinfo['services']['inbound'],
array( 'friendica', 'gnusocial', 'mastodon' )
);

$nodeinfo['protocols']['outbound'] = array_merge(
$nodeinfo['services']['outbound'],
array( 'friendica', 'gnusocial', 'mastodon' )
);
}

$nodeinfo['services']['inbound'] = array_merge(
$nodeinfo['services']['inbound'],
array( 'friendica', 'gnusocial', 'mastodon' )
);

$nodeinfo['services']['outbound'] = array_merge(
$nodeinfo['services']['outbound'],
array( 'friendica', 'gnusocial', 'mastodon' )
);

return $nodeinfo;
}

/**
* Extend NodeInfo2 data
*
* @param array $nodeinfo NodeInfo2 data
* @param array $version updated data
*/
public static function nodeinfo2( $nodeinfo ) {
$nodeinfo['protocols'][] = 'ostatus';

$nodeinfo['services']['inbound'] = array_merge(
$nodeinfo['services']['inbound'],
array( 'friendica', 'gnusocial', 'mastodon' )
);

$nodeinfo['services']['outbound'] = array_merge(
$nodeinfo['services']['outbound'],
array( 'friendica', 'gnusocial', 'mastodon' )
);

return $nodeinfo;
}
}
4 changes: 2 additions & 2 deletions languages/ostatus-for-wordpress.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# This file is distributed under the MIT.
msgid ""
msgstr ""
"Project-Id-Version: OStatus 2.5.2\n"
"Project-Id-Version: OStatus 2.5.4\n"
"Report-Msgid-Bugs-To: "
"https://wordpress.org/support/plugin/wordpress-ostatus\n"
"POT-Creation-Date: 2018-11-21 12:59:10+00:00\n"
"POT-Creation-Date: 2018-11-27 15:31:59+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
Expand Down
4 changes: 3 additions & 1 deletion ostatus-for-wordpress.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Author URI: https://notiz.blog/
* License: MIT
* License URI: http://opensource.org/licenses/MIT
* Version: 2.5.3
* Version: 2.5.4
* Text Domain: ostatus-for-wordpress
* Domain Path: /languages
*/
Expand All @@ -34,6 +34,8 @@ function ostatus_init() {
require_once dirname( __FILE__ ) . '/includes/class-ostatus-discovery.php';
add_filter( 'webfinger_user_data', array( 'Ostatus_Discovery', 'webfinger' ), 10, 3 );
add_filter( 'host_meta', array( 'Ostatus_Discovery', 'host_meta' ) );
add_filter( 'nodeinfo_data', array( 'Ostatus_Discovery', 'nodeinfo' ), 10, 2 );
add_filter( 'nodeinfo2_data', array( 'Ostatus_Discovery', 'nodeinfo2' ), 10 );

require_once dirname( __FILE__ ) . '/includes/class-ostatus-feed.php';
add_action( 'init', array( 'Ostatus_Feed', 'add_ostatus_feed' ) );
Expand Down
6 changes: 5 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: ostatus, federated, mastodon, social, gnusocial, statusnet
Donate link: https://notiz.blog/donate/
Requires at least: 4.5
Tested up to: 4.9.9
Stable tag: 2.5.3
Stable tag: 2.5.4
License: MIT
License URI: https://opensource.org/licenses/MIT

Expand Down Expand Up @@ -68,6 +68,10 @@ If you are the author of a relevant plugin, or are planning one, contact us to g

== Changelog ==

= 2.5.4 =

* Add NodeInfo support

= 2.5.3 =

* Fixed GNU.social compatibility
Expand Down
1 change: 1 addition & 0 deletions templates/dependencies-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
'pubsubhubbub',
'salmon',
'webfinger',
'nodeinfo',
) );

foreach ( $required_plugins as $plugin ) {
Expand Down

0 comments on commit 6f2c78e

Please sign in to comment.