From fb5b6e4a1409a2f8de0b393fea184a2894fd2e0e Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 15 Sep 2018 07:37:34 +0000 Subject: [PATCH] New uri format for our posts that is AP compatible --- src/Model/Item.php | 8 +------- src/Protocol/Diaspora.php | 14 +++++--------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/Model/Item.php b/src/Model/Item.php index 9406df2ac..69a3783bb 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -2329,13 +2329,7 @@ class Item extends BaseObject $guid = System::createGUID(32); } - $hostname = self::getApp()->get_hostname(); - - $user = DBA::selectFirst('user', ['nickname'], ['uid' => $uid]); - - $uri = "urn:X-dfrn:" . $hostname . ':' . $user['nickname'] . ':' . $guid; - - return $uri; + return self::getApp()->get_baseurl() . '/object/' . $guid; } /** diff --git a/src/Protocol/Diaspora.php b/src/Protocol/Diaspora.php index 7af8dbd42..11a0e5996 100644 --- a/src/Protocol/Diaspora.php +++ b/src/Protocol/Diaspora.php @@ -1592,17 +1592,13 @@ class Diaspora if (DBA::isResult($item)) { return $item["uri"]; } elseif (!$onlyfound) { - $contact = Contact::getDetailsByAddr($author, 0); - if (!empty($contact['network'])) { - $prefix = 'urn:X-' . $contact['network'] . ':'; - } else { - // This fallback should happen most unlikely - $prefix = 'urn:X-dspr:'; - } + $person = self::personByHandle($author); - $author_parts = explode('@', $author); + $parts = parse_url($person['url']); + unset($parts['path']); + $host_url = Network::unparseURL($parts); - return $prefix . $author_parts[1] . ':' . $author_parts[0] . ':'. $guid; + return $host_url . '/object/' . $guid; } return "";