From c59b28a8c4e1af76a6b4ee3b8f8029e8d62b2a3a Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 22 Apr 2018 10:04:30 +0000 Subject: [PATCH] create public endpoint --- src/Protocol/DFRN.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Protocol/DFRN.php b/src/Protocol/DFRN.php index eb2822894..026328196 100644 --- a/src/Protocol/DFRN.php +++ b/src/Protocol/DFRN.php @@ -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");