merge-requests/5/head
Terence Eden 2024-02-16 09:34:09 +00:00
rodzic 51c71edf1e
commit 7269503af6
1 zmienionych plików z 5 dodań i 6 usunięć

Wyświetl plik

@ -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
<body>
<form action="/send" method="post" enctype="multipart/form-data">
<label for="content">Your message:</label><br>
<textarea id="content" name="content" rows="5" cols="32"></textarea><br>
<textarea id="content" name="content" rows="5" cols="32"></textarea><br>
<label for="password">Password</label><br>
<input type="password" name="password" id="password" size="32"><br>
<input type="submit" value="Post Message">
@ -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) );