support pixelfed Story activities

This commit is contained in:
Mike Macgirvin 2023-09-10 09:04:58 +10:00
parent 213a22c31a
commit b710c9127a
2 changed files with 11 additions and 4 deletions

View file

@ -1360,7 +1360,7 @@ class Activity
}
if ($activitypub && $has_images && $activity['type'] === 'Note') {
if ($activitypub && $has_images && in_array($activity['type'], ['Note', 'Story']) {
foreach ($images as $match) {
$img = [];
// handle Friendica/Hubzilla style img links with [img=$url]$alttext[/img]
@ -2976,6 +2976,13 @@ class Activity
} elseif ($act->objprop('expires')) {
$item['expires'] = datetime_convert('UTC', 'UTC', $act->obj['expires']);
}
// pixelfed stories
if (array_key_exists('expiresAt', $act->data) && $act->data['expiresAt']) {
$item['expires'] = datetime_convert('UTC', 'UTC', $act->data['expiresAt']);
} elseif ($act->objprop('expiresAt')) {
$item['expires'] = datetime_convert('UTC', 'UTC', $act->obj['expiresAt']);
}
if ($item['expires'] > NULL_DATE && $item['expires'] < datetime_convert()) {
// We shouldn't even be seeing this activity.
return false;
@ -3332,7 +3339,7 @@ class Activity
// Objects that might have media attachments which aren't already provided in the content element.
// We'll check specific media objects separately.
if (in_array($act->objprop('type',''), ['Article', 'Document', 'Event', 'Note', 'Page', 'Place', 'Question'])
if (in_array($act->objprop('type',''), ['Article', 'Document', 'Event', 'Note', 'Story', 'Page', 'Place', 'Question'])
&& isset($item['attach']) && $item['attach']) {
$item = self::bb_attach($item);
}
@ -3523,7 +3530,7 @@ class Activity
}
if (in_array($act->objprop('type'), ['Note', 'Article', 'Page'])) {
if (in_array($act->objprop('type'), ['Note', 'Story', 'Article', 'Page'])) {
$ptr = null;
if (array_key_exists('url', $act->obj)) {

View file

@ -1,7 +1,7 @@
Federation
==========
The ActivityPub implementation in this project strives to be compliant to the core spec where possible, while offering a range of services and features which normally aren't provided by ActivityPub projects.
The ActivityPub implementation in this software strives to be compliant to the core spec where possible, while offering a range of services and features which normally aren't provided by ActivityPub projects.
Supported activities: