mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 21:35:13 +00:00
Merge branch 'dev' into release
This commit is contained in:
commit
1dfcc957ce
4 changed files with 9 additions and 8 deletions
|
@ -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);
|
||||
|
|
|
@ -222,7 +222,6 @@ class PhotoImagick extends PhotoDriver
|
|||
if (! $this->is_valid()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Clean it */
|
||||
$this->image = $this->image->deconstructImages();
|
||||
if ($animated) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)]);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue