diff options
-rw-r--r-- | Zotlabs/Daemon/Cron_daily.php | 2 | ||||
-rw-r--r-- | Zotlabs/Lib/ActivityStreams2.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Ap_probe.php | 33 | ||||
-rw-r--r-- | Zotlabs/Module/Channel.php | 4 | ||||
-rw-r--r-- | include/feedutils.php | 57 |
5 files changed, 79 insertions, 19 deletions
diff --git a/Zotlabs/Daemon/Cron_daily.php b/Zotlabs/Daemon/Cron_daily.php index 10e0e1d88..f0351fcdd 100644 --- a/Zotlabs/Daemon/Cron_daily.php +++ b/Zotlabs/Daemon/Cron_daily.php @@ -88,7 +88,7 @@ class Cron_daily { call_hooks('cron_daily',datetime_convert()); - set_config('system','last_expire_day',$d2); + set_config('system','last_expire_day',intval(datetime_convert('UTC','UTC','now','d'))); /** * End Cron Daily diff --git a/Zotlabs/Lib/ActivityStreams2.php b/Zotlabs/Lib/ActivityStreams2.php index 46852886b..904782bf7 100644 --- a/Zotlabs/Lib/ActivityStreams2.php +++ b/Zotlabs/Lib/ActivityStreams2.php @@ -43,7 +43,7 @@ class ActivityStreams2 { function fetch_property($url) { $redirects = 0; $x = z_fetch_url($url,true,$redirects, - ['headers' => [ 'Accept' => 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"']]); + ['headers' => [ 'Accept: application/ld+json; profile="https://www.w3.org/ns/activitystreams"']]); if($x['success']) return json_decode($x['body'],true); return null; diff --git a/Zotlabs/Module/Ap_probe.php b/Zotlabs/Module/Ap_probe.php new file mode 100644 index 000000000..4649914d5 --- /dev/null +++ b/Zotlabs/Module/Ap_probe.php @@ -0,0 +1,33 @@ +<?php +namespace Zotlabs\Module; + +require_once('include/zot.php'); + + +class Ap_probe extends \Zotlabs\Web\Controller { + + function get() { + + $o .= '<h3>ActivityPub Probe Diagnostic</h3>'; + + $o .= '<form action="ap_probe" method="get">'; + $o .= 'Lookup URI: <input type="text" style="width: 250px;" name="addr" value="' . $_GET['addr'] .'" />'; + $o .= '<input type="submit" name="submit" value="Submit" /></form>'; + + $o .= '<br /><br />'; + + if(x($_GET,'addr')) { + $addr = $_GET['addr']; + + $redirects = 0; + $x = z_fetch_url($addr,true,$redirects, + [ 'headers' => [ 'Accept: application/ld+json; profile="https://www.w3.org/ns/activitystreams"']]); +logger('fetch: ' . print_r($x,true)); + + if($x['success']) + $o .= '<pre>' . str_replace('\\','',jindent($x['body'])) . '</pre>'; + } + return $o; + } + +} diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php index 51c937270..98c1e1d61 100644 --- a/Zotlabs/Module/Channel.php +++ b/Zotlabs/Module/Channel.php @@ -236,9 +236,9 @@ class Channel extends \Zotlabs\Web\Controller { if($load || ($checkjs->disabled())) { if($mid) { - $r = q("SELECT parent AS item_id from item where mid = '%s' and uid = %d $item_normal + $r = q("SELECT parent AS item_id from item where mid like '%s' and uid = %d $item_normal AND item_wall = 1 $sql_extra limit 1", - dbesc($mid), + dbesc($mid . '%'), intval(\App::$profile['profile_uid']) ); if (! $r) { diff --git a/include/feedutils.php b/include/feedutils.php index 5f2a06029..daab1a741 100644 --- a/include/feedutils.php +++ b/include/feedutils.php @@ -1937,22 +1937,49 @@ function asencode_note($i) { function asencode_person($p) { - $ret = array(); - $ret['type'] = 'Person'; - $ret['id'] = $p['xchan_url']; - $ret['name'] = $p['xchan_name']; - $ret['image'] = array( - 'type' => 'Link', - 'mediaType' => $p['xchan_photo_mimetype'], - 'href' => $p['xchan_photo_l'], - 'height' => 300, - 'width' => 300 - ); - $ret['url'] = array( - 'type' => 'Link', + $ret = []; + $ret['type'] = 'Person'; + $ret['id'] = $p['xchan_url']; + $ret['name'] = $p['xchan_name']; + $ret['icon'] = [ + [ + 'type' => 'Image', + 'mediaType' => $p['xchan_photo_mimetype'], + 'url' => $p['xchan_photo_l'], + 'height' => 300, + 'width' => 300, + ], + [ + 'type' => 'Image', + 'mediaType' => $p['xchan_photo_mimetype'], + 'url' => $p['xchan_photo_m'], + 'height' => 80, + 'width' => 80, + ], + [ + 'type' => 'Image', + 'mediaType' => $p['xchan_photo_mimetype'], + 'url' => $p['xchan_photo_l'], + 'height' => 48, + 'width' => 48, + ] + ]; + $ret['url'] = [ + 'type' => 'Link', 'mediaType' => 'text/html', - 'href' => $p['xchan_url'] - ); + 'href' => $p['xchan_url'] + ]; + + if(array_key_exists('channel_id',$p)) { + $ret['inbox'] = z_root() . '/inbox/' . $p['channel_address']; + $ret['outbox'] = z_root() . '/outbox/' . $p['channel_address']; + } + else { + $collections = get_xconfig($p['xchan_hash'],'activitystreams','collections',[]); + if($collections) { + $ret = array_merge($ret,$collections); + } + } return $ret; } |