diff --git a/README.md b/README.md index 1fee133..0d68481 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,10 @@ Where 'blog' is the path to the subdirectory at which your blog resides. Project maintained on GitHub at [pfefferle/wordpress-activitypub](https://github.com/pfefferle/wordpress-activitypub). +### 0.8.3 ### + +* fixed accept header bug + ### 0.8.2 ### * add all required accept header diff --git a/activitypub.php b/activitypub.php index 57e34b8..b9e84b6 100644 --- a/activitypub.php +++ b/activitypub.php @@ -3,7 +3,7 @@ * Plugin Name: ActivityPub * Plugin URI: https://github.com/pfefferle/wordpress-activitypub/ * Description: The ActivityPub protocol is a decentralized social networking protocol based upon the ActivityStreams 2.0 data format. - * Version: 0.8.2 + * Version: 0.8.3 * Author: Matthias Pfefferle * Author URI: https://notiz.blog/ * License: MIT @@ -64,8 +64,8 @@ function init() { require_once dirname( __FILE__ ) . '/includes/class-debug.php'; \Activitypub\Debug::init(); - #require_once dirname( __FILE__ ) . '/includes/class-health-check.php'; - #\Activitypub\Health_Check::init(); + require_once dirname( __FILE__ ) . '/includes/class-health-check.php'; + \Activitypub\Health_Check::init(); } add_action( 'plugins_loaded', '\Activitypub\init' ); diff --git a/includes/class-activitypub.php b/includes/class-activitypub.php index c6ffa04..6097265 100644 --- a/includes/class-activitypub.php +++ b/includes/class-activitypub.php @@ -24,6 +24,8 @@ class Activitypub { } \add_action( 'transition_post_status', array( '\Activitypub\Activitypub', 'schedule_post_activity' ), 10, 3 ); + + \add_action( 'trash_post', array( '\Activitypub\Activitypub', 'schedule_delete_activity' ), 10 ); } /** @@ -60,22 +62,22 @@ class Activitypub { stristr( $accept_header, 'application/activity+json' ) || stristr( $accept_header, 'application/ld+json' ) ) { - return $template; + return $json_template; } // accept header as an array $accept = \explode( ',', trim( $accept_header ) ); if ( - ! \in_array( 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"', $accept, true ) && - ! \in_array( 'application/activity+json', $accept, true ) && - ! \in_array( 'application/ld+json', $accept, true ) && - ! \in_array( 'application/json', $accept, true ) + \in_array( 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"', $accept, true ) || + \in_array( 'application/activity+json', $accept, true ) || + \in_array( 'application/ld+json', $accept, true ) || + \in_array( 'application/json', $accept, true ) ) { - return $template; + return $json_template; } - return $json_template; + return $template; } /** @@ -113,9 +115,11 @@ class Activitypub { } if ( 'publish' === $new_status && 'publish' !== $old_status ) { - \wp_schedule_single_event( time() + \wp_rand( 0, 120 ), 'activitypub_send_post_activity', array( $post->ID ) ); + \wp_schedule_single_event( time(), 'activitypub_send_post_activity', array( $post->ID ) ); } elseif ( 'publish' === $new_status ) { - \wp_schedule_single_event( time() + \wp_rand( 0, 120 ), 'activitypub_send_update_activity', array( $post->ID ) ); + \wp_schedule_single_event( time(), 'activitypub_send_update_activity', array( $post->ID ) ); + } elseif ( 'trash' === $new_status ) { + \wp_schedule_single_event( time(), 'activitypub_send_delete_activity', array( get_permalink( $post ) ) ); } } diff --git a/languages/activitypub.pot b/languages/activitypub.pot index ef74201..2387722 100644 --- a/languages/activitypub.pot +++ b/languages/activitypub.pot @@ -2,10 +2,10 @@ # This file is distributed under the MIT. msgid "" msgstr "" -"Project-Id-Version: ActivityPub 0.8.2\n" +"Project-Id-Version: ActivityPub 0.8.3\n" "Report-Msgid-Bugs-To: " "https://wordpress.org/support/plugin/wordpress-activitypub\n" -"POT-Creation-Date: 2019-09-29 18:04:39+00:00\n" +"POT-Creation-Date: 2019-09-30 05:58:15+00:00\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/readme.txt b/readme.txt index f6f3449..eddf3d7 100644 --- a/readme.txt +++ b/readme.txt @@ -84,6 +84,10 @@ Where 'blog' is the path to the subdirectory at which your blog resides. Project maintained on GitHub at [pfefferle/wordpress-activitypub](https://github.com/pfefferle/wordpress-activitypub). += 0.8.3 = + +* fixed accept header bug + = 0.8.2 = * add all required accept header