PluginProbe
ActivityPub / 9.2.1
ActivityPub v9.2.1
9.3.1 9.3.0 9.2.2 9.2.1 9.2.0 9.1.0 9.0.2 9.0.1 9.0.0 8.3.0 8.2.1 8.2.0 8.1.1 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.2.0 1.3.0 2.0.0 2.0.1 2.1.0 2.1.1 All 160 releases
← All changes | includes/rest/class-proxy-controller.php +2 -21 9.3.09.2.1 View file →
@@ -11,9 +11,8 @@
11 11 namespace Activitypub\Rest;
12 12
13 13 use Activitypub\Collection\Remote_Actors;
14 14 use Activitypub\Http;
15 -use Activitypub\OAuth\Scope;
16 15 use Activitypub\Webfinger;
17 16
18 17 /**
19 18 * Proxy Controller.
@@ -49,18 +48,9 @@
49 48 array(
50 49 array(
51 50 'methods' => \WP_REST_Server::CREATABLE,
52 51 'callback' => array( $this, 'create_item' ),
53 -
54 - /*
55 - * The Basic Profile puts `proxyUrl` under a read scope. The POST carries the
56 - * target URL, and what this persists is a local cache of the remote object
57 - * plus a rate-limit transient, not content attributed to the actor, so it is
58 - * not a write in the sense `write` grants.
59 - */
60 - 'permission_callback' => function ( $request ) {
61 - return $this->verify_authentication( $request, Scope::READ );
62 - },
52 + 'permission_callback' => array( $this, 'verify_authentication' ),
63 53 'args' => array(
64 54 'id' => array(
65 55 'description' => 'The remote ActivityPub object to fetch: an HTTPS URL or an acct identifier (`user@host`, `@user@host`, or `acct:user@host`).',
66 56 'type' => 'string',
@@ -195,21 +185,12 @@
195 185 */
196 186 $object = Http::get_remote_object( $url );
197 187
198 188 if ( \is_wp_error( $object ) ) {
199 - /*
200 - * Pass on a status the remote actually returned, so a caller can tell a missing object
201 - * from an unreachable host. `Http::get()` uses the response code as the error code;
202 - * this method's own rejections use a string code and stay a 502, because a document we
203 - * refused is not the caller's request being wrong.
204 - */
205 - $code = $object->get_error_code();
206 - $status = \is_numeric( $code ) ? (int) $code : 0;
207 -
208 189 return new \WP_Error(
209 190 'activitypub_fetch_failed',
210 191 \__( 'Failed to fetch the remote object.', 'activitypub' ),
211 - array( 'status' => $status ?: 502 )
192 + array( 'status' => 502 )
212 193 );
213 194 }
214 195
215 196 $response = new \WP_REST_Response( $object, 200 );