mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-23 06:51:27 +00:00
Merge pull request #969 from pixelfed/frontend-ui-refactor
Update AP Helpers
This commit is contained in:
commit
e32368bd5c
1 changed files with 8 additions and 0 deletions
|
@ -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'];
|
||||||
|
|
Loading…
Reference in a new issue