diff --git a/app/Util/ActivityPub/Helpers.php b/app/Util/ActivityPub/Helpers.php index b748598b3..ef13e7b70 100644 --- a/app/Util/ActivityPub/Helpers.php +++ b/app/Util/ActivityPub/Helpers.php @@ -131,6 +131,10 @@ class Helpers { public static function validateUrl($url) { + if(is_array($url)) { + $url = $url[0]; + } + $localhosts = [ '127.0.0.1', 'localhost', '::1' ]; @@ -433,6 +437,16 @@ class Helpers { // RemoteFollowImportRecent::dispatch($res, $profile); CreateAvatar::dispatch($profile); } + } else { + // Update info after 24 hours + if($profile->last_fetched_at == null || + $profile->last_fetched_at->lt(now()->subHours(24)) == true + ) { + $profile->name = isset($res['name']) ? Purify::clean($res['name']) : 'user'; + $profile->bio = isset($res['summary']) ? Purify::clean($res['summary']) : null; + $profile->last_fetched_at = now(); + $profile->save(); + } } return $profile; }