mirror of
https://github.com/pixelfed/pixelfed.git
synced 2025-01-30 16:30:45 +00:00
Update AP Helpers
This commit is contained in:
parent
154a6444e2
commit
2147c215d2
1 changed files with 3 additions and 3 deletions
|
@ -281,11 +281,11 @@ class Helpers {
|
||||||
public static function profileFirstOrNew($url, $runJobs = false)
|
public static function profileFirstOrNew($url, $runJobs = false)
|
||||||
{
|
{
|
||||||
$res = self::fetchProfileFromUrl($url);
|
$res = self::fetchProfileFromUrl($url);
|
||||||
$domain = parse_url($res['url'], PHP_URL_HOST);
|
$domain = parse_url($res['id'], PHP_URL_HOST);
|
||||||
$username = $res['preferredUsername'];
|
$username = $res['preferredUsername'];
|
||||||
$remoteUsername = "@{$username}@{$domain}";
|
$remoteUsername = "@{$username}@{$domain}";
|
||||||
|
|
||||||
$profile = Profile::whereRemoteUrl($res['url'])->first();
|
$profile = Profile::whereRemoteUrl($res['id'])->first();
|
||||||
if(!$profile) {
|
if(!$profile) {
|
||||||
$profile = new Profile;
|
$profile = new Profile;
|
||||||
$profile->domain = $domain;
|
$profile->domain = $domain;
|
||||||
|
@ -295,7 +295,7 @@ class Helpers {
|
||||||
$profile->sharedInbox = isset($res['endpoints']) && isset($res['endpoints']['sharedInbox']) ? $res['endpoints']['sharedInbox'] : null;
|
$profile->sharedInbox = isset($res['endpoints']) && isset($res['endpoints']['sharedInbox']) ? $res['endpoints']['sharedInbox'] : null;
|
||||||
$profile->inbox_url = $res['inbox'];
|
$profile->inbox_url = $res['inbox'];
|
||||||
$profile->outbox_url = $res['outbox'];
|
$profile->outbox_url = $res['outbox'];
|
||||||
$profile->remote_url = $res['url'];
|
$profile->remote_url = $res['id'];
|
||||||
$profile->public_key = $res['publicKey']['publicKeyPem'];
|
$profile->public_key = $res['publicKey']['publicKeyPem'];
|
||||||
$profile->key_id = $res['publicKey']['id'];
|
$profile->key_id = $res['publicKey']['id'];
|
||||||
$profile->save();
|
$profile->save();
|
||||||
|
|
Loading…
Reference in a new issue