]> git.mxchange.org Git - friendica.git/commitdiff
AP is enabled for all users
authorMichael <heluecht@pirati.ca>
Sat, 22 Sep 2018 23:49:27 +0000 (23:49 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 22 Sep 2018 23:49:27 +0000 (23:49 +0000)
mod/display.php
mod/follow.php
mod/profile.php
mod/xrd.php
src/Network/Probe.php
src/Protocol/ActivityPub.php

index 1b4508c18d96982251d01e9f4c939edcc3052bbe..ff98e689d38b2aac51274a2b0b1f80357b48e2b7 100644 (file)
@@ -79,7 +79,7 @@ function display_init(App $a)
 
        if (ActivityPub::isRequest()) {
                $wall_item = Item::selectFirst(['id', 'uid'], ['guid' => $item['guid'], 'wall' => true]);
-               if ($wall_item['uid'] == 180) {
+               if (DBA::isResult($wall_item)) {
                        $data = ActivityPub::createObjectFromItemID($wall_item['id']);
                        echo json_encode($data);
                        exit();
index 65028a70e007fb1d7f4c2e61c74cc921aa7e2840..627ab52033049065a9d737fdf8c725068215c121 100644 (file)
@@ -31,8 +31,7 @@ function follow_post(App $a)
        // This is just a precaution if maybe this page is called somewhere directly via POST
        $_SESSION['fastlane'] = $url;
 
-       $result = Contact::createFromProbe($uid, $url, true, Protocol::ACTIVITYPUB);
-//     $result = Contact::createFromProbe($uid, $url, true);
+       $result = Contact::createFromProbe($uid, $url, true);
 
        if ($result['success'] == false) {
                if ($result['message']) {
index a284e10f2d6ee69f401e6b47ba5b380b1f921981..0035ba26adc615b7532b27539fd474c5aa78d95c 100644 (file)
@@ -52,7 +52,7 @@ function profile_init(App $a)
 
        if (ActivityPub::isRequest()) {
                $user = DBA::selectFirst('user', ['uid'], ['nickname' => $which]);
-               if ($user['uid'] == 180) {
+               if (DBM::isResult($user)) {
                        $data = ActivityPub::profile($user['uid']);
                        echo json_encode($data);
                        exit();
index 87766ca26e5890d7d33605c82c29d70e517181be..6a5fdbbdb9257b78476789762bd99b5774fa25ab 100644 (file)
@@ -80,6 +80,7 @@ function xrd_json($a, $uri, $alias, $profile_url, $r)
                        ['rel' => NAMESPACE_DFRN, 'href' => $profile_url],
                        ['rel' => NAMESPACE_FEED, 'type' => 'application/atom+xml', 'href' => System::baseUrl().'/dfrn_poll/'.$r['nickname']],
                        ['rel' => 'http://webfinger.net/rel/profile-page', 'type' => 'text/html', 'href' => $profile_url],
+                       ['rel' => 'self', 'type' => 'application/activity+json', 'href' => $profile_url],
                        ['rel' => 'http://microformats.org/profile/hcard', 'type' => 'text/html', 'href' => System::baseUrl().'/hcard/'.$r['nickname']],
                        ['rel' => NAMESPACE_POCO, 'href' => System::baseUrl().'/poco/'.$r['nickname']],
                        ['rel' => 'http://webfinger.net/rel/avatar', 'type' => 'image/jpeg', 'href' => System::baseUrl().'/photo/profile/'.$r['uid'].'.jpg'],
@@ -92,9 +93,6 @@ function xrd_json($a, $uri, $alias, $profile_url, $r)
                        ['rel' => 'http://purl.org/openwebauth/v1', 'type' => 'application/x-dfrn+json', 'href' => System::baseUrl().'/owa']
                ]
        ];
-       if ($r['uid'] == 180) {
-               $json['links'][] = ['rel' => 'self', 'type' => 'application/activity+json', 'href' => $profile_url];
-       }
 
        echo json_encode($json);
        killme();
index c0c627bfe911e01d07b32b585402a27132f9ed46..b19f34b7625c241e273c8f897c5adaa22f829f79 100644 (file)
@@ -335,8 +335,9 @@ class Probe
                        $data = null;
                }
 
-               if (in_array(defaults($data, 'network', ''), ['', Protocol::PHANTOM])) {
-                       $ap_profile = ActivityPub::probeProfile($uri);
+               $ap_profile = ActivityPub::probeProfile($uri);
+
+               if (!empty($ap_profile) && (defaults($data, 'network', '') != Protocol::DFRN)) {
                        if (!empty($ap_profile) && ($ap_profile['network'] == Protocol::ACTIVITYPUB)) {
                                $data = $ap_profile;
                        }
index 6c46da553df745b97bb3ea35c5ac720034cf1fcf..415d714d9a32276eacab26ee19524b28ba525e84 100644 (file)
@@ -332,9 +332,9 @@ class ActivityPub
                }
 
                $data = ['@context' => ['https://www.w3.org/ns/activitystreams', 'https://w3id.org/security/v1',
-                       ['ostatus' => 'http://ostatus.org#', 'sensitive' => 'as:sensitive',
-                       'Hashtag' => 'as:Hashtag', 'atomUri' => 'ostatus:atomUri',
-                       'conversation' => 'ostatus:conversation',
+                       ['ostatus' => 'http://ostatus.org#', 'uuid' => 'http://schema.org/identifier',
+                       'sensitive' => 'as:sensitive', 'Hashtag' => 'as:Hashtag',
+                       'atomUri' => 'ostatus:atomUri', 'conversation' => 'ostatus:conversation',
                        'inReplyToAtomUri' => 'ostatus:inReplyToAtomUri']]];
 
                $data['id'] = $item['uri'] . '#activity';
@@ -372,9 +372,9 @@ class ActivityPub
                }
 
                $data = ['@context' => ['https://www.w3.org/ns/activitystreams', 'https://w3id.org/security/v1',
-                       ['ostatus' => 'http://ostatus.org#', 'sensitive' => 'as:sensitive',
-                       'Hashtag' => 'as:Hashtag', 'atomUri' => 'ostatus:atomUri',
-                       'conversation' => 'ostatus:conversation',
+                       ['ostatus' => 'http://ostatus.org#', 'uuid' => 'http://schema.org/identifier',
+                       'sensitive' => 'as:sensitive', 'Hashtag' => 'as:Hashtag',
+                       'atomUri' => 'ostatus:atomUri', 'conversation' => 'ostatus:conversation',
                        'inReplyToAtomUri' => 'ostatus:inReplyToAtomUri']]];
 
                $data = array_merge($data, self::CreateNote($item));
@@ -433,6 +433,7 @@ class ActivityPub
                        $data['inReplyTo'] = null;
                }
 
+               $data['uuid'] = $item['guid'];
                $data['published'] = DateTimeFormat::utc($item["created"]."+00:00", DateTimeFormat::ATOM);
 
                if ($item["created"] != $item["edited"]) {