From d7810114b758ed06f87509cba09bccffce71a83b Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Tue, 24 Oct 2023 13:00:22 +0200 Subject: [PATCH] improve error messages and codes (#532) * improve error messages and codes * version bump --- README.md | 6 +++++- activitypub.php | 2 +- includes/class-signature.php | 2 +- readme.txt | 6 +++++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8156292..dcc91f2 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ **Tags:** OStatus, fediverse, activitypub, activitystream **Requires at least:** 4.7 **Tested up to:** 6.3 -**Stable tag:** 1.0.9 +**Stable tag:** 1.0.10 **Requires PHP:** 5.6 **License:** MIT **License URI:** http://opensource.org/licenses/MIT @@ -105,6 +105,10 @@ Where 'blog' is the path to the subdirectory at which your blog resides. Project maintained on GitHub at [automattic/wordpress-activitypub](https://github.com/automattic/wordpress-activitypub). +### 1.0.10 ### + +* Improved: better error messages if remote profile is not accessible + ### 1.0.9 ### * Fixed: broken following endpoint diff --git a/activitypub.php b/activitypub.php index 91786e5..97f6067 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: 1.0.9 + * Version: 1.0.10 * Author: Matthias Pfefferle & Automattic * Author URI: https://automattic.com/ * License: MIT diff --git a/includes/class-signature.php b/includes/class-signature.php index 0b102b3..e66aa4b 100644 --- a/includes/class-signature.php +++ b/includes/class-signature.php @@ -328,7 +328,7 @@ class Signature { public static function get_remote_key( $key_id ) { // phpcs:ignore $actor = get_remote_metadata_by_actor( strip_fragment_from_url( $key_id ) ); // phpcs:ignore if ( \is_wp_error( $actor ) ) { - return $actor; + return new WP_Error( 'activitypub_no_remote_profile_found', __( 'No Profile found or Profile not accessible', 'activitypub' ), array( 'status' => 401 ) ); } if ( isset( $actor['publicKey']['publicKeyPem'] ) ) { return \rtrim( $actor['publicKey']['publicKeyPem'] ); // phpcs:ignore diff --git a/readme.txt b/readme.txt index bb562c6..7e48fc1 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: automattic, pfefferle, mediaformat, mattwiebe, akirk, jeherve, nur Tags: OStatus, fediverse, activitypub, activitystream Requires at least: 4.7 Tested up to: 6.3 -Stable tag: 1.0.9 +Stable tag: 1.0.10 Requires PHP: 5.6 License: MIT License URI: http://opensource.org/licenses/MIT @@ -105,6 +105,10 @@ Where 'blog' is the path to the subdirectory at which your blog resides. Project maintained on GitHub at [automattic/wordpress-activitypub](https://github.com/automattic/wordpress-activitypub). += 1.0.10 = + +* Improved: better error messages if remote profile is not accessible + = 1.0.9 = * Fixed: broken following endpoint