[ActivityPub][Explorer] Store remote's url properly
This commit is contained in:
parent
30f3e2c462
commit
53c46127c1
@ -58,6 +58,7 @@ class ActivitypubActor extends Entity
|
||||
private int $actor_id;
|
||||
private string $inbox_uri;
|
||||
private ?string $inbox_shared_uri = null;
|
||||
private string $url;
|
||||
private DateTimeInterface $created;
|
||||
private DateTimeInterface $modified;
|
||||
|
||||
@ -72,6 +73,17 @@ class ActivitypubActor extends Entity
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getUrl(): string
|
||||
{
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
public function setUrl(string $url): self
|
||||
{
|
||||
$this->url = $url;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getActorId(): int
|
||||
{
|
||||
return $this->actor_id;
|
||||
@ -229,6 +241,7 @@ class ActivitypubActor extends Entity
|
||||
'actor_id' => ['type' => 'int', 'not null' => true],
|
||||
'inbox_uri' => ['type' => 'text', 'not null' => true],
|
||||
'inbox_shared_uri' => ['type' => 'text'],
|
||||
'url' => ['type' => 'text'],
|
||||
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
|
||||
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
|
||||
],
|
||||
|
@ -238,7 +238,6 @@ class Explorer
|
||||
'fullname' => $res['name'] ?? null,
|
||||
'created' => new DateTime($res['published'] ?? 'now'),
|
||||
'bio' => isset($res['summary']) ? mb_substr(Security::sanitize($res['summary']), 0, 1000) : null,
|
||||
'homepage' => $res['url'],
|
||||
'is_local' => false,
|
||||
'modified' => new DateTime(),
|
||||
];
|
||||
@ -252,22 +251,21 @@ class Explorer
|
||||
DB::persist($actor);
|
||||
|
||||
// ActivityPub Actor
|
||||
$aprofile = new ActivitypubActor();
|
||||
$aprofile->setInboxUri($res['inbox']);
|
||||
$aprofile->setInboxSharedUri($res['endpoints']['sharedInbox'] ?? $res['inbox']);
|
||||
$aprofile->setUri($res['id']);
|
||||
$aprofile->setActorId($actor->getId());
|
||||
$aprofile->setCreated(new DateTime());
|
||||
$aprofile->setModified(new DateTime());
|
||||
$aprofile = ActivitypubActor::create([
|
||||
'inbox_uri' => $res['inbox'],
|
||||
'inbox_shared_uri' => $res['endpoints']['sharedInbox'],
|
||||
'uri' => $res['id'],
|
||||
'actor_id' => $actor->getId(),
|
||||
'url' => $res['url'] ?? null,
|
||||
]);
|
||||
|
||||
DB::persist($aprofile);
|
||||
|
||||
// Public Key
|
||||
$apRSA = new ActivitypubRsa();
|
||||
$apRSA->setActorId($actor->getID());
|
||||
$apRSA->setPublicKey($res['publicKey']['publicKeyPem']);
|
||||
$apRSA->setCreated(new DateTime());
|
||||
$apRSA->setModified(new DateTime());
|
||||
$apRSA = ActivitypubRsa::create([
|
||||
'actor_id' => $actor->getID(),
|
||||
'public_key' => $res['publicKey']['publicKeyPem'],
|
||||
]);
|
||||
|
||||
DB::persist($apRSA);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user