From 58907143070e67ccb246b7dc4756ec47d58d9dd1 Mon Sep 17 00:00:00 2001 From: Maxence Lange Date: Tue, 15 Jan 2019 09:35:06 -0100 Subject: [PATCH] add w3 @context in actor Signed-off-by: Maxence Lange --- lib/Controller/ActivityPubController.php | 3 +-- lib/Model/ActivityPub/ACore.php | 23 ++++++++++++++++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/lib/Controller/ActivityPubController.php b/lib/Controller/ActivityPubController.php index 30f12454..e4915d45 100644 --- a/lib/Controller/ActivityPubController.php +++ b/lib/Controller/ActivityPubController.php @@ -122,8 +122,7 @@ class ActivityPubController extends Controller { try { $actor = $this->cacheActorService->getFromLocalAccount($username); - -// $actor->setTopLevel(true); + $actor->setDisplayW3ContextSecurity(true); return $this->directSuccess($actor); } catch (Exception $e) { diff --git a/lib/Model/ActivityPub/ACore.php b/lib/Model/ActivityPub/ACore.php index da3c92a8..4cac3361 100644 --- a/lib/Model/ActivityPub/ACore.php +++ b/lib/Model/ActivityPub/ACore.php @@ -73,6 +73,8 @@ class ACore extends Item implements JsonSerializable { /** @var Document */ private $icon = null; + /** @var bool */ + private $displayW3ContextSecurity = false; /** @var LinkedDataSignature */ private $signature = null; @@ -171,6 +173,25 @@ class ACore extends Item implements JsonSerializable { } + /** + * @return bool + */ + public function isDisplayW3ContextSecurity(): bool { + return $this->displayW3ContextSecurity; + } + + /** + * @param bool $display + * + * @return ACore + */ + public function setDisplayW3ContextSecurity(bool $display): ACore { + $this->displayW3ContextSecurity = $display; + + return $this; + } + + /** * @return bool */ @@ -538,7 +559,7 @@ class ACore extends Item implements JsonSerializable { if ($this->isRoot()) { $context = [self::CONTEXT_ACTIVITYSTREAMS]; - if ($this->gotSignature()) { + if ($this->gotSignature() || $this->isDisplayW3ContextSecurity()) { array_push($context, self::CONTEXT_SECURITY); }