BIN-4 Quotes
In this new Bovine Implementation Note, I will discuss how I’m handling quotes in longhorn, the ActivityPub Client this blog runs on. This discussion is based on my thoughts in Thoughts on oEmbed and quoting. In particular, I will disucss how the quoting notification problem is solved in longhorn. One issue that is not solved by this implementation is enabling posters to mark their posts as not quotable. This cannot be solved here, as first such a mark must be set by the posters. Finally, I only ensured that this implementation works well together with Mastodon so far.
Demonstration
I will start by demonstrating the feature:
This should show an embedding of a post, I made with one of my Mastodon accounts.
The above paragraph was generated by the code:
I will start by demonstrating the feature:
{{https://mas.to/@themilkman/110168493759260914}}
This should show an embedding of a post, I made with one of my Mastodon accounts.
If you view this on a FediVerse application (other than my longhorn blog), what you will see is
I will start by demonstrating the feature:
RE: https://mas.to/@themilkman/110168493759260914
This should show an embedding of a post, I made with one of my Mastodon accounts.
Furthermore, the ActivityPub object will contain an object link as defined in FEP-e232. This means the tag contains:
{
"type": "Link",
"mediaType": "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"",
"href": "https://mas.to/users/themilkman/statuses/110168493759260914",
"name": "RE: https://mas.to/@themilkman/110168493759260914"
}
Finally, my account themilkman@mas.to
will receive a message such as:
You have been quoted
Your post https://mas.to/@themilkman/110168493759260914 has been quoted on
https://blog.mymath.rocks/2023-04-09/bin4-quotes.
This Event was generated by longhorn
(https://codeberg.org/helge/longhorn) to inform you.
https://blog.mymath.rocks/2023-04-09/bin4-quotes
This is all that happens. I will now go over it, explaining the process that happens.
The quoting process
First, publishing something in longhorn takes a markdown file as input. The markdown is then transformed into the published post on my blog, and the federated Article object, that you can view on your FediVerse service. So the first step is just parsing the double braced link from the markdown file into quotes to replace. I haven’t gotten around to write a python-markdown extension to do this yet. That’s why written double braces not turning into quotes is awkward at the moment.
Second, a MastodonQuoter is created for each found quote url. For each url the following steps are taken:
- The actor id of the author of the post is determined
- The oEmbed HTML is fetched via the Mastodon API
- An Event Object notifying the author is created. This an Event, as it feels like the most natural object to use that Mastodon understands. Furthermore, the Event needs to include the author of the quoted post as a Mention, otherwise Mastodon will not display it as a notification
- The Object Link as specified in FEP-e232 is created
Third, the replacements in the formatted text are made. For this, in the HTML shown on longhorn the double braced url is replaced by the oEmbed HTML, for the Article object that is being federated, the double braced url is replaced by RE: <url>
.
Fourth, the objects are being federated. This means both the Article object and the Events.
Next steps
I have not investigated how most FediVerse applications render Article objects, it might be that some already transform objects containing RE: <url>
into an embedded toot. If not, this would be the next step towards interoperability of this approach to quoting. I hope that by providing one possible solution on how quoting might work, more people will continue to explore it to arrive at a good solution. Furthermore, I now have a new way to reply to single or multiple posts on the FediVerse in longform.
>An Event Object notifying the author is created.
Event object type is used by software like Mobilizon to represent meetings, conferences etc. Not sure what other platforms do, but I transform incoming Event into a post with a link to the original object.
The optimal solution here would be to have a Notify type activity. Introducing it is not an option if one wants to be compatible with the current FediVerse. It should probably done, once this type of feature gains momentum.