diff --git a/Code/Module/Search.php b/Code/Module/Search.php index 73448a222..1e30177da 100644 --- a/Code/Module/Search.php +++ b/Code/Module/Search.php @@ -102,7 +102,7 @@ class Search extends Controller $j = Activity::fetch($search, $channel); if ($j) { if (isset($j['type']) && ActivityStreams::is_an_actor($j['type'])) { - Activity::actor_store($j['id'], $j); + Activity::actor_store($j['id'], $j, true); goaway(z_root() . '/directory' . '?f=1&navsearch=1&search=' . $search); } $AS = new ActivityStreams($j, null, true); diff --git a/Code/Photo/PhotoImagick.php b/Code/Photo/PhotoImagick.php index f006b71c9..127f9fc25 100644 --- a/Code/Photo/PhotoImagick.php +++ b/Code/Photo/PhotoImagick.php @@ -222,7 +222,6 @@ class PhotoImagick extends PhotoDriver if (! $this->is_valid()) { return false; } - /* Clean it */ $this->image = $this->image->deconstructImages(); if ($animated) { diff --git a/include/items.php b/include/items.php index a8292d347..6afb0cfbd 100644 --- a/include/items.php +++ b/include/items.php @@ -892,7 +892,7 @@ function import_author_activitypub($x) { if($r) { $ptr = null; foreach($r as $rv) { - if (strpos($rv['xchan_network'], 'zot') !== false) { + if (strpos($rv['xchan_network'], 'zot') !== false || strpos($rv['xchan_network'], 'nomad') !== false) { $ptr = $rv; } } diff --git a/include/photo_factory.php b/include/photo_factory.php index fbf1c7331..aea282baf 100644 --- a/include/photo_factory.php +++ b/include/photo_factory.php @@ -189,7 +189,7 @@ function delete_thing_photo($url, $ob_hash) /** * @brief Fetches a photo from external site and prepares its miniatures. * - * @param string $photo + * @param string $src * external URL to fetch base image * @param string $xchan * channel unique hash @@ -203,12 +203,14 @@ function delete_thing_photo($url, $ob_hash) * * \e string \b 3 => image type * * \e boolean \b 4 => TRUE if fetch failure */ -function import_remote_xchan_photo($photo, $xchan, $thing = false) +function import_remote_xchan_photo($src, $xchan, $thing = false) { $failure = []; $type = EMPTY_STR; + logger(sprintf('importing %s for %s', $src, $xchan), LOGGER_DEBUG); + $animated = get_config('system', 'animated_avatars', true); $path = Hashpath::path((($thing) ? $src . $xchan : $xchan), 'cache/xp', 2); @@ -243,6 +245,7 @@ function import_remote_xchan_photo($photo, $xchan, $thing = false) if ($result['success']) { $type = guess_image_type($src, $result['header']); if ((! $type) || strpos($type, 'image') === false) { + logger('fetching type from file', LOGGER_DEBUG); @file_put_contents('cache/' . $hash, $result['body']); $info = getimagesize('cache/' . $hash); @unlink('cache/' . $hash); @@ -271,7 +274,6 @@ function import_remote_xchan_photo($photo, $xchan, $thing = false) } else { $failure[] = 'No dimensions'; } - $p = [ 'xchan' => $xchan, 'resource_id' => $hash, @@ -281,7 +283,6 @@ function import_remote_xchan_photo($photo, $xchan, $thing = false) 'imgscale' => 4, 'edited' => $modified, ]; - $savepath = $path . '-' . $p['imgscale'] . (($thing) ? '.obj' : EMPTY_STR); $r = $img->saveImage($savepath, $animated); if ($r === false) { @@ -314,7 +315,7 @@ function import_remote_xchan_photo($photo, $xchan, $thing = false) $failure[] = $result['error']; $failure[] = print_array($result['debug']); } - + if ($failure) { logger('failed: ' . $photo); logger('failure: ' . print_r($failure,true), LOGGER_DEBUG); @@ -323,6 +324,7 @@ function import_remote_xchan_photo($photo, $xchan, $thing = false) unlink($path . '.log'); } + logger('cached photo: ' . $photo, LOGGER_DEBUG); return([$photo, $thumb, $micro, $type, ($failure ? true : false)]); }