mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-21 02:35:19 +00:00
Merge branch 'dev' into release
This commit is contained in:
commit
df7a3a80c4
3 changed files with 2221 additions and 2219 deletions
|
@ -578,6 +578,9 @@ class Activity
|
|||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert an item attach list to an ActivityStreams attachment array
|
||||
*/
|
||||
|
||||
public static function encode_attachment($item)
|
||||
{
|
||||
|
@ -588,10 +591,18 @@ class Activity
|
|||
$atts = ((is_array($item['attach'])) ? $item['attach'] : json_decode($item['attach'], true));
|
||||
if ($atts) {
|
||||
foreach ($atts as $att) {
|
||||
if (isset($att['type']) && strpos($att['type'], 'image')) {
|
||||
$ret[] = ['type' => 'Image', 'url' => $att['href']];
|
||||
if (isset($att['type']) && strpos($att['type'], 'image') !== false) {
|
||||
$ret[] = [
|
||||
'type' => 'Image',
|
||||
'url' => $arr['href'],
|
||||
'name' => ($arr['name']) ? $arr['name'] : '',
|
||||
];
|
||||
} else {
|
||||
$ret[] = ['type' => 'Link', 'mediaType' => isset($att['type']) ? $att['type'] : 'application/octet-stream', 'href' => isset($att['href']) ? $att['href'] : ''];
|
||||
$ret[] = [
|
||||
'type' => 'Link',
|
||||
'mediaType' => isset($att['type']) ? $att['type'] : 'application/octet-stream',
|
||||
'href' => isset($att['href']) ? $att['href'] : ''
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -599,7 +610,7 @@ class Activity
|
|||
if (array_key_exists('iconfig', $item) && is_array($item['iconfig'])) {
|
||||
foreach ($item['iconfig'] as $att) {
|
||||
if ($att['sharing']) {
|
||||
$ret[] = ['type' => 'PropertyValue', 'name' => 'zot.' . $att['cat'] . '.' . $att['k'], 'value' => unserialise($att['v'])];
|
||||
$ret[] = ['type' => 'PropertyValue', 'name' => 'nomad.' . $att['cat'] . '.' . $att['k'], 'value' => unserialise($att['v'])];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -623,7 +634,7 @@ class Activity
|
|||
if ($att['type'] === 'PropertyValue') {
|
||||
if (array_key_exists('name', $att) && $att['name']) {
|
||||
$key = explode('.', $att['name']);
|
||||
if (count($key) === 3 && $key[0] === 'zot') {
|
||||
if (count($key) === 3 && in_array($key[0], ['nomad', 'zot'])) {
|
||||
$entry['cat'] = $key[1];
|
||||
$entry['k'] = $key[2];
|
||||
$entry['v'] = $att['value'];
|
||||
|
@ -637,14 +648,17 @@ class Activity
|
|||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes and Activity object attachment structure to store in an item.
|
||||
*/
|
||||
|
||||
public static function decode_attachment($item)
|
||||
public static function decode_attachment($obj)
|
||||
{
|
||||
|
||||
$ret = [];
|
||||
|
||||
if (array_key_exists('attachment', $item) && is_array($item['attachment'])) {
|
||||
$ptr = $item['attachment'];
|
||||
if (array_key_exists('attachment', $obj) && is_array($obj['attachment'])) {
|
||||
$ptr = $obj['attachment'];
|
||||
if (!array_key_exists(0, $ptr)) {
|
||||
$ptr = [$ptr];
|
||||
}
|
||||
|
@ -667,8 +681,8 @@ class Activity
|
|||
$ret[] = $entry;
|
||||
}
|
||||
}
|
||||
} elseif (isset($item['attachment']) && is_string($item['attachment'])) {
|
||||
btlogger('not an array: ' . $item['attachment']);
|
||||
} elseif (isset($obj['attachment']) && is_string($obj['attachment'])) {
|
||||
btlogger('not an array: ' . $obj['attachment']);
|
||||
}
|
||||
|
||||
return $ret;
|
||||
|
@ -3346,7 +3360,7 @@ class Activity
|
|||
}
|
||||
|
||||
|
||||
set_iconfig($s, 'activitypub', 'rawmsg', $act->raw, 1);
|
||||
set_iconfig($s, 'activitypub', 'rawmsg', $act->raw, 0);
|
||||
|
||||
// Restrict html caching to ActivityPub senders.
|
||||
// Zot has dynamic content and this library is used by both.
|
||||
|
@ -3655,8 +3669,8 @@ class Activity
|
|||
}
|
||||
|
||||
if (tgroup_check($channel['channel_id'], $item) && (!$is_child_node)) {
|
||||
// for forum deliveries, make sure we keep a copy of the signed original
|
||||
set_iconfig($item, 'activitypub', 'rawmsg', $act->raw, 1);
|
||||
// for relayed deliveries, make sure we keep a copy of the signed original
|
||||
set_iconfig($item, 'activitypub', 'rawmsg', $act->raw, 0);
|
||||
logger('allowed: tgroup');
|
||||
$allowed = true;
|
||||
}
|
||||
|
@ -4071,7 +4085,7 @@ class Activity
|
|||
}
|
||||
}
|
||||
if (array_key_exists('type', $a) && stripos($a['type'], 'activity') !== false) {
|
||||
if (self::media_not_in_body($a['href'], $item['body'])) {
|
||||
if (self::share_not_in_body($item['body'])) {
|
||||
$item = self::get_quote($a['href'], $item);
|
||||
}
|
||||
}
|
||||
|
@ -4107,6 +4121,16 @@ class Activity
|
|||
return false;
|
||||
}
|
||||
|
||||
// check for the existence of existing media link in body
|
||||
|
||||
public static function share_not_in_body($body)
|
||||
{
|
||||
if (strpos($body, '[/share]') === false) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static function bb_content($content, $field)
|
||||
{
|
||||
|
|
4384
util/messages.po
4384
util/messages.po
File diff suppressed because it is too large
Load diff
|
@ -1,2 +1,2 @@
|
|||
<?php
|
||||
define ( 'STD_VERSION', '22.06.23' );
|
||||
define ( 'STD_VERSION', '22.06.24' );
|
||||
|
|
Loading…
Reference in a new issue