From fb22aeae71c3d391b32b96af58cb542af4612774 Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Fri, 18 Sep 2020 16:36:09 +0200 Subject: [PATCH] update to REST API changes (WP 5.5) --- includes/rest/class-followers.php | 7 ++++--- includes/rest/class-following.php | 7 ++++--- includes/rest/class-inbox.php | 14 ++++++++------ includes/rest/class-nodeinfo.php | 15 +++++++++------ includes/rest/class-ostatus.php | 5 +++-- includes/rest/class-outbox.php | 7 ++++--- includes/rest/class-webfinger.php | 7 ++++--- 7 files changed, 36 insertions(+), 26 deletions(-) diff --git a/includes/rest/class-followers.php b/includes/rest/class-followers.php index 2d3d9ea..05a7789 100644 --- a/includes/rest/class-followers.php +++ b/includes/rest/class-followers.php @@ -23,9 +23,10 @@ class Followers { \register_rest_route( 'activitypub/1.0', '/users/(?P\d+)/followers', array( array( - 'methods' => \WP_REST_Server::READABLE, - 'callback' => array( '\Activitypub\Rest\Followers', 'get' ), - 'args' => self::request_parameters(), + 'methods' => \WP_REST_Server::READABLE, + 'callback' => array( '\Activitypub\Rest\Followers', 'get' ), + 'args' => self::request_parameters(), + 'permission_callback' => '__return_true', ), ) ); diff --git a/includes/rest/class-following.php b/includes/rest/class-following.php index 4a39fc5..af48106 100644 --- a/includes/rest/class-following.php +++ b/includes/rest/class-following.php @@ -23,9 +23,10 @@ class Following { \register_rest_route( 'activitypub/1.0', '/users/(?P\d+)/following', array( array( - 'methods' => \WP_REST_Server::READABLE, - 'callback' => array( '\Activitypub\Rest\Following', 'get' ), - 'args' => self::request_parameters(), + 'methods' => \WP_REST_Server::READABLE, + 'callback' => array( '\Activitypub\Rest\Following', 'get' ), + 'args' => self::request_parameters(), + 'permission_callback' => '__return_true', ), ) ); diff --git a/includes/rest/class-inbox.php b/includes/rest/class-inbox.php index f51a68e..1834dab 100644 --- a/includes/rest/class-inbox.php +++ b/includes/rest/class-inbox.php @@ -29,9 +29,10 @@ class Inbox { \register_rest_route( 'activitypub/1.0', '/inbox', array( array( - 'methods' => \WP_REST_Server::EDITABLE, - 'callback' => array( '\Activitypub\Rest\Inbox', 'shared_inbox' ), - 'args' => self::shared_inbox_request_parameters(), + 'methods' => \WP_REST_Server::EDITABLE, + 'callback' => array( '\Activitypub\Rest\Inbox', 'shared_inbox' ), + 'args' => self::shared_inbox_request_parameters(), + 'permission_callback' => '__return_true', ), ) ); @@ -39,9 +40,10 @@ class Inbox { \register_rest_route( 'activitypub/1.0', '/users/(?P\d+)/inbox', array( array( - 'methods' => \WP_REST_Server::EDITABLE, - 'callback' => array( '\Activitypub\Rest\Inbox', 'user_inbox' ), - 'args' => self::user_inbox_request_parameters(), + 'methods' => \WP_REST_Server::EDITABLE, + 'callback' => array( '\Activitypub\Rest\Inbox', 'user_inbox' ), + 'args' => self::user_inbox_request_parameters(), + 'permission_callback' => '__return_true', ), ) ); diff --git a/includes/rest/class-nodeinfo.php b/includes/rest/class-nodeinfo.php index 5464e08..acbc6ab 100644 --- a/includes/rest/class-nodeinfo.php +++ b/includes/rest/class-nodeinfo.php @@ -25,8 +25,9 @@ class Nodeinfo { \register_rest_route( 'activitypub/1.0', '/nodeinfo/discovery', array( array( - 'methods' => \WP_REST_Server::READABLE, - 'callback' => array( '\Activitypub\Rest\Nodeinfo', 'discovery' ), + 'methods' => \WP_REST_Server::READABLE, + 'callback' => array( '\Activitypub\Rest\Nodeinfo', 'discovery' ), + 'permission_callback' => '__return_true', ), ) ); @@ -34,8 +35,9 @@ class Nodeinfo { \register_rest_route( 'activitypub/1.0', '/nodeinfo', array( array( - 'methods' => \WP_REST_Server::READABLE, - 'callback' => array( '\Activitypub\Rest\Nodeinfo', 'nodeinfo' ), + 'methods' => \WP_REST_Server::READABLE, + 'callback' => array( '\Activitypub\Rest\Nodeinfo', 'nodeinfo' ), + 'permission_callback' => '__return_true', ), ) ); @@ -43,8 +45,9 @@ class Nodeinfo { \register_rest_route( 'activitypub/1.0', '/nodeinfo2', array( array( - 'methods' => \WP_REST_Server::READABLE, - 'callback' => array( '\Activitypub\Rest\Nodeinfo', 'nodeinfo2' ), + 'methods' => \WP_REST_Server::READABLE, + 'callback' => array( '\Activitypub\Rest\Nodeinfo', 'nodeinfo2' ), + 'permission_callback' => '__return_true', ), ) ); diff --git a/includes/rest/class-ostatus.php b/includes/rest/class-ostatus.php index e04dbb5..4e4dda9 100644 --- a/includes/rest/class-ostatus.php +++ b/includes/rest/class-ostatus.php @@ -16,9 +16,10 @@ class Ostatus { \register_rest_route( 'activitypub/1.0', '/ostatus/remote-follow', array( array( - 'methods' => \WP_REST_Server::READABLE, - 'callback' => array( '\Activitypub\Rest\Ostatus', 'get' ), + 'methods' => \WP_REST_Server::READABLE, + 'callback' => array( '\Activitypub\Rest\Ostatus', 'get' ), // 'args' => self::request_parameters(), + 'permission_callback' => '__return_true', ), ) ); diff --git a/includes/rest/class-outbox.php b/includes/rest/class-outbox.php index 65cc3ba..5aa18f7 100644 --- a/includes/rest/class-outbox.php +++ b/includes/rest/class-outbox.php @@ -23,9 +23,10 @@ class Outbox { \register_rest_route( 'activitypub/1.0', '/users/(?P\d+)/outbox', array( array( - 'methods' => \WP_REST_Server::READABLE, - 'callback' => array( '\Activitypub\Rest\Outbox', 'user_outbox' ), - 'args' => self::request_parameters(), + 'methods' => \WP_REST_Server::READABLE, + 'callback' => array( '\Activitypub\Rest\Outbox', 'user_outbox' ), + 'args' => self::request_parameters(), + 'permission_callback' => '__return_true', ), ) ); diff --git a/includes/rest/class-webfinger.php b/includes/rest/class-webfinger.php index 2ffe759..b5d3e4c 100644 --- a/includes/rest/class-webfinger.php +++ b/includes/rest/class-webfinger.php @@ -24,9 +24,10 @@ class Webfinger { \register_rest_route( 'activitypub/1.0', '/webfinger', array( array( - 'methods' => \WP_REST_Server::READABLE, - 'callback' => array( '\Activitypub\Rest\Webfinger', 'webfinger' ), - 'args' => self::request_parameters(), + 'methods' => \WP_REST_Server::READABLE, + 'callback' => array( '\Activitypub\Rest\Webfinger', 'webfinger' ), + 'args' => self::request_parameters(), + 'permission_callback' => '__return_true', ), ) );