]> git.mxchange.org Git - friendica.git/blob - src/Protocol/ActivityPub/Receiver.php
48bfc0c8c855feb2013974bc1cd16d9070067654
[friendica.git] / src / Protocol / ActivityPub / Receiver.php
1 <?php
2 /**
3  * @file src/Protocol/ActivityPub/Receiver.php
4  */
5 namespace Friendica\Protocol\ActivityPub;
6
7 use Friendica\Database\DBA;
8 use Friendica\Util\HTTPSignature;
9 use Friendica\Core\Protocol;
10 use Friendica\Model\Contact;
11 use Friendica\Model\APContact;
12 use Friendica\Model\Item;
13 use Friendica\Model\User;
14 use Friendica\Util\JsonLD;
15 use Friendica\Util\LDSignature;
16 use Friendica\Protocol\ActivityPub;
17
18 /**
19  * @brief ActivityPub Receiver Protocol class
20  *
21  * To-Do:
22  * - Update (Image, Video, Article, Note)
23  * - Event
24  * - Undo Announce
25  *
26  * Check what this is meant to do:
27  * - Add
28  * - Block
29  * - Flag
30  * - Remove
31  * - Undo Block
32  * - Undo Accept (Problem: This could invert a contact accept or an event accept)
33  *
34  * General:
35  * - Possibly using the LD-JSON parser
36  */
37 class Receiver
38 {
39         const PUBLIC_COLLECTION = 'as:Public';
40         const ACCOUNT_TYPES = ['as:Person', 'as:Organization', 'as:Service', 'as:Group', 'as:Application'];
41         const CONTENT_TYPES = ['as:Note', 'as:Article', 'as:Video', 'as:Image'];
42         const ACTIVITY_TYPES = ['as:Like', 'as:Dislike', 'as:Accept', 'as:Reject', 'as:TentativeAccept'];
43
44         /**
45          * Checks if the web request is done for the AP protocol
46          *
47          * @return is it AP?
48          */
49         public static function isRequest()
50         {
51                 return stristr(defaults($_SERVER, 'HTTP_ACCEPT', ''), 'application/activity+json') ||
52                         stristr(defaults($_SERVER, 'HTTP_ACCEPT', ''), 'application/ld+json');
53         }
54
55         /**
56          * Checks incoming message from the inbox
57          *
58          * @param $body
59          * @param $header
60          * @param integer $uid User ID
61          */
62         public static function processInbox($body, $header, $uid)
63         {
64                 $http_signer = HTTPSignature::getSigner($body, $header);
65                 if (empty($http_signer)) {
66                         logger('Invalid HTTP signature, message will be discarded.', LOGGER_DEBUG);
67                         return;
68                 } else {
69                         logger('HTTP signature is signed by ' . $http_signer, LOGGER_DEBUG);
70                 }
71
72                 $activity = json_decode($body, true);
73
74                 if (empty($activity)) {
75                         logger('Invalid body.', LOGGER_DEBUG);
76                         return;
77                 }
78
79                 $ldactivity = JsonLD::compact($activity);
80
81                 $actor = JsonLD::fetchElement($ldactivity, 'as:actor');
82
83                 logger('Message for user ' . $uid . ' is from actor ' . $actor, LOGGER_DEBUG);
84
85                 if (LDSignature::isSigned($activity)) {
86                         $ld_signer = LDSignature::getSigner($activity);
87                         if (empty($ld_signer)) {
88                                 logger('Invalid JSON-LD signature from ' . $actor, LOGGER_DEBUG);
89                         }
90                         if (!empty($ld_signer && ($actor == $http_signer))) {
91                                 logger('The HTTP and the JSON-LD signature belong to ' . $ld_signer, LOGGER_DEBUG);
92                                 $trust_source = true;
93                         } elseif (!empty($ld_signer)) {
94                                 logger('JSON-LD signature is signed by ' . $ld_signer, LOGGER_DEBUG);
95                                 $trust_source = true;
96                         } elseif ($actor == $http_signer) {
97                                 logger('Bad JSON-LD signature, but HTTP signer fits the actor.', LOGGER_DEBUG);
98                                 $trust_source = true;
99                         } else {
100                                 logger('Invalid JSON-LD signature and the HTTP signer is different.', LOGGER_DEBUG);
101                                 $trust_source = false;
102                         }
103                 } elseif ($actor == $http_signer) {
104                         logger('Trusting post without JSON-LD signature, The actor fits the HTTP signer.', LOGGER_DEBUG);
105                         $trust_source = true;
106                 } else {
107                         logger('No JSON-LD signature, different actor.', LOGGER_DEBUG);
108                         $trust_source = false;
109                 }
110
111                 self::processActivity($activity, $ldactivity, $body, $uid, $trust_source);
112         }
113
114         /**
115          * 
116          *
117          * @param array $activity
118          * @param integer $uid User ID
119          * @param $trust_source
120          *
121          * @return 
122          */
123         private static function prepareObjectData($activity, $ldactivity, $uid, &$trust_source)
124         {
125                 $actor = JsonLD::fetchElement($ldactivity, 'as:actor');
126                 if (empty($actor)) {
127                         logger('Empty actor', LOGGER_DEBUG);
128                         return [];
129                 }
130
131                 $type = JsonLD::fetchElement($ldactivity, '@type');
132
133                 // Fetch all receivers from to, cc, bto and bcc
134                 $receivers = self::getReceivers($ldactivity, $actor);
135
136                 // When it is a delivery to a personal inbox we add that user to the receivers
137                 if (!empty($uid)) {
138                         $owner = User::getOwnerDataById($uid);
139                         $additional = ['uid:' . $uid => $uid];
140                         $receivers = array_merge($receivers, $additional);
141                 }
142
143                 logger('Receivers: ' . json_encode($receivers), LOGGER_DEBUG);
144
145                 $object_id = JsonLD::fetchElement($ldactivity, 'as:object');
146                 if (empty($object_id)) {
147                         logger('No object found', LOGGER_DEBUG);
148                         return [];
149                 }
150
151                 // Fetch the content only on activities where this matters
152                 if (in_array($type, ['as:Create', 'as:Announce'])) {
153                         $object_data = self::fetchObject($object_id, $activity['object'], $ldactivity['as:object'], $trust_source);
154                         if (empty($object_data)) {
155                                 logger("Object data couldn't be processed", LOGGER_DEBUG);
156                                 return [];
157                         }
158                         // We had been able to retrieve the object data - so we can trust the source
159                         $trust_source = true;
160                 } elseif (in_array($type, ['as:Like', 'as:Dislike'])) {
161                         // Create a mostly empty array out of the activity data (instead of the object).
162                         // This way we later don't have to check for the existence of ech individual array element.
163                         $object_data = self::processObject($ldactivity);
164                         $object_data['name'] = $type;
165                         $object_data['author'] = JsonLD::fetchElement($ldactivity, 'as:actor');
166                         $object_data['object'] = $object_id;
167                         $object_data['object_type'] = ''; // Since we don't fetch the object, we don't know the type
168                 } else {
169                         $object_data = [];
170                         $object_data['id'] = JsonLD::fetchElement($ldactivity, '@id');
171                         $object_data['object'] = $activity['object'];
172                         $object_data['object_type'] = JsonLD::fetchElement($ldactivity, 'as:object', '@type');
173                 }
174
175                 $object_data = self::addActivityFields($object_data, $activity);
176
177                 $object_data['type'] = $activity['type'];
178                 $object_data['owner'] = $actor;
179                 $object_data['receiver'] = array_merge(defaults($object_data, 'receiver', []), $receivers);
180
181                 logger('Processing ' . $object_data['type'] . ' ' . $object_data['object_type'] . ' ' . $object_data['id'], LOGGER_DEBUG);
182
183                 return $object_data;
184         }
185
186         /**
187          * 
188          *
189          * @param array $activity
190          * @param $body
191          * @param integer $uid User ID
192          * @param $trust_source
193          */
194         public static function processActivity($activity, $ldactivity = '', $body = '', $uid = null, $trust_source = false)
195         {
196                 if (empty($ldactivity)) {
197                         $ldactivity = JsonLD::compact($activity);
198                 }
199
200                 $type = JsonLD::fetchElement($ldactivity, '@type');
201                 if (!$type) {
202                         logger('Empty type', LOGGER_DEBUG);
203                         return;
204                 }
205
206                 if (!JsonLD::fetchElement($ldactivity, 'as:object')) {
207                         logger('Empty object', LOGGER_DEBUG);
208                         return;
209                 }
210
211                 if (!JsonLD::fetchElement($ldactivity, 'as:actor')) {
212                         logger('Empty actor', LOGGER_DEBUG);
213                         return;
214
215                 }
216
217                 // $trust_source is called by reference and is set to true if the content was retrieved successfully
218                 $object_data = self::prepareObjectData($activity, $ldactivity, $uid, $trust_source);
219                 if (empty($object_data)) {
220                         logger('No object data found', LOGGER_DEBUG);
221                         return;
222                 }
223
224                 if (!$trust_source) {
225                         logger('No trust for activity type "' . $type . '", so we quit now.', LOGGER_DEBUG);
226                         return;
227                 }
228
229                 switch ($type) {
230                         case 'as:Create':
231                         case 'as:Announce':
232                                 ActivityPub\Processor::createItem($object_data, $body);
233                                 break;
234
235                         case 'as:Like':
236                                 ActivityPub\Processor::likeItem($object_data, $body);
237                                 break;
238
239                         case 'as:Dislike':
240                                 ActivityPub\Processor::dislikeItem($object_data, $body);
241                                 break;
242
243                         case 'as:Update':
244                                 if (in_array($object_data['object_type'], self::CONTENT_TYPES)) {
245                                         /// @todo
246                                 } elseif (in_array($object_data['object_type'], self::ACCOUNT_TYPES)) {
247                                         ActivityPub\Processor::updatePerson($object_data, $body);
248                                 }
249                                 break;
250
251                         case 'as:Delete':
252                                 if ($object_data['object_type'] == 'as:Tombstone') {
253                                         ActivityPub\Processor::deleteItem($object_data, $body);
254                                 } elseif (in_array($object_data['object_type'], self::ACCOUNT_TYPES)) {
255                                         ActivityPub\Processor::deletePerson($object_data, $body);
256                                 }
257                                 break;
258
259                         case 'as:Follow':
260                                 ActivityPub\Processor::followUser($object_data);
261                                 break;
262
263                         case 'as:Accept':
264                                 if ($object_data['object_type'] == 'as:Follow') {
265                                         ActivityPub\Processor::acceptFollowUser($object_data);
266                                 }
267                                 break;
268
269                         case 'as:Reject':
270                                 if ($object_data['object_type'] == 'as:Follow') {
271                                         ActivityPub\Processor::rejectFollowUser($object_data);
272                                 }
273                                 break;
274
275                         case 'as:Undo':
276                                 if ($object_data['object_type'] == 'as:Follow') {
277                                         ActivityPub\Processor::undoFollowUser($object_data);
278                                 } elseif (in_array($object_data['object_type'], self::ACTIVITY_TYPES)) {
279                                         ActivityPub\Processor::undoActivity($object_data);
280                                 }
281                                 break;
282
283                         default:
284                                 logger('Unknown activity: ' . $type, LOGGER_DEBUG);
285                                 break;
286                 }
287         }
288
289         /**
290          * Fetch the receiver list from an activity array
291          *
292          * @param array $activity
293          * @param string $actor
294          *
295          * @return array with receivers (user id)
296          */
297         private static function getReceivers($activity, $actor)
298         {
299                 $receivers = [];
300
301                 // When it is an answer, we inherite the receivers from the parent
302                 $replyto = JsonLD::fetchElement($activity, 'as:inReplyTo');
303                 if (!empty($replyto)) {
304                         $parents = Item::select(['uid'], ['uri' => $replyto]);
305                         while ($parent = Item::fetch($parents)) {
306                                 $receivers['uid:' . $parent['uid']] = $parent['uid'];
307                         }
308                 }
309
310                 if (!empty($actor)) {
311                         $profile = APContact::getByURL($actor);
312                         $followers = defaults($profile, 'followers', '');
313
314                         logger('Actor: ' . $actor . ' - Followers: ' . $followers, LOGGER_DEBUG);
315                 } else {
316                         logger('Empty actor', LOGGER_DEBUG);
317                         $followers = '';
318                 }
319
320                 foreach (['as:to', 'as:cc', 'as:bto', 'as:bcc'] as $element) {
321                         $receiver_list = JsonLD::fetchElementArray($activity, $element);
322                         if (empty($receiver_list)) {
323                                 continue;
324                         }
325
326                         foreach ($receiver_list as $receiver) {
327                                 if ($receiver == self::PUBLIC_COLLECTION) {
328                                         $receivers['uid:0'] = 0;
329                                 }
330
331                                 if (($receiver == self::PUBLIC_COLLECTION) && !empty($actor)) {
332                                         // This will most likely catch all OStatus connections to Mastodon
333                                         $condition = ['alias' => [$actor, normalise_link($actor)], 'rel' => [Contact::SHARING, Contact::FRIEND]
334                                                 , 'archive' => false, 'pending' => false];
335                                         $contacts = DBA::select('contact', ['uid'], $condition);
336                                         while ($contact = DBA::fetch($contacts)) {
337                                                 if ($contact['uid'] != 0) {
338                                                         $receivers['uid:' . $contact['uid']] = $contact['uid'];
339                                                 }
340                                         }
341                                         DBA::close($contacts);
342                                 }
343
344                                 if (in_array($receiver, [$followers, self::PUBLIC_COLLECTION]) && !empty($actor)) {
345                                         $condition = ['nurl' => normalise_link($actor), 'rel' => [Contact::SHARING, Contact::FRIEND],
346                                                 'network' => Protocol::ACTIVITYPUB, 'archive' => false, 'pending' => false];
347                                         $contacts = DBA::select('contact', ['uid'], $condition);
348                                         while ($contact = DBA::fetch($contacts)) {
349                                                 if ($contact['uid'] != 0) {
350                                                         $receivers['uid:' . $contact['uid']] = $contact['uid'];
351                                                 }
352                                         }
353                                         DBA::close($contacts);
354                                         continue;
355                                 }
356
357                                 $condition = ['self' => true, 'nurl' => normalise_link($receiver)];
358                                 $contact = DBA::selectFirst('contact', ['uid'], $condition);
359                                 if (!DBA::isResult($contact)) {
360                                         continue;
361                                 }
362                                 $receivers['uid:' . $contact['uid']] = $contact['uid'];
363                         }
364                 }
365
366                 self::switchContacts($receivers, $actor);
367
368                 return $receivers;
369         }
370
371         /**
372          * Switches existing contacts to ActivityPub
373          *
374          * @param integer $cid Contact ID
375          * @param integer $uid User ID
376          * @param string $url Profile URL
377          */
378         private static function switchContact($cid, $uid, $url)
379         {
380                 $profile = ActivityPub::probeProfile($url);
381                 if (empty($profile)) {
382                         return;
383                 }
384
385                 logger('Switch contact ' . $cid . ' (' . $profile['url'] . ') for user ' . $uid . ' to ActivityPub');
386
387                 $photo = $profile['photo'];
388                 unset($profile['photo']);
389                 unset($profile['baseurl']);
390
391                 $profile['nurl'] = normalise_link($profile['url']);
392                 DBA::update('contact', $profile, ['id' => $cid]);
393
394                 Contact::updateAvatar($photo, $uid, $cid);
395
396                 // Send a new follow request to be sure that the connection still exists
397                 if (($uid != 0) && DBA::exists('contact', ['id' => $cid, 'rel' => [Contact::SHARING, Contact::FRIEND]])) {
398                         ActivityPub\Transmitter::sendActivity('Follow', $profile['url'], $uid);
399                         logger('Send a new follow request to ' . $profile['url'] . ' for user ' . $uid, LOGGER_DEBUG);
400                 }
401         }
402
403         /**
404          * 
405          *
406          * @param $receivers
407          * @param $actor
408          */
409         private static function switchContacts($receivers, $actor)
410         {
411                 if (empty($actor)) {
412                         return;
413                 }
414
415                 foreach ($receivers as $receiver) {
416                         $contact = DBA::selectFirst('contact', ['id'], ['uid' => $receiver, 'network' => Protocol::OSTATUS, 'nurl' => normalise_link($actor)]);
417                         if (DBA::isResult($contact)) {
418                                 self::switchContact($contact['id'], $receiver, $actor);
419                         }
420
421                         $contact = DBA::selectFirst('contact', ['id'], ['uid' => $receiver, 'network' => Protocol::OSTATUS, 'alias' => [normalise_link($actor), $actor]]);
422                         if (DBA::isResult($contact)) {
423                                 self::switchContact($contact['id'], $receiver, $actor);
424                         }
425                 }
426         }
427
428         /**
429          * 
430          *
431          * @param $object_data
432          * @param array $activity
433          *
434          * @return 
435          */
436         private static function addActivityFields($object_data, $activity)
437         {
438                 if (!empty($activity['published']) && empty($object_data['published'])) {
439                         $object_data['published'] = $activity['published'];
440                 }
441
442                 if (!empty($activity['updated']) && empty($object_data['updated'])) {
443                         $object_data['updated'] = $activity['updated'];
444                 }
445
446                 if (!empty($activity['diaspora:guid']) && empty($object_data['diaspora:guid'])) {
447                         $object_data['diaspora:guid'] = $activity['diaspora:guid'];
448                 }
449
450                 if (!empty($activity['inReplyTo']) && empty($object_data['parent-uri'])) {
451                         $object_data['parent-uri'] = JsonLD::fetchElement($activity, 'inReplyTo', 'id');
452                 }
453
454                 if (!empty($activity['instrument'])) {
455                         $object_data['service'] = JsonLD::fetchElement($activity, 'instrument', 'name', 'type', 'Service');
456                 }
457                 return $object_data;
458         }
459
460         /**
461          * 
462          *
463          * @param $object_id
464          * @param $object
465          * @param $trust_source
466          *
467          * @return array with object data
468          */
469         private static function fetchObject($object_id, $object = [], $ldobject = [], $trust_source = false)
470         {
471                 if (!$trust_source || is_string($object)) {
472                         $data = ActivityPub::fetchContent($object_id);
473                         if (empty($data)) {
474                                 logger('Empty content for ' . $object_id . ', check if content is available locally.', LOGGER_DEBUG);
475                                 $data = $object_id;
476                         } else {
477                                 $ldobject = JsonLD::compact($data);
478                                 logger('Fetched content for ' . $object_id, LOGGER_DEBUG);
479                         }
480                 } else {
481                         logger('Using original object for url ' . $object_id, LOGGER_DEBUG);
482                         $data = $object;
483                 }
484
485                 if (is_string($data)) {
486                         $item = Item::selectFirst([], ['uri' => $data]);
487                         if (!DBA::isResult($item)) {
488                                 logger('Object with url ' . $data . ' was not found locally.', LOGGER_DEBUG);
489                                 return false;
490                         }
491                         logger('Using already stored item for url ' . $object_id, LOGGER_DEBUG);
492                         $data = ActivityPub\Transmitter::createNote($item);
493                         $ldobject = JsonLD::compact($data);
494                 }
495
496                 if (empty($data['type'])) {
497                         logger('Empty type', LOGGER_DEBUG);
498                         return false;
499                 }
500
501                 if (in_array($data['type'], ActivityPub::CONTENT_TYPES)) {
502                         return self::processObject($ldobject);
503                 }
504
505                 if ($data['type'] == 'Announce') {
506                         if (empty($data['object'])) {
507                                 return false;
508                         }
509                         return self::fetchObject($data['object']);
510                 }
511
512                 logger('Unhandled object type: ' . $data['type'], LOGGER_DEBUG);
513         }
514
515         /**
516          * Convert tags from JSON-LD format into a simplified format
517          *
518          * @param array $tags Tags in JSON-LD format
519          *
520          * @return array with tags in a simplified format
521          */
522         private static function processTags($tags)
523         {
524                 $taglist = [];
525                 foreach ($tags as $tag) {
526                         $taglist[] = ['type' => str_replace('as:', '', JsonLD::fetchElement($tag, '@type')),
527                                 'href' => JsonLD::fetchElement($tag, 'as:href'),
528                                 'name' => JsonLD::fetchElement($tag, 'as:name')];
529                 }
530                 return $taglist;
531         }
532
533         /**
534          * Convert attachments from JSON-LD format into a simplified format
535          *
536          * @param array $attachments Attachments in JSON-LD format
537          *
538          * @return array with attachmants in a simplified format
539          */
540         private static function processAttachments($attachments)
541         {
542                 $attachlist = [];
543                 foreach ($attachments as $attachment) {
544                         $attachlist[] = ['type' => str_replace('as:', '', JsonLD::fetchElement($attachment, '@type')),
545                                 'mediaType' => JsonLD::fetchElement($attachment, 'as:mediaType'),
546                                 'name' => JsonLD::fetchElement($attachment, 'as:name'),
547                                 'url' => JsonLD::fetchElement($attachment, 'as:url')];
548                 }
549                 return $attachlist;
550         }
551
552         /**
553          * Fetches data from the object part of an activity
554          *
555          * @param array $object
556          *
557          * @return array
558          */
559         private static function processObject($object)
560         {
561                 if (!JsonLD::fetchElement($object, '@id')) {
562                         return false;
563                 }
564
565                 $object_data = [];
566                 $object_data['object_type'] = JsonLD::fetchElement($object, '@type');
567                 $object_data['id'] = JsonLD::fetchElement($object, '@id');
568
569                 $object_data['reply-to-id'] = JsonLD::fetchElement($object, 'as:inReplyTo');
570
571                 if (empty($object_data['reply-to-id'])) {
572                         $object_data['reply-to-id'] = $object_data['id'];
573                 }
574
575                 $object_data['published'] = JsonLD::fetchElement($object, 'as:published', '@value');
576                 $object_data['updated'] = JsonLD::fetchElement($object, 'as:updated', '@value');
577
578                 if (empty($object_data['updated'])) {
579                         $object_data['updated'] = $object_data['published'];
580                 }
581
582                 if (empty($object_data['published']) && !empty($object_data['updated'])) {
583                         $object_data['published'] = $object_data['updated'];
584                 }
585
586                 $actor = JsonLD::fetchElement($object, 'as:attributedTo');
587                 if (empty($actor)) {
588                         $actor = JsonLD::fetchElement($object, 'as:actor');
589                 }
590
591                 $object_data['diaspora:guid'] = JsonLD::fetchElement($object, 'diaspora:guid');
592                 $object_data['diaspora:comment'] = JsonLD::fetchElement($object, 'diaspora:comment');
593                 $object_data['owner'] = $object_data['author'] = $actor;
594                 $object_data['context'] = JsonLD::fetchElement($object, 'as:context');
595                 $object_data['conversation'] = JsonLD::fetchElement($object, 'ostatus:conversation');
596                 $object_data['sensitive'] = JsonLD::fetchElement($object, 'as:sensitive');
597                 $object_data['name'] = JsonLD::fetchElement($object, 'as:name');
598                 $object_data['summary'] = JsonLD::fetchElement($object, 'as:summary');
599                 $object_data['content'] = JsonLD::fetchElement($object, 'as:content');
600                 $object_data['source'] = JsonLD::fetchElement($object, 'as:source', 'as:content', 'as:mediaType', 'text/bbcode');
601                 $object_data['location'] = JsonLD::fetchElement($object, 'as:location', 'as:name', '@type', 'as:Place');
602                 $object_data['attachments'] = self::processAttachments(JsonLD::fetchElementArray($object, 'as:attachment'));
603                 $object_data['tags'] = self::processTags(JsonLD::fetchElementArray($object, 'as:tag'));
604 //              $object_data['service'] = JsonLD::fetchElement($object, 'instrument', 'name', 'type', 'Service'); // todo
605                 $object_data['service'] = null;
606                 $object_data['alternate-url'] = JsonLD::fetchElement($object, 'as:url');
607
608                 // Special treatment for Hubzilla links
609                 if (is_array($object_data['alternate-url'])) {
610                         if (!empty($object['as:url'])) {
611                                 $object_data['alternate-url'] = JsonLD::fetchElement($object['as:url'], 'as:href');
612                         } else {
613                                 $object_data['alternate-url'] = null;
614                         }
615                 }
616
617                 $object_data['receiver'] = self::getReceivers($object, $object_data['owner']);
618
619                 // Common object data:
620
621                 // Unhandled
622                 // @context, type, actor, signature, mediaType, duration, replies, icon
623
624                 // Also missing: (Defined in the standard, but currently unused)
625                 // audience, preview, endTime, startTime, generator, image
626
627                 // Data in Notes:
628
629                 // Unhandled
630                 // contentMap, announcement_count, announcements, context_id, likes, like_count
631                 // inReplyToStatusId, shares, quoteUrl, statusnetConversationId
632
633                 // Data in video:
634
635                 // To-Do?
636                 // category, licence, language, commentsEnabled
637
638                 // Unhandled
639                 // views, waitTranscoding, state, support, subtitleLanguage
640                 // likes, dislikes, shares, comments
641
642                 return $object_data;
643         }
644 }