[PLUGIN][ActivityPub] Federate out Service information in Activities

This commit is contained in:
Diogo Peralta Cordeiro 2022-03-28 21:19:34 +01:00
parent 83599ef866
commit dfc5918c2c
No known key found for this signature in database
GPG Key ID: 18D2D35001FBFAB0
2 changed files with 8 additions and 3 deletions

View File

@ -30,6 +30,7 @@ namespace Plugin\ActivityPub\Util;
use App\Entity\Actor; use App\Entity\Actor;
use DateTime; use DateTime;
use Exception; use Exception;
use Plugin\ActivityPub\ActivityPub;
use Plugin\ActivityPub\Entity\ActivitypubRsa; use Plugin\ActivityPub\Entity\ActivitypubRsa;
class HTTPSignature class HTTPSignature
@ -91,7 +92,7 @@ class HTTPSignature
'Date' => $date->format('D, d M Y H:i:s \G\M\T'), 'Date' => $date->format('D, d M Y H:i:s \G\M\T'),
'Host' => parse_url($url, \PHP_URL_HOST), 'Host' => parse_url($url, \PHP_URL_HOST),
'Accept' => 'application/ld+json; profile="https://www.w3.org/ns/activitystreams", application/activity+json, application/json', 'Accept' => 'application/ld+json; profile="https://www.w3.org/ns/activitystreams", application/activity+json, application/json',
'User-Agent' => 'GNU social ActivityPub Plugin - ' . GNUSOCIAL_ENGINE_URL, 'User-Agent' => 'GNU social ActivityPub Plugin - v' . ActivityPub::version() . ' - ' . GNUSOCIAL_ENGINE_URL,
'Content-Type' => 'application/activity+json', 'Content-Type' => 'application/activity+json',
]; ];

View File

@ -175,8 +175,12 @@ class Activity extends Model
} }
$attr = [ $attr = [
'type' => $gs_verb_to_activity_streams_two_verb, 'type' => $gs_verb_to_activity_streams_two_verb,
'@context' => ActivityPub::$activity_streams_two_context, '@context' => ActivityPub::$activity_streams_two_context,
'instrument' => Type::create('Service', [
'name' => 'GNU social ActivityPub Plugin - v' . ActivityPub::version(),
'url' => GNUSOCIAL_ENGINE_URL,
]),
'id' => Router::url('activity_view', ['id' => $object->getId()], Router::ABSOLUTE_URL), 'id' => Router::url('activity_view', ['id' => $object->getId()], Router::ABSOLUTE_URL),
'published' => $object->getCreated()->format(DateTimeInterface::RFC3339), 'published' => $object->getCreated()->format(DateTimeInterface::RFC3339),
'actor' => $object->getActor()->getUri(Router::ABSOLUTE_URL), 'actor' => $object->getActor()->getUri(Router::ABSOLUTE_URL),