1
0
Fork 0

Update AP Helpers

This commit is contained in:
Daniel Supernault 2018-12-24 21:29:16 -07:00
parent 154a6444e2
commit 2147c215d2
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7
1 changed files with 3 additions and 3 deletions

View File

@ -281,11 +281,11 @@ class Helpers {
public static function profileFirstOrNew($url, $runJobs = false)
{
$res = self::fetchProfileFromUrl($url);
$domain = parse_url($res['url'], PHP_URL_HOST);
$domain = parse_url($res['id'], PHP_URL_HOST);
$username = $res['preferredUsername'];
$remoteUsername = "@{$username}@{$domain}";
$profile = Profile::whereRemoteUrl($res['url'])->first();
$profile = Profile::whereRemoteUrl($res['id'])->first();
if(!$profile) {
$profile = new Profile;
$profile->domain = $domain;
@ -295,7 +295,7 @@ class Helpers {
$profile->sharedInbox = isset($res['endpoints']) && isset($res['endpoints']['sharedInbox']) ? $res['endpoints']['sharedInbox'] : null;
$profile->inbox_url = $res['inbox'];
$profile->outbox_url = $res['outbox'];
$profile->remote_url = $res['url'];
$profile->remote_url = $res['id'];
$profile->public_key = $res['publicKey']['publicKeyPem'];
$profile->key_id = $res['publicKey']['id'];
$profile->save();