From 37ad4a7d22b2141f63df3a097035b1a8f0dd5b30 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 14 Oct 2018 17:57:44 +0000 Subject: [PATCH] ActivityPub: Rudimentary support for videos --- src/Protocol/ActivityPub/Processor.php | 5 +++++ src/Protocol/ActivityPub/Receiver.php | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Protocol/ActivityPub/Processor.php b/src/Protocol/ActivityPub/Processor.php index d77a0277fb..69b70249cc 100644 --- a/src/Protocol/ActivityPub/Processor.php +++ b/src/Protocol/ActivityPub/Processor.php @@ -211,6 +211,11 @@ class Processor $item['title'] = HTML::toBBCode($activity['name']); $item['content-warning'] = HTML::toBBCode($activity['summary']); $item['body'] = self::convertMentions(HTML::toBBCode($activity['content'])); + + if (($activity['object_type'] == 'as:Video') && !empty($activity['alternate-url'])) { + $item['body'] .= "\n[video]" . $activity['alternate-url'] . '[/video]'; + } + $item['location'] = $activity['location']; if (!empty($item['latitude']) && !empty($item['longitude'])) { diff --git a/src/Protocol/ActivityPub/Receiver.php b/src/Protocol/ActivityPub/Receiver.php index cde197b0c4..5a40306e61 100644 --- a/src/Protocol/ActivityPub/Receiver.php +++ b/src/Protocol/ActivityPub/Receiver.php @@ -698,10 +698,10 @@ class Receiver // Special treatment for Hubzilla links if (is_array($object_data['alternate-url'])) { - if (!empty($object['as:url'])) { + $object_data['alternate-url'] = JsonLD::fetchElement($object_data['alternate-url'], 'as:href'); + + if (!is_string($object_data['alternate-url'])) { $object_data['alternate-url'] = JsonLD::fetchElement($object['as:url'], 'as:href'); - } else { - $object_data['alternate-url'] = null; } }