service actor as application actor

This commit is contained in:
Django Doucet 2023-05-05 12:09:12 -06:00
parent 27636b62d5
commit e827221ee6

View file

@ -27,11 +27,11 @@ class Server {
public static function register_routes() {
\register_rest_route(
'activitypub/1.0',
'/service',
'/application',
array(
array(
'methods' => \WP_REST_Server::READABLE,
'callback' => array( self::class, 'service_actor' ),
'callback' => array( self::class, 'application_actor' ),
'permission_callback' => '__return_true',
),
)
@ -39,24 +39,24 @@ class Server {
}
/**
* Render Service actor profile
* Render Application actor profile
*
* @return WP_REST_Response
*/
public static function service_actor() {
public static function application_actor() {
$json = new \stdClass();
$json->{'@context'} = \Activitypub\get_context();
$json->id = \get_rest_url( null, 'activitypub/1.0/service' );
$json->id = \get_rest_url( null, 'activitypub/1.0/application' );
$json->type = 'Application';
$json->preferredUsername = parse_url( get_site_url(), PHP_URL_HOST );
$json->name = get_bloginfo( 'name' );
$json->summary = "ActivityPub service actor";
$json->summary = "WordPress-ActivityPub application actor";
$json->manuallyApprovesFollowers = TRUE;
$json->icon = [ get_site_icon_url() ];
$json->publicKey = (object) array(
'id' => \get_rest_url( null, 'activitypub/1.0/service#main-key' ),
'owner' => \get_rest_url( null, 'activitypub/1.0/service' ),
'id' => \get_rest_url( null, 'activitypub/1.0/application#main-key' ),
'owner' => \get_rest_url( null, 'activitypub/1.0/application' ),
'publicKeyPem' => Signature::get_public_key( -1 ),
);