]> git.mxchange.org Git - friendica.git/commitdiff
Several fixes
authorMichael <heluecht@pirati.ca>
Sun, 7 Oct 2018 19:42:04 +0000 (19:42 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 7 Oct 2018 19:42:04 +0000 (19:42 +0000)
src/Module/Inbox.php
src/Protocol/ActivityPub.php
src/Protocol/ActivityPub/Processor.php
src/Protocol/ActivityPub/Receiver.php

index 3b845074d25218367e118ccbb8c53502cfae6792..c190be4d1f285c0af1f48d412b10039bc186e7ef 100644 (file)
@@ -26,7 +26,7 @@ class Inbox extends BaseModule
                }
 
 // Enable for test purposes
-
+/*
                if (HTTPSignature::getSigner($postdata, $_SERVER)) {
                        $filename = 'signed-activitypub';
                } else {
@@ -37,7 +37,7 @@ class Inbox extends BaseModule
                file_put_contents($tempfile, json_encode(['argv' => $a->argv, 'header' => $_SERVER, 'body' => $postdata], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
 
                logger('Incoming message stored under ' . $tempfile);
-
+*/
                if (!empty($a->argv[1])) {
                        $user = DBA::selectFirst('user', ['uid'], ['nickname' => $a->argv[1]]);
                        if (!DBA::isResult($user)) {
index b1680178e3aaf17b2d639f1a45cecc170c05d7d8..b4668e9154d46ef4e6f7ee6245f248bcdd84e21d 100644 (file)
@@ -39,8 +39,6 @@ class ActivityPub
                'manuallyApprovesFollowers' => 'as:manuallyApprovesFollowers',
                'sensitive' => 'as:sensitive', 'Hashtag' => 'as:Hashtag']];
        const ACCOUNT_TYPES = ['Person', 'Organization', 'Service', 'Group', 'Application'];
-       const CONTENT_TYPES = ['Note', 'Article', 'Video', 'Image'];
-       const ACTIVITY_TYPES = ['Like', 'Dislike', 'Accept', 'Reject', 'TentativeAccept'];
        /**
         * Checks if the web request is done for the AP protocol
         *
index 7d181234fe6d8b99e1396fe50416c1591cc7da42..32cfcc6cb0346f1674159b4b51b20f69ba031a84 100644 (file)
@@ -272,7 +272,7 @@ class Processor
         */
        public static function followUser($activity)
        {
-               $uid = User::getIdForURL($activity['object_actor']);
+               $uid = User::getIdForURL($activity['object_id']);
                if (empty($uid)) {
                        return;
                }
@@ -326,12 +326,12 @@ class Processor
         */
        public static function deletePerson($activity)
        {
-               if (empty($activity['object_id']) || empty($activity['object_actor'])) {
+               if (empty($activity['object_id']) || empty($activity['actor'])) {
                        logger('Empty object id or actor.', LOGGER_DEBUG);
                        return;
                }
 
-               if ($activity['object_id'] != $activity['object_actor']) {
+               if ($activity['object_id'] != $activity['actor']) {
                        logger('Object id does not match actor.', LOGGER_DEBUG);
                        return;
                }
index ba6cd52ba3acfb52896ae356d9be2e7d55a3dbe7..ac66aeb6ece98ab5d67b69250f96a8927e334371 100644 (file)
@@ -166,7 +166,7 @@ class Receiver
                        $object_data = self::processObject($activity);
                        $object_data['name'] = $type;
                        $object_data['author'] = JsonLD::fetchElement($activity, 'as:actor');
-                       $object_data['object'] = $object_id;
+                       $object_data['object_id'] = $object_id;
                        $object_data['object_type'] = ''; // Since we don't fetch the object, we don't know the type
                } else {
                        $object_data = [];