Merge branch 'Automattic:master' into Comments

This commit is contained in:
Django 2023-10-03 06:00:10 -07:00 committed by GitHub
commit 92fd280133
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 51 additions and 64 deletions

View file

@ -3,7 +3,7 @@
**Tags:** OStatus, fediverse, activitypub, activitystream **Tags:** OStatus, fediverse, activitypub, activitystream
**Requires at least:** 4.7 **Requires at least:** 4.7
**Tested up to:** 6.3 **Tested up to:** 6.3
**Stable tag:** 1.0.1 **Stable tag:** 1.0.2
**Requires PHP:** 5.6 **Requires PHP:** 5.6
**License:** MIT **License:** MIT
**License URI:** http://opensource.org/licenses/MIT **License URI:** http://opensource.org/licenses/MIT
@ -105,6 +105,18 @@ 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). Project maintained on GitHub at [automattic/wordpress-activitypub](https://github.com/automattic/wordpress-activitypub).
### 1.0.2 ###
* Updated: improved hashtag visibility in default template
* Updated: reduced number of followers to be checked/updated via Cron, when System Cron is not set up
* Updated: check if username of Blog-User collides with an Authors name
* Compatibility: improved Group meta informations
* Fixed: detection of single user mode
* Fixed: remote delete
* Fixed: styles in Follow-Me block
* Fixed: various encoding and formatting issues
* Fixed: (health) check Author URLs only if Authors are enabled
### 1.0.1 ### ### 1.0.1 ###
* Update: improve image attachment detection using the block editor * Update: improve image attachment detection using the block editor

View file

@ -3,7 +3,7 @@
* Plugin Name: ActivityPub * Plugin Name: ActivityPub
* Plugin URI: https://github.com/pfefferle/wordpress-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. * Description: The ActivityPub protocol is a decentralized social networking protocol based upon the ActivityStreams 2.0 data format.
* Version: 1.0.1 * Version: 1.0.2
* Author: Matthias Pfefferle & Automattic * Author: Matthias Pfefferle & Automattic
* Author URI: https://automattic.com/ * Author URI: https://automattic.com/
* License: MIT * License: MIT

View file

@ -3,8 +3,10 @@ namespace Activitypub;
use WP_Error; use WP_Error;
use Activitypub\Webfinger; use Activitypub\Webfinger;
use Activitypub\Collection\Users;
use function Activitypub\get_plugin_version; use function Activitypub\get_plugin_version;
use function Activitypub\is_user_type_disabled;
use function Activitypub\get_webfinger_resource; use function Activitypub\get_webfinger_resource;
/** /**
@ -25,10 +27,12 @@ class Health_Check {
} }
public static function add_tests( $tests ) { public static function add_tests( $tests ) {
if ( ! is_user_type_disabled( 'user' ) ) {
$tests['direct']['activitypub_test_author_url'] = array( $tests['direct']['activitypub_test_author_url'] = array(
'label' => \__( 'Author URL test', 'activitypub' ), 'label' => \__( 'Author URL test', 'activitypub' ),
'test' => array( self::class, 'test_author_url' ), 'test' => array( self::class, 'test_author_url' ),
); );
}
$tests['direct']['activitypub_test_webfinger'] = array( $tests['direct']['activitypub_test_webfinger'] = array(
'label' => __( 'WebFinger Test', 'activitypub' ), 'label' => __( 'WebFinger Test', 'activitypub' ),
@ -254,7 +258,14 @@ class Health_Check {
*/ */
public static function is_webfinger_endpoint_accessible() { public static function is_webfinger_endpoint_accessible() {
$user = \wp_get_current_user(); $user = \wp_get_current_user();
if ( ! is_user_type_disabled( 'blog' ) ) {
$account = get_webfinger_resource( $user->ID ); $account = get_webfinger_resource( $user->ID );
} elseif ( ! is_user_type_disabled( 'user' ) ) {
$account = get_webfinger_resource( Users::BLOG_USER_ID );
} else {
$account = '';
}
$url = Webfinger::resolve( $account ); $url = Webfinger::resolve( $account );
if ( \is_wp_error( $url ) ) { if ( \is_wp_error( $url ) ) {

View file

@ -67,7 +67,13 @@ class Blog_User extends User {
* @return string The User-Name. * @return string The User-Name.
*/ */
public function get_name() { public function get_name() {
return \esc_html( \get_bloginfo( 'name' ) ); return \wp_strip_all_tags(
\html_entity_decode(
\get_bloginfo( 'name' ),
\ENT_QUOTES,
'UTF-8'
)
);
} }
/** /**

View file

@ -30,58 +30,6 @@ class Post {
*/ */
protected $wp_post; protected $wp_post;
/**
* The Allowed Tags, used in the content.
*
* @var array
*/
protected $allowed_tags = array(
'a' => array(
'href' => array(),
'title' => array(),
'class' => array(),
'rel' => array(),
),
'br' => array(),
'p' => array(
'class' => array(),
),
'span' => array(
'class' => array(),
),
'div' => array(
'class' => array(),
),
'ul' => array(),
'ol' => array(
'reversed' => array(),
'start' => array(),
),
'li' => array(
'value' => array(),
),
'strong' => array(
'class' => array(),
),
'b' => array(
'class' => array(),
),
'i' => array(
'class' => array(),
),
'em' => array(
'class' => array(),
),
'blockquote' => array(),
'cite' => array(),
'code' => array(
'class' => array(),
),
'pre' => array(
'class' => array(),
),
);
/** /**
* Static function to Transform a WP_Post Object. * Static function to Transform a WP_Post Object.
* *
@ -513,13 +461,11 @@ class Post {
$content = do_shortcode( $content ); $content = do_shortcode( $content );
wp_reset_postdata(); wp_reset_postdata();
$content = \wp_kses( $content, $this->allowed_tags );
$content = \wpautop( $content ); $content = \wpautop( $content );
$content = \preg_replace( '/[\n\r\t]/', '', $content ); $content = \preg_replace( '/[\n\r\t]/', '', $content );
$content = \trim( $content ); $content = \trim( $content );
$content = \apply_filters( 'activitypub_the_content', $content, $post ); $content = \apply_filters( 'activitypub_the_content', $content, $post );
$content = \html_entity_decode( $content, \ENT_QUOTES, 'UTF-8' );
return $content; return $content;
} }

View file

@ -3,7 +3,7 @@ Contributors: automattic, pfefferle, mediaformat, mattwiebe, akirk, jeherve, nur
Tags: OStatus, fediverse, activitypub, activitystream Tags: OStatus, fediverse, activitypub, activitystream
Requires at least: 4.7 Requires at least: 4.7
Tested up to: 6.3 Tested up to: 6.3
Stable tag: 1.0.1 Stable tag: 1.0.2
Requires PHP: 5.6 Requires PHP: 5.6
License: MIT License: MIT
License URI: http://opensource.org/licenses/MIT License URI: http://opensource.org/licenses/MIT
@ -105,6 +105,18 @@ 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). Project maintained on GitHub at [automattic/wordpress-activitypub](https://github.com/automattic/wordpress-activitypub).
= 1.0.2 =
* Updated: improved hashtag visibility in default template
* Updated: reduced number of followers to be checked/updated via Cron, when System Cron is not set up
* Updated: check if username of Blog-User collides with an Authors name
* Compatibility: improved Group meta informations
* Fixed: detection of single user mode
* Fixed: remote delete
* Fixed: styles in Follow-Me block
* Fixed: various encoding and formatting issues
* Fixed: (health) check Author URLs only if Authors are enabled
= 1.0.1 = = 1.0.1 =
* Update: improve image attachment detection using the block editor * Update: improve image attachment detection using the block editor