Update AP Helpers

This commit is contained in:
Daniel Supernault 2019-03-05 19:52:12 -07:00
parent 490ab045ef
commit fdb95e35b8
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -293,6 +293,14 @@ class Helpers {
public static function profileFirstOrNew($url, $runJobs = false) public static function profileFirstOrNew($url, $runJobs = false)
{ {
$url = self::validateUrl($url);
$host = parse_url($url, PHP_URL_HOST);
$local = config('pixelfed.domain.app') == $host ? true : false;
if($local == true) {
$id = last(explode('/', $url));
return Profile::whereUsername($id)->firstOrFail();
}
$res = self::fetchProfileFromUrl($url); $res = self::fetchProfileFromUrl($url);
$domain = parse_url($res['id'], PHP_URL_HOST); $domain = parse_url($res['id'], PHP_URL_HOST);
$username = $res['preferredUsername']; $username = $res['preferredUsername'];