From 00e56ca112bda422e9e646ad7871b11228b5d615 Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Thu, 1 Jun 2023 11:17:08 +0200 Subject: [PATCH] always use is_activitypub_request to check if it is an AP request --- includes/class-activitypub.php | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/includes/class-activitypub.php b/includes/class-activitypub.php index 3b16213..e99bcab 100644 --- a/includes/class-activitypub.php +++ b/includes/class-activitypub.php @@ -88,27 +88,7 @@ class Activitypub { $json_template = ACTIVITYPUB_PLUGIN_DIR . '/templates/blog-json.php'; } - global $wp_query; - - if ( isset( $wp_query->query_vars['activitypub'] ) ) { - return $json_template; - } - - if ( ! isset( $_SERVER['HTTP_ACCEPT'] ) ) { - return $template; - } - - $accept_header = $_SERVER['HTTP_ACCEPT']; - // Accept header as an array. - $accept = \explode( ',', \trim( $accept_header ) ); - if ( - \stristr( $accept_header, 'application/activity+json' ) || - \stristr( $accept_header, 'application/ld+json' ) || - \in_array( 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"', $accept, true ) || - \in_array( 'application/activity+json', $accept, true ) || - \in_array( 'application/ld+json', $accept, true ) || - \in_array( 'application/json', $accept, true ) - ) { + if ( is_activitypub_request() ) { if ( ACTIVITYPUB_SECURE_MODE ) { $verification = Signature::verify_http_signature( $_SERVER ); if ( \is_wp_error( $verification ) ) {