remove casts

after feedback from @akirk
This commit is contained in:
Matthias Pfefferle 2023-05-11 11:02:06 +02:00
parent fc1b89561e
commit f196047901
3 changed files with 3 additions and 5 deletions

View file

@ -75,7 +75,7 @@ function init() {
Rest\Webfinger::init(); Rest\Webfinger::init();
// load NodeInfo endpoints only if blog is public // load NodeInfo endpoints only if blog is public
if ( true === (bool) \get_option( 'blog_public', 1 ) ) { if ( \get_option( 'blog_public', 1 ) ) {
require_once \dirname( __FILE__ ) . '/includes/rest/class-nodeinfo.php'; require_once \dirname( __FILE__ ) . '/includes/rest/class-nodeinfo.php';
Rest\NodeInfo::init(); Rest\NodeInfo::init();
} }

View file

@ -78,8 +78,7 @@ class Activitypub {
\in_array( 'application/ld+json', $accept, true ) || \in_array( 'application/ld+json', $accept, true ) ||
\in_array( 'application/json', $accept, true ) \in_array( 'application/json', $accept, true )
) { ) {
$secure_mode = (bool) \get_option( 'activitypub_use_secure_mode', '0' ); if ( \get_option( 'activitypub_use_secure_mode', '0' ) ) {
if ( $secure_mode ) {
$verification = Signature::verify_http_signature( $_SERVER ); $verification = Signature::verify_http_signature( $_SERVER );
if ( \is_wp_error( $verification ) ) { if ( \is_wp_error( $verification ) ) {
// fallback as template_loader can't return http headers // fallback as template_loader can't return http headers

View file

@ -92,8 +92,7 @@ class Server {
} else { } else {
if ( '/activitypub/1.0/webfinger' !== $route ) { if ( '/activitypub/1.0/webfinger' !== $route ) {
// SecureMode/Authorized fetch. // SecureMode/Authorized fetch.
$secure_mode = (bool) \get_option( 'activitypub_use_secure_mode', '0' ); if ( \get_option( 'activitypub_use_secure_mode', '0' ) ) {
if ( $secure_mode ) {
$verified_request = Signature::verify_http_signature( $request ); $verified_request = Signature::verify_http_signature( $request );
if ( \is_wp_error( $verified_request ) ) { if ( \is_wp_error( $verified_request ) ) {
return $verified_request; return $verified_request;