updated plugin ActivityPub version 8.3.0
This commit is contained in:
@ -7,12 +7,11 @@
|
||||
|
||||
namespace Activitypub\Model;
|
||||
|
||||
use WP_Query;
|
||||
use Activitypub\Signature;
|
||||
use Activitypub\Activity\Actor;
|
||||
use Activitypub\Collection\Actors;
|
||||
|
||||
use function Activitypub\get_rest_url_by_path;
|
||||
use function Activitypub\home_host;
|
||||
|
||||
/**
|
||||
* Application class.
|
||||
@ -34,7 +33,7 @@ class Application extends Actor {
|
||||
*
|
||||
* @context http://joinmastodon.org/ns#discoverable
|
||||
*
|
||||
* @var boolean
|
||||
* @var bool
|
||||
*/
|
||||
protected $discoverable = false;
|
||||
|
||||
@ -43,34 +42,64 @@ class Application extends Actor {
|
||||
*
|
||||
* @context http://joinmastodon.org/ns#indexable
|
||||
*
|
||||
* @var boolean
|
||||
* @var bool
|
||||
*/
|
||||
protected $indexable = false;
|
||||
|
||||
/**
|
||||
* The WebFinger Resource.
|
||||
* Whether the Application manually approves followers.
|
||||
*
|
||||
* @see https://docs.joinmastodon.org/spec/activitypub/#as
|
||||
*
|
||||
* @context as:manuallyApprovesFollowers
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $manually_approves_followers = true;
|
||||
|
||||
/**
|
||||
* List of software capabilities implemented by the Application.
|
||||
*
|
||||
* @see https://codeberg.org/silverpill/feps/src/branch/main/844e/fep-844e.md
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $implements = array(
|
||||
array(
|
||||
'href' => 'https://datatracker.ietf.org/doc/html/rfc9421',
|
||||
'name' => 'RFC-9421: HTTP Message Signatures',
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Set Application as invisible.
|
||||
*
|
||||
* @see https://litepub.social/
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $invisible = true;
|
||||
|
||||
/**
|
||||
* The type of the Actor.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $webfinger;
|
||||
protected $type = 'Application';
|
||||
|
||||
/**
|
||||
* Returns the type of the object.
|
||||
* The Username.
|
||||
*
|
||||
* @return string The type of the object.
|
||||
* @var string
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'Application';
|
||||
}
|
||||
protected $name = 'application';
|
||||
|
||||
/**
|
||||
* Returns whether the Application manually approves followers.
|
||||
* The preferred username.
|
||||
*
|
||||
* @return true Whether the Application manually approves followers.
|
||||
* @var string
|
||||
*/
|
||||
public function get_manually_approves_followers() {
|
||||
return true;
|
||||
}
|
||||
protected $preferred_username = 'application';
|
||||
|
||||
/**
|
||||
* Returns the ID of the Application.
|
||||
@ -99,24 +128,6 @@ class Application extends Actor {
|
||||
return $this->get_id();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Username.
|
||||
*
|
||||
* @return string The Username.
|
||||
*/
|
||||
public function get_name() {
|
||||
return 'application';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the preferred username.
|
||||
*
|
||||
* @return string The preferred username.
|
||||
*/
|
||||
public function get_preferred_username() {
|
||||
return $this->get_name();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the User-Icon.
|
||||
*
|
||||
@ -173,7 +184,7 @@ class Application extends Actor {
|
||||
* @return string The published date.
|
||||
*/
|
||||
public function get_published() {
|
||||
$first_post = new WP_Query(
|
||||
$first_post = new \WP_Query(
|
||||
array(
|
||||
'orderby' => 'date',
|
||||
'order' => 'ASC',
|
||||
@ -226,7 +237,7 @@ class Application extends Actor {
|
||||
return array(
|
||||
'id' => $this->get_id() . '#main-key',
|
||||
'owner' => $this->get_id(),
|
||||
'publicKeyPem' => Signature::get_public_key_for( Actors::APPLICATION_USER_ID ),
|
||||
'publicKeyPem' => Actors::get_public_key( Actors::APPLICATION_USER_ID ),
|
||||
);
|
||||
}
|
||||
|
||||
@ -236,11 +247,10 @@ class Application extends Actor {
|
||||
* @return string The User description.
|
||||
*/
|
||||
public function get_summary() {
|
||||
return \wpautop(
|
||||
\wp_kses(
|
||||
\get_bloginfo( 'description' ),
|
||||
'default'
|
||||
)
|
||||
return sprintf(
|
||||
/* translators: %s: Domain of the site */
|
||||
__( 'This is the Application Actor for %s.', 'activitypub' ),
|
||||
home_host()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user