diff --git a/ActivityPubPlugin.php b/ActivityPubPlugin.php
index 094fe56..090d09b 100755
--- a/ActivityPubPlugin.php
+++ b/ActivityPubPlugin.php
@@ -99,10 +99,12 @@ class ActivityPubPlugin extends Plugin
if ($candidate->getUrl() == $url) { // Sanity check
return $candidate;
} else {
- throw new Exception("Notice not found.");
+ common_debug ('ActivityPubPlugin Notice Grabber: '.$candidate->getUrl(). ' is different of '.$url);
+ throw new Exception('Notice not found.');
}
} catch (Exception $e) {
- throw new Exception("Notice not found.");
+ common_debug ('ActivityPubPlugin Notice Grabber failed to find: '.$url);
+ throw new Exception('Notice not found.');
}
}
}
diff --git a/actions/inbox/Create.php b/actions/inbox/Create.php
index 0c55bdd..a101733 100755
--- a/actions/inbox/Create.php
+++ b/actions/inbox/Create.php
@@ -78,28 +78,9 @@ $act->context->attention = common_get_attentions($content, $actor_profile, $inRe
$discovery = new Activitypub_explorer;
if ($to_profiles == "https://www.w3.org/ns/activitystreams#Public") {
- $to_profiles = array();
-}
-// Generate To objects
-if (is_array($data->object->to)) {
- // Remove duplicates from To actors set
- array_unique($data->object->to);
- foreach ($data->object->to as $to_url) {
- try {
- $to_profiles = array_merge($to_profiles, $discovery->lookup($to_url));
- } catch (Exception $e) {
- // Invalid actor found, just let it go.
- }
- }
-} elseif (empty($data->object->to) || in_array($data->object->to, $public_to)) {
- // No need to do anything else at this point, let's just break out the if
-} else {
- try {
- $to_profiles = array_merge($to_profiles, $discovery->lookup($data->object->to));
- } catch (Exception $e) {
- // Invalid actor found, just let it go.
- }
+ $to_profiles = [];
}
+
// Generate Cc objects
if (isset($data->object->cc) && is_array($data->object->cc)) {
// Remove duplicates from Cc actors set
@@ -144,7 +125,7 @@ ToSelector::fillActivity($this, $act, $options);
$actobj = new ActivityObject();
$actobj->type = ActivityObject::NOTE;
-$actobj->content = common_render_content($content, $actor_profile, $inReplyTo);
+$actobj->content = strip_tags($content,'
- ');
// Finally add the activity object to our activity
$act->objects[] = $actobj;
diff --git a/actions/inbox/Like.php b/actions/inbox/Like.php
index 35091e7..94d7d06 100755
--- a/actions/inbox/Like.php
+++ b/actions/inbox/Like.php
@@ -36,7 +36,7 @@ try {
ActivityPubReturn::error("Invalid Object specified.");
}
Fave::addNew($actor_profile, $object_notice);
- ActivityPubReturn::answer(Activitypub_like::like_to_array($data->actor, $object_notice));
+ ActivityPubReturn::answer(Activitypub_like::like_to_array($data->actor, $data->object));
} catch (Exception $e) {
ActivityPubReturn::error($e->getMessage(), 403);
}
diff --git a/actions/inbox/Undo.php b/actions/inbox/Undo.php
index d42e1bc..05f3973 100755
--- a/actions/inbox/Undo.php
+++ b/actions/inbox/Undo.php
@@ -76,11 +76,11 @@ case "Follow":
Activitypub_accept::accept_to_array(
Activitypub_follow::follow_to_array(
$actor_profile->getUrl(),
- $object_profile->getUrl()
+ $object_profile->getUrl()
)
)
- )
- );
+ )
+ );
} else {
ActivityPubReturn::error("You are not following this person already.", 409);
}
diff --git a/classes/Activitypub_notice.php b/classes/Activitypub_notice.php
index f0227e9..8df0316 100755
--- a/classes/Activitypub_notice.php
+++ b/classes/Activitypub_notice.php
@@ -62,9 +62,9 @@ class Activitypub_notice extends Managed_DataObject
}
}
- $to = [];
+ $cc = [common_local_url('apActorFollowers', ['id' => $profile->getID()])];
foreach ($notice->getAttentionProfiles() as $to_profile) {
- $to[] = $href = $to_profile->getUri();
+ $cc[] = $href = $to_profile->getUri();
$tags[] = Activitypub_mention_tag::mention_tag_to_array_from_values($href, $to_profile->getNickname().'@'.parse_url($href, PHP_URL_HOST));
}
@@ -78,11 +78,11 @@ class Activitypub_notice extends Managed_DataObject
'published' => str_replace(' ', 'T', $notice->getCreated()).'Z',
'url' => $notice->getUrl(),
'atributtedTo' => ActivityPubPlugin::actor_uri($profile),
- 'to' => $to,
- 'cc' => common_local_url('apActorFollowers', ['id' => $profile->getID()]),
+ 'to' => ['https://www.w3.org/ns/activitystreams#Public'],
+ 'cc' => $cc,
'atomUri' => $notice->getUrl(),
'conversation' => $notice->getConversationUrl(),
- 'content' => $notice->getContent(),
+ 'content' => $notice->getRendered(),
'isLocal' => $notice->isLocal(),
'attachment' => $attachments,
'tag' => $tags
diff --git a/utils/explorer.php b/utils/explorer.php
index b2be14c..7779497 100755
--- a/utils/explorer.php
+++ b/utils/explorer.php
@@ -101,7 +101,7 @@ class Activitypub_explorer
$this->temp_res = $res;
return true;
} else {
- common_debug('ActivityPub Explorer: Invalid potential remote actor while ensuring URI: '.$url. '. He returned the following: '.json_encode($res, JSON_PRETTY_PRINT));
+ common_debug('ActivityPub Explorer: Invalid potential remote actor while ensuring URI: '.$url. '. He returned the following: '.json_encode($res, JSON_UNESCAPED_SLASHES));
}
return false;
@@ -208,7 +208,7 @@ class Activitypub_explorer
$this->discovered_actor_profiles[]= $this->store_profile($res);
return true;
} else {
- common_debug('ActivityPub Explorer: Invalid potential remote actor while grabbing remotely: '.$url. '. He returned the following: '.json_encode($res, JSON_PRETTY_PRINT));
+ common_debug('ActivityPub Explorer: Invalid potential remote actor while grabbing remotely: '.$url. '. He returned the following: '.json_encode($res, JSON_UNESCAPED_SLASHES));
}
return false;