From e76d2201bf987aefe25ecd5f28937d197fef49e6 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 19 Sep 2018 22:44:22 -0700 Subject: [PATCH 1/7] better handling of media objects --- Zotlabs/Lib/Activity.php | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index e67eca22b..d5a472729 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -1152,7 +1152,7 @@ class Activity { static function create_action($channel,$observer_hash,$act) { - if(in_array($act->obj['type'], [ 'Note', 'Article', 'Video' ])) { + if(in_array($act->obj['type'], [ 'Note', 'Article', 'Video', 'Audio', 'Image' ])) { self::create_note($channel,$observer_hash,$act); } @@ -1170,7 +1170,7 @@ class Activity { static function like_action($channel,$observer_hash,$act) { - if(in_array($act->obj['type'], [ 'Note', 'Article', 'Video' ])) { + if(in_array($act->obj['type'], [ 'Note', 'Article', 'Video', 'Audio', 'Image' ])) { self::like_note($channel,$observer_hash,$act); } @@ -1407,8 +1407,6 @@ class Activity { $s['owner_xchan'] = $act->actor['id']; $s['author_xchan'] = $act->actor['id']; -// self::actor_store($act->actor['id'],$act->actor); - $s['mid'] = $act->obj['id']; $s['parent_mid'] = $act->parent_id; @@ -1526,6 +1524,37 @@ class Activity { } } + if($act->obj['type'] === 'Audio') { + + $atypes = [ + 'audio/mpeg', + 'audio/ogg', + 'audio/wav' + ]; + + if(array_key_exists('url',$act->obj) && is_array($act->obj['url'])) { + foreach($act->obj['url'] as $vurl) { + if(in_array($vurl['mimeType'], $atypes)) { + $s['body'] .= "\n\n" . '[audio]' . $vurl['href'] . '[/audio]'; + break; + } + } + } + } + + if($act->obj['type'] === 'Image') { + if(array_key_exists('url',$act->obj) && is_array($act->obj['url'])) { + foreach($act->obj['url'] as $vurl) { + if(strpos($s['body'],$vurl['href']) === false) { + $s['body'] .= "\n\n" . '[zmg]' . $vurl['href'] . '[/zmg]'; + break; + } + } + } + } + + + if($act->recips && (! in_array(ACTIVITY_PUBLIC_INBOX,$act->recips))) $s['item_private'] = 1; From 1a3d9ca91be8a7b752173334a6f2cc540492f15f Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 19 Sep 2018 23:53:26 -0700 Subject: [PATCH 2/7] better handling of masto approve --- Zotlabs/Daemon/Notifier.php | 5 +++++ Zotlabs/Lib/Activity.php | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php index 24dafc876..ff0cf3c24 100644 --- a/Zotlabs/Daemon/Notifier.php +++ b/Zotlabs/Daemon/Notifier.php @@ -167,15 +167,19 @@ class Notifier { $normal_mode = false; } elseif(in_array($cmd, [ 'permissions_update', 'permissions_reject', 'permissions_accept', 'permissions_create' ])) { + // Get the (single) recipient + $r = q("select * from abook left join xchan on abook_xchan = xchan_hash where abook_id = %d and abook_self = 0", intval($item_id) ); + if($r) { $uid = $r[0]['abook_channel']; // Get the sender self::$channel = channelx_by_n($uid); if(self::$channel) { + $perm_update = array('sender' => self::$channel, 'recipient' => $r[0], 'success' => false, 'deliveries' => ''); switch($cmd) { @@ -183,6 +187,7 @@ class Notifier { ActivityPub::permissions_create($perm_update); break; case 'permissions_accept': + ActivityPub::permissions_accept($perm_update); break; default: diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index d9e8630ce..7ac9d1821 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -842,7 +842,7 @@ class Activity { // We've already approved them or followed them first // Send an Accept back to them - set_abconfig($channel['channel_id'],$person_obj['id'],'pubcrawl','their_follow_id', $their_follow_id); + set_abconfig($channel['channel_id'],$person_obj['id'],'activitypub','their_follow_id', $their_follow_id); Master::Summon([ 'Notifier', 'permissions_accept', $contact['abook_id'] ]); return; @@ -883,7 +883,7 @@ class Activity { // From here on out we assume a Follow activity to somebody we have no existing relationship with - set_abconfig($channel['channel_id'],$person_obj['id'],'pubcrawl','their_follow_id', $their_follow_id); + set_abconfig($channel['channel_id'],$person_obj['id'],'activitypub','their_follow_id', $their_follow_id); // The xchan should have been created by actor_store() above From 6221d2b1bb3b492f7692367cd0b65942c693d011 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 20 Sep 2018 17:17:41 -0700 Subject: [PATCH 3/7] php warning --- Zotlabs/Lib/Activity.php | 2 +- Zotlabs/Module/Connections.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 7ac9d1821..fa1c55956 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -1019,7 +1019,7 @@ class Activity { // We may have been passed a cached entry. If it is, and the cache duration has expired // fetch a fresh copy before continuing. - if(array_key_exists($person_obj['cached']) && array_key_exists('updated',$person_obj) && $person_obj['updated'] < datetime_convert('UTC','UTC','now - ' . self::$ACTOR_CACHE_DAYS . ' days')) { + if(array_key_exists('cached',$person_obj) && array_key_exists('updated',$person_obj) && $person_obj['updated'] < datetime_convert('UTC','UTC','now - ' . self::$ACTOR_CACHE_DAYS . ' days')) { $person_obj = ActivityStreams::fetch($url); } diff --git a/Zotlabs/Module/Connections.php b/Zotlabs/Module/Connections.php index 5f1ca7cc7..0faf760ca 100644 --- a/Zotlabs/Module/Connections.php +++ b/Zotlabs/Module/Connections.php @@ -305,7 +305,7 @@ class Connections extends \Zotlabs\Web\Controller { 'recent_label' => t('Recent activity'), 'recentlink' => z_root() . '/network/?f=&cid=' . intval($rr['abook_id']), 'oneway' => $oneway, - 'allow_delete' => get_pconfig(local_channel(),'system','connections_quick_delete'), + 'allow_delete' => ($rr['abook_pending'] || get_pconfig(local_channel(),'system','connections_quick_delete')), ); } } From 382551e4b4063be77f987df7be376b47c6d82ef5 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 20 Sep 2018 22:50:12 -0700 Subject: [PATCH 4/7] strip bbcode from event titles --- Zotlabs/Module/Cal.php | 3 ++- Zotlabs/Module/Events.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Zotlabs/Module/Cal.php b/Zotlabs/Module/Cal.php index 192ee13d1..003d63c6d 100644 --- a/Zotlabs/Module/Cal.php +++ b/Zotlabs/Module/Cal.php @@ -5,7 +5,7 @@ require_once('include/conversation.php'); require_once('include/bbcode.php'); require_once('include/datetime.php'); require_once('include/event.php'); - +require_once('include/html2plain.php'); class Cal extends \Zotlabs\Web\Controller { @@ -293,6 +293,7 @@ class Cal extends \Zotlabs\Web\Controller { } $html = format_event_html($rr); $rr['desc'] = zidify_links(smilies(bbcode($rr['desc']))); + $rr['description'] = htmlentities(html2plain(bbcode($rr['description'])),ENT_COMPAT,'UTF-8',false); $rr['location'] = zidify_links(smilies(bbcode($rr['location']))); $events[] = array( 'id'=>$rr['id'], diff --git a/Zotlabs/Module/Events.php b/Zotlabs/Module/Events.php index 933c87532..3c28dfe4a 100644 --- a/Zotlabs/Module/Events.php +++ b/Zotlabs/Module/Events.php @@ -7,7 +7,7 @@ require_once('include/conversation.php'); require_once('include/bbcode.php'); require_once('include/datetime.php'); require_once('include/event.php'); - +require_once('include/html2plain.php'); class Events extends \Zotlabs\Web\Controller { @@ -642,6 +642,7 @@ class Events extends \Zotlabs\Web\Controller { } $html = format_event_html($rr); $rr['desc'] = zidify_links(smilies(bbcode($rr['desc']))); + $rr['description'] = htmlentities(html2plain(bbcode($rr['description'])),ENT_COMPAT,'UTF-8',false); $rr['location'] = zidify_links(smilies(bbcode($rr['location']))); $events[] = array( 'id'=>$rr['id'], From 54bfc4a88da9b33975cccecdca2df481adb3670f Mon Sep 17 00:00:00 2001 From: zotlabs Date: Fri, 21 Sep 2018 16:29:13 -0700 Subject: [PATCH 5/7] delivery issues --- Zotlabs/Lib/ActivityStreams.php | 4 ++++ Zotlabs/Lib/Queue.php | 2 +- Zotlabs/Lib/ThreadItem.php | 6 +++++- Zotlabs/Module/Directory.php | 4 ++-- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Zotlabs/Lib/ActivityStreams.php b/Zotlabs/Lib/ActivityStreams.php index b22b73e82..732593aaf 100644 --- a/Zotlabs/Lib/ActivityStreams.php +++ b/Zotlabs/Lib/ActivityStreams.php @@ -235,6 +235,10 @@ class ActivityStreams { $base = (($base) ? $base : $this->data); $propname = (($prefix) ? $prefix . ':' : '') . $property; + if(! is_array($base)) { + btlogger('not an array: ' . print_r($base,true)); + } + return ((array_key_exists($propname, $base)) ? $base[$propname] : null); } diff --git a/Zotlabs/Lib/Queue.php b/Zotlabs/Lib/Queue.php index 3b28066eb..5dc86602d 100644 --- a/Zotlabs/Lib/Queue.php +++ b/Zotlabs/Lib/Queue.php @@ -303,7 +303,7 @@ class Queue { $host_crypto = null; if($channel && $base) { - $h = q("select hubloc_sitekey, site_crypto from hubloc left join site on hubloc_url = site_url where site_url = '%s' order by hubloc_id desc limit 1", + $h = q("select hubloc_sitekey, site_crypto from hubloc left join site on hubloc_url = site_url where site_url = '%s' and hubloc_network = 'zot6' order by hubloc_id desc limit 1", dbesc($base) ); if($h) { diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php index eeb2666bb..bf814d69f 100644 --- a/Zotlabs/Lib/ThreadItem.php +++ b/Zotlabs/Lib/ThreadItem.php @@ -129,6 +129,10 @@ class ThreadItem { else $edpost = false; + if($item['verb'] === 'Announce') { + $edpost = false; + } + if($observer['xchan_hash'] == $this->get_data_value('author_xchan') || $observer['xchan_hash'] == $this->get_data_value('owner_xchan') @@ -497,7 +501,7 @@ class ThreadItem { } } - logger('authors: ' . print_r($result['authors'],true)); + //logger('authors: ' . print_r($result['authors'],true)); $result['private'] = $item['item_private']; $result['toplevel'] = ($this->is_toplevel() ? 'toplevel_item' : ''); diff --git a/Zotlabs/Module/Directory.php b/Zotlabs/Module/Directory.php index d23f0b1c3..1d48c536d 100644 --- a/Zotlabs/Module/Directory.php +++ b/Zotlabs/Module/Directory.php @@ -204,7 +204,7 @@ class Directory extends \Zotlabs\Web\Controller { logger('mod_directory: query: ' . $query); $x = z_fetch_url($query); - logger('directory: return from upstream: ' . print_r($x,true), LOGGER_DATA); + // logger('directory: return from upstream: ' . print_r($x,true), LOGGER_DATA); if($x['success']) { $t = 0; @@ -379,7 +379,7 @@ class Directory extends \Zotlabs\Web\Controller { \App::$data['directory_keywords'] = $j['keywords']; } - logger('mod_directory: entries: ' . print_r($entries,true), LOGGER_DATA); + // logger('mod_directory: entries: ' . print_r($entries,true), LOGGER_DATA); if($_REQUEST['aj']) { From f1ed64efe439af1191c9be4f30779e72a25e10b8 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 23 Sep 2018 17:03:10 -0700 Subject: [PATCH 6/7] fixes --- Zotlabs/Lib/Activity.php | 33 +++++++++++++++++++++++++++++---- Zotlabs/Lib/ActivityStreams.php | 8 ++++---- Zotlabs/Lib/Libsync.php | 4 ++-- doc/bugs.bb | 6 +++--- view/tpl/jot-header.tpl | 2 +- 5 files changed, 39 insertions(+), 14 deletions(-) diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index fa1c55956..544dd6f20 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -1050,11 +1050,36 @@ class Activity { $icon = z_root() . '/' . get_default_profile_photo(); } - if(is_array($person_obj['url']) && array_key_exists('href', $person_obj['url'])) - $profile = $person_obj['url']['href']; - else - $profile = $url; + $links = false; + $profile = false; + + if(is_array($person_obj['url'])) { + if(! array_key_exists(0,$person_obj['url'])) { + $links = [ $person_obj['url'] ]; + } + else { + $links = $person_obj['url']; + } + } + + if($links) { + foreach($links as $link) { + if(array_key_exists('mediaType',$link) && $link['mediaType'] === 'text/html') { + $profile = $link['href']; + } + } + if(! $profile) { + $profile = $links[0]['href']; + } + } + elseif(array_key_exists('url',$person_obj) && is_string($person_obj['url'])) { + $profile = $person_obj['url']; + } + + if(! $profile) { + $profile = $url; + } $inbox = $person_obj['inbox']; diff --git a/Zotlabs/Lib/ActivityStreams.php b/Zotlabs/Lib/ActivityStreams.php index 732593aaf..60f1ab36a 100644 --- a/Zotlabs/Lib/ActivityStreams.php +++ b/Zotlabs/Lib/ActivityStreams.php @@ -94,17 +94,17 @@ class ActivityStreams { } } - if($this->obj && $this->obj['actor']) + if($this->obj && is_array($this->obj) && $this->obj['actor']) $this->obj['actor'] = $this->get_actor('actor',$this->obj); - if($this->tgt && $this->tgt['actor']) + if($this->tgt && is_array($this->tgt) && $this->tgt['actor']) $this->tgt['actor'] = $this->get_actor('actor',$this->tgt); $this->parent_id = $this->get_property_obj('inReplyTo'); - if(! $this->parent_id) { + if((! $this->parent_id) && is_array($this->obj)) { $this->parent_id = $this->obj['inReplyTo']; } - if(! $this->parent_id) { + if((! $this->parent_id) && is_array($this->obj)) { $this->parent_id = $this->obj['id']; } } diff --git a/Zotlabs/Lib/Libsync.php b/Zotlabs/Lib/Libsync.php index 6ea857451..4a5dadb8e 100644 --- a/Zotlabs/Lib/Libsync.php +++ b/Zotlabs/Lib/Libsync.php @@ -49,7 +49,7 @@ class Libsync { if(intval($channel['channel_removed'])) return; - $h = q("select hubloc.*, site.site_crypto from hubloc left join site on site_url = hubloc_url where hubloc_hash = '%s' and hubloc_deleted = 0", + $h = q("select hubloc.*, site.site_crypto from hubloc left join site on site_url = hubloc_url where hubloc_hash = '%s' and hubloc_netwoor = 'zot6' and hubloc_deleted = 0", dbesc(($keychange) ? $packet['keychange']['old_hash'] : $channel['channel_hash']) ); @@ -195,7 +195,7 @@ class Libsync { $hashes = ids_to_querystr($l,'link',true); - $h = q("select hubloc.*, site.site_crypto from hubloc left join site on site_url = hubloc_url where hubloc_hash in (" . protect_sprintf($hashes) . ") and hubloc_deleted = 0"); + $h = q("select hubloc.*, site.site_crypto from hubloc left join site on site_url = hubloc_url where hubloc_hash in (" . protect_sprintf($hashes) . ") and hubloc_network = 'zot6' and hubloc_deleted = 0"); if(! $h) return; diff --git a/doc/bugs.bb b/doc/bugs.bb index f6e14b659..24a60a9d9 100644 --- a/doc/bugs.bb +++ b/doc/bugs.bb @@ -1,5 +1,5 @@ [h2]Bugs, Issues, and things that go bump in the night...[/h2] -[h3]Something went wrong! Who is charge of fixing it?[/h3] +[h3]Something went wrong! Who is in charge of fixing it?[/h3] [b]$Projectname Community Server[/b] @@ -21,9 +21,9 @@ If you get a blank white screen when doing something, this is almost always a co [h3]I'm stumped. I can't figure out what is wrong.[/h3] -At this point it might be worthwhile discussing the issue on one of the online forums. There may be several of these and some may be more suited to your spoken language. At this time, the 'Hubzilla Support' channel (support@gravizot.de) is the recommended forum for discussing bugs. +At this point it might be worthwhile discussing the issue on one of the online forums. There may be several of these and some may be more suited to your spoken language. -If community members with software engineering training/expertise can't help you right away, understand that they are volunteers and may have a lot of other work and demands on their time. At this point you need to file a bug report. You will need an account on github.com to do this. So register, and then visit https://framagit.org/hubzilla/core/issues . Create an issue here and provide all the same information that you provided online. Don't leave out anything. +If community members with software engineering training/expertise can't help you right away, understand that they are volunteers and may have a lot of other work and demands on their time. At this point you need to file a bug report. You will need an account on framagit.org to do this. So register, and then visit https://framagit.org/macgirvin/osada/issues . Create an issue here and provide all the same information that you provided online. Don't leave out anything. Then you wait. If it's a high profile issue, it may get fixed quickly. But nobody is in charge of fixing bugs. If it lingers without resolution, please spend some more time investigating the problem. Ask about anything you don't understand related to the behaviour. You will learn more about how the software works and quite possibly figure out why it isn't working now. Ultimately it is somebody in the community who is going to fix this and you are a member of the community; and this is how the open source process works. diff --git a/view/tpl/jot-header.tpl b/view/tpl/jot-header.tpl index 904b243e7..d8d380e42 100755 --- a/view/tpl/jot-header.tpl +++ b/view/tpl/jot-header.tpl @@ -215,8 +215,8 @@ var activeCommentText = ''; $('#like-rotator-' + id).show(); $.get('{{$baseurl}}/share/' + id, function(data) { $('#like-rotator-' + id).hide(); + notificationsUpdate(); }); - notificationsUpdate(); } From cd8150f20d20180cb0d904fd28e3ee9a487f6cc5 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 23 Sep 2018 18:23:28 -0700 Subject: [PATCH 7/7] push version --- Zotlabs/Lib/ActivityStreams.php | 1 + boot.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Zotlabs/Lib/ActivityStreams.php b/Zotlabs/Lib/ActivityStreams.php index 60f1ab36a..9c1aa90bb 100644 --- a/Zotlabs/Lib/ActivityStreams.php +++ b/Zotlabs/Lib/ActivityStreams.php @@ -237,6 +237,7 @@ class ActivityStreams { if(! is_array($base)) { btlogger('not an array: ' . print_r($base,true)); + return null; } return ((array_key_exists($propname, $base)) ? $base[$propname] : null); diff --git a/boot.php b/boot.php index 11b280e17..9c1c2002a 100755 --- a/boot.php +++ b/boot.php @@ -35,7 +35,7 @@ require_once('include/items.php'); define ( 'PLATFORM_NAME', 'osada' ); define ( 'PLATFORM_ARCHITECTURE', 'osada' ); -define ( 'STD_VERSION', '1.1' ); +define ( 'STD_VERSION', '1.2' ); define ( 'ZOT_REVISION', '6.0' ); define ( 'DB_UPDATE_VERSION', 1220 );