]> git.mxchange.org Git - friendica.git/commitdiff
New uri format for our posts that is AP compatible
authorMichael <heluecht@pirati.ca>
Sat, 15 Sep 2018 07:37:34 +0000 (07:37 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 15 Sep 2018 07:37:34 +0000 (07:37 +0000)
src/Model/Item.php
src/Protocol/Diaspora.php

index 9406df2ac86896d9e9cb2709f3d15c739e23f8c6..69a3783bbdfa85fd80009c434603dda9a2a29d51 100644 (file)
@@ -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;
        }
 
        /**
index 7af8dbd424dc6063088552a4c5756fad4ba3df0b..11a0e5996e983e8a31bb77cd45a8259149419a96 100644 (file)
@@ -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 "";