fix actions

This commit is contained in:
Matthias Pfefferle 2023-07-25 10:47:59 +02:00
parent 0fd80a1c52
commit 921ca0c1c6
7 changed files with 24 additions and 7 deletions

View file

@ -63,7 +63,7 @@ class Followers {
/* /*
* Action triggerd prior to the ActivityPub profile being created and sent to the client * Action triggerd prior to the ActivityPub profile being created and sent to the client
*/ */
\do_action( 'activitypub_outbox_pre' ); \do_action( 'activitypub_rest_followers_pre' );
$json = new stdClass(); $json = new stdClass();

View file

@ -56,7 +56,7 @@ class Following {
/* /*
* Action triggerd prior to the ActivityPub profile being created and sent to the client * Action triggerd prior to the ActivityPub profile being created and sent to the client
*/ */
\do_action( 'activitypub_outbox_pre' ); \do_action( 'activitypub_rest_following_pre' );
$json = new \stdClass(); $json = new \stdClass();

View file

@ -85,7 +85,7 @@ class Inbox {
/* /*
* Action triggerd prior to the ActivityPub profile being created and sent to the client * Action triggerd prior to the ActivityPub profile being created and sent to the client
*/ */
\do_action( 'activitypub_inbox_pre' ); \do_action( 'activitypub_rest_inbox_pre' );
$json = new \stdClass(); $json = new \stdClass();

View file

@ -1,6 +1,8 @@
<?php <?php
namespace Activitypub\Rest; namespace Activitypub\Rest;
use WP_REST_Response;
use function Activitypub\get_rest_url_by_path; use function Activitypub\get_rest_url_by_path;
/** /**
@ -69,6 +71,11 @@ class Nodeinfo {
* @return WP_REST_Response * @return WP_REST_Response
*/ */
public static function nodeinfo( $request ) { public static function nodeinfo( $request ) {
/*
* Action triggerd prior to the ActivityPub profile being created and sent to the client
*/
\do_action( 'activitypub_rest_nodeinfo_pre' );
$nodeinfo = array(); $nodeinfo = array();
$nodeinfo['version'] = '2.0'; $nodeinfo['version'] = '2.0';
@ -108,7 +115,7 @@ class Nodeinfo {
'outbound' => array(), 'outbound' => array(),
); );
return new \WP_REST_Response( $nodeinfo, 200 ); return new WP_REST_Response( $nodeinfo, 200 );
} }
/** /**
@ -119,6 +126,11 @@ class Nodeinfo {
* @return WP_REST_Response * @return WP_REST_Response
*/ */
public static function nodeinfo2( $request ) { public static function nodeinfo2( $request ) {
/*
* Action triggerd prior to the ActivityPub profile being created and sent to the client
*/
\do_action( 'activitypub_rest_nodeinfo2_pre' );
$nodeinfo = array(); $nodeinfo = array();
$nodeinfo['version'] = '1.0'; $nodeinfo['version'] = '1.0';
@ -160,7 +172,7 @@ class Nodeinfo {
'outbound' => array(), 'outbound' => array(),
); );
return new \WP_REST_Response( $nodeinfo, 200 ); return new WP_REST_Response( $nodeinfo, 200 );
} }
/** /**

View file

@ -66,7 +66,7 @@ class Outbox {
/* /*
* Action triggerd prior to the ActivityPub profile being created and sent to the client * Action triggerd prior to the ActivityPub profile being created and sent to the client
*/ */
\do_action( 'activitypub_outbox_pre' ); \do_action( 'activitypub_rest_outbox_pre' );
$json = new stdClass(); $json = new stdClass();

View file

@ -66,7 +66,7 @@ class Users {
/* /*
* Action triggerd prior to the ActivityPub profile being created and sent to the client * Action triggerd prior to the ActivityPub profile being created and sent to the client
*/ */
\do_action( 'activitypub_outbox_pre' ); \do_action( 'activitypub_rest_users_pre' );
$user->set_context( $user->set_context(
Activity::CONTEXT Activity::CONTEXT

View file

@ -52,6 +52,11 @@ class Webfinger {
* @return WP_REST_Response The response object. * @return WP_REST_Response The response object.
*/ */
public static function webfinger( $request ) { public static function webfinger( $request ) {
/*
* Action triggerd prior to the ActivityPub profile being created and sent to the client
*/
\do_action( 'activitypub_rest_webfinger_pre' );
$resource = $request->get_param( 'resource' ); $resource = $request->get_param( 'resource' );
$response = self::get_profile( $resource ); $response = self::get_profile( $resource );