From 7269503af69fc422f0d1d30a1ad211d684f391ca Mon Sep 17 00:00:00 2001 From: Terence Eden Date: Fri, 16 Feb 2024 09:34:09 +0000 Subject: [PATCH] Minor tidy up --- index.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/index.php b/index.php index 606c21c..d7c9b01 100644 --- a/index.php +++ b/index.php @@ -73,8 +73,6 @@ // This runs the function of the path requested. !empty( $_GET["path"] ) ? $path = $_GET["path"] : die(); switch ($path) { - case "": - die(); case ".well-known/webfinger": webfinger(); case rawurldecode( $username ): @@ -256,7 +254,7 @@ curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, "POST" ); curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode($message) ); curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers ); - $response = curl_exec( $ch ); + curl_exec( $ch ); // Check for errors if( curl_errno( $ch ) ) { @@ -346,7 +344,7 @@ echo <<< HTML

-
+


@@ -392,6 +390,7 @@ HTML; ]; // Construct the Message + // The audience is public and it is sent to all followers $message = [ "@context" => "https://www.w3.org/ns/activitystreams", "id" => "https://{$server}/posts/{$guid}.json", @@ -427,6 +426,7 @@ HTML; // Each server needs its own cURL handle // Each POST to an inbox needs to be signed separately foreach ( $hosts as $host ) { + // TODO: Not every host uses /inbox $path = "/inbox"; // Get the signed headers @@ -436,8 +436,7 @@ HTML; $remoteServerUrl = "https://{$host}{$path}"; // POST the message and header to the requester's inbox - $ch = curl_init( $remoteServerUrl ); - + $ch = curl_init( $remoteServerUrl ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, "POST" ); curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode($message) );