]> git.mxchange.org Git - friendica.git/commitdiff
create public endpoint
authorMichael <heluecht@pirati.ca>
Sun, 22 Apr 2018 10:04:30 +0000 (10:04 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 22 Apr 2018 10:04:30 +0000 (10:04 +0000)
src/Protocol/DFRN.php

index eb2822894242a4f3cb369ebc22f79962b7547b32..02632819685b49a69e0876b6116b1d529203e32d 100644 (file)
@@ -1415,7 +1415,16 @@ class DFRN
 
                $envelope = Diaspora::buildMessage($atom, $owner, $contact, $owner['uprvkey'], $fcontact['pubkey'], $public_batch);
 
-               $dest_url = ($public_batch ? $fcontact["batch"] : $contact["notify"]);
+               // Create the endpoint for public posts. This is some WIP and should later be added to the probing
+               if ($public_batch && empty($contact["batch"])) {
+                       $parts = parse_url($contact["notify"]);
+                       $path_parts = explode('/', $parts['path']);
+                       array_pop($path_parts);
+                       $parts['path'] =  implode('/', $path_parts);
+                       $contact["batch"] = Network::unparseURL($parts);
+               }
+
+               $dest_url = ($public_batch ? $contact["batch"] : $contact["notify"]);
 
                $content_type = ($public_batch ? "application/magic-envelope+xml" : "application/json");