mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 03:55:18 +00:00
render app for activitypub
This commit is contained in:
parent
b1524e69c7
commit
b6d236cb6e
4 changed files with 30 additions and 6 deletions
|
@ -676,7 +676,7 @@ class Activity {
|
|||
if ($num_bbtags) {
|
||||
|
||||
foreach ($bbtags as $t) {
|
||||
if((! $t[1]) || (in_array($t[1],['url','zrl','img','zmg','share']))) {
|
||||
if((! $t[1]) || (in_array($t[1],['url','zrl','img','zmg','share','app']))) {
|
||||
continue;
|
||||
}
|
||||
$convert_to_article = true;
|
||||
|
@ -791,9 +791,9 @@ class Activity {
|
|||
$ret['name'] = $i['title'];
|
||||
}
|
||||
if ($i['summary']) {
|
||||
$ret['summary'] = bbcode($i['summary'], [ 'export' => true ]);
|
||||
$ret['summary'] = bbcode($i['summary'], [ (($activitypub) ? 'activitypub' : 'export') => true ]);
|
||||
}
|
||||
$ret['content'] = bbcode($i['body'], [ 'export' => true ]);
|
||||
$ret['content'] = bbcode($i['body'], [ (($activitypub) ? 'activitypub' : 'export)' => true ]);
|
||||
$ret['source'] = [ 'content' => $i['body'], 'mediaType' => 'text/bbcode' ];
|
||||
if ($ret['summary']) {
|
||||
$ret['source']['summary'] = $i['summary'];
|
||||
|
|
|
@ -383,6 +383,12 @@ class Network extends Controller {
|
|||
}
|
||||
|
||||
if ($verb) {
|
||||
|
||||
// the presence of a leading dot in the verb determines
|
||||
// whether to match the type of activity or the child object.
|
||||
// The name 'verb' is a holdover from the earlier XML
|
||||
// ActivityStreams specification.
|
||||
|
||||
if (substr($verb,0,1) === '.') {
|
||||
$verb = substr($verb,1);
|
||||
$sql_extra .= sprintf(" AND item.obj_type like '%s' ",
|
||||
|
|
|
@ -558,7 +558,7 @@ class Channel {
|
|||
'$defloc' => array('defloc', t('Default post location'), $defloc, t('Optional geographical location to display on your posts')),
|
||||
'$allowloc' => array('allow_location', t('Obtain post location from your web browser or device'), ((get_pconfig(local_channel(),'system','use_browser_location')) ? 1 : ''), '', $yes_no),
|
||||
|
||||
'$adult' => array('adult', t('Adult content'), $adult_flag, t('This channel frequently or regularly publishes adult content. (Please tag any adult material and/or nudity with #NSFW)'), $yes_no),
|
||||
'$adult' => array('adult', t('Adult content'), $adult_flag, t('Enable to indicate if this channel frequently or regularly publishes adult content. (Please also tag any adult material and/or nudity with #NSFW)'), $yes_no),
|
||||
|
||||
'$h_prv' => t('Security and Privacy'),
|
||||
'$permissions_set' => $permissions_set,
|
||||
|
|
|
@ -276,6 +276,14 @@ function bb_parse_app($match) {
|
|||
}
|
||||
}
|
||||
|
||||
function bb_parse_app_ap($match) {
|
||||
|
||||
$app = Apps::app_decode($match[1]);
|
||||
if ($app) {
|
||||
$result = sprintf( t('(Embedded app \'%s\' could not be displayed).'), $app['name']);
|
||||
}
|
||||
}
|
||||
|
||||
function bb_svg($match) {
|
||||
|
||||
$params = str_replace(['<br>', '"'], [ '', '"'],$match[1]);
|
||||
|
@ -993,8 +1001,13 @@ function bbcode($Text, $options = []) {
|
|||
$cache = ((array_key_exists('cache',$options)) ? $options['cache'] : false);
|
||||
$newwin = ((array_key_exists('newwin',$options)) ? $options['newwin'] : true);
|
||||
$export = ((array_key_exists('export',$options)) ? $options['export'] : false);
|
||||
$activitypub = ((array_key_exists('activitypub',$options)) ? $options['activitypub'] : false);
|
||||
$censored = ((array_key_exists('censored',$options)) ? $options['censored'] : false);
|
||||
|
||||
if ($activitypub) {
|
||||
$export = true;
|
||||
}
|
||||
|
||||
$target = (($newwin) ? ' target="_blank" ' : '');
|
||||
|
||||
call_hooks('bbcode_filter', $Text);
|
||||
|
@ -1500,8 +1513,13 @@ function bbcode($Text, $options = []) {
|
|||
$Text = preg_replace_callback("/\[crypt (.*?)\](.*?)\[\/crypt\]/ism", 'bb_parse_crypt', $Text);
|
||||
}
|
||||
|
||||
if(strpos($Text,'[/app]') !== false) {
|
||||
$Text = preg_replace_callback("/\[app\](.*?)\[\/app\]/ism",'bb_parse_app', $Text);
|
||||
if (strpos($Text,'[/app]') !== false) {
|
||||
if ($activitypub) {
|
||||
$Text = preg_replace_callback("/\[app\](.*?)\[\/app\]/ism",'bb_parse_app_ap', $Text);
|
||||
}
|
||||
else {
|
||||
$Text = preg_replace_callback("/\[app\](.*?)\[\/app\]/ism",'bb_parse_app', $Text);
|
||||
}
|
||||
}
|
||||
|
||||
if(strpos($Text,'[/element]') !== false) {
|
||||
|
|
Loading…
Reference in a new issue