mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 00:03:16 +00:00
Update AP Helpers, update bio + name
This commit is contained in:
parent
5c44354880
commit
4bee8397e0
1 changed files with 14 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue