[Improvement] Improve interoperability with other platforms trying to follow Castopod podcasts (hacked fix included)
Is your feature request related to a problem? Please describe
When trying to follow a Castopod podcast from a fediverse microblogging platform (I tested with Calckey, but I've heard anecdotal reports of Mastodon having the same issue), the Follow request is not completed as expected. After the recent fixes for media-type, it appears that the 'object' value in the Accept payload doesn't seem to be processed as expected.
While I understand that the 'object' returning the URI of the follow request is correct according to the ActivityPub behaviors defined, after manually hacking the Accept response payload that Castopod sends back in response to the Follow request to be the more complex JSON object type, microblogging platforms appear to process the Accept request as expected.
Describe the solution you'd like
Currently, the Accept payload looks something like this from Castopod:
{
"@context": "https://www.w3.org/ns/activitystreams",
"id": "https://podcast.castopod.domain/@podcastname/activities/9ca1569b-a8fd-4d15-90d8-4ac166d33e3a",
"type": "Accept",
"to":
[
"https://www.w3.org/ns/activitystreams#Public"
],
"actor": "https://podcast.castopod.domain/@podcastname",
"object": "https://remote.calckey.domain/follows/9gb8v02zw1nauks5"
}
This doesn't seem to work as well with Calckey or Kbin. However, when I change the response to be this:
{
"@context": "https://www.w3.org/ns/activitystreams",
"id": "https://podcast.castopod.domain/@podcastname/activities/0ac66c71-35d9-4947-8232-a1dd685efd52",
"type": "Accept",
"to":
[
"https://www.w3.org/ns/activitystreams#Public"
],
"actor": "https://podcast.castopod.domain/@podcastname",
"object":
{
"id": "https://remote.calckey.domain/follows/9gdafev8boxei7v4",
"type": "Follow",
"actor": "https://remote.calckey.domain/users/989aaaaa9a",
"object": "https://podcast.castopod.domain/@podcastname"
}
}
Calckey and Kbin are able to understand the Accept response and the Follow completes as expected.
Describe alternatives you've considered
I changed the following to test this out. It is very messy and I don't know the best way to do it, but it has been working for me.
File: modules/Fediverse/Helpers/fediverse_helper.php
$tempActID = url_to('activity', esc($actor->username), $activityId);
$tempActURI = $actor->uri;
$tempTarActID = $targetActor->uri;
$tempJSONManual = "{\"@context\":\"https://www.w3.org/ns/activitystreams\",\"id\":\"{$tempActID}\",\"type\":\"Accept\",\"actor\":\"{$tempActURI}\",\"object\": {\"id\":\"{$objectId}\",\"type\":\"Follow\",\"actor\":\"{$tempTarActID}\",\"object\":\"{$tempActURI}\"}}";
try {
// $acceptRequest = new ActivityRequest($targetActor->inbox_url, $acceptActivity->toJSON());
$acceptRequest = new ActivityRequest($targetActor->inbox_url, $tempJSONManual);
$acceptRequest->sign($actor->public_key_id, $actor->private_key);
$acceptRequest->post();
} catch (Exception) {
I know this is very messy, but it has solved the last piece of being able to follow and get updates on my Castopod podcasts on Calckey and Kbin.
Additional context
This is a "manual" hack for sure, but I hope it shows the format that seems to be working for me and those in my social circles.