From fdb95e35b87d20dff6ab67c3314a2b52f5712588 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 5 Mar 2019 19:52:12 -0700 Subject: [PATCH] Update AP Helpers --- app/Util/ActivityPub/Helpers.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/Util/ActivityPub/Helpers.php b/app/Util/ActivityPub/Helpers.php index 298bd68af..d3861bf05 100644 --- a/app/Util/ActivityPub/Helpers.php +++ b/app/Util/ActivityPub/Helpers.php @@ -293,6 +293,14 @@ class Helpers { 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); $domain = parse_url($res['id'], PHP_URL_HOST); $username = $res['preferredUsername'];