bridgy
bridgy copied to clipboard
[Feature Request] Add AS2 JSON redirects for Mastodon Publish
Mastodon can auto-discovery the link rel="alternate"
in a web page.
For example, for https://kwaa.dev/redmi2-pmos, I manually added a link to
<link rel="alternate" type="application/activity+json" href="https://kwaa.moe/objects/2ead478f-aa7e-4bb9-9051-b106b65a81dc" />
If a Mastodon user enters this link in the search box, he will be directed to the corresponding post.
However, this URL is usually extremely random, so I want to be able to have predictable redirects.
Like this:
<link rel="alternate" type="application/activity+json" href="https://brid.gy/**/kwaa.dev/redmi2-pmos" />
This way I can simply automate it:
custom: ({ post }) => post ? [`<link rel="alternate" type="application/activity+json" href="https://brid.gy/**/kwaa.dev${post.path}" />`] : []
Hmm! Sounds like https://granary.io/ would work? eg the link to convert https://kwaa.dev/redmi2-pmos to AS2 is https://granary.io/url?input=html&output=as2&url=https%3A%2F%2Fkwaa.dev%2Fredmi2-pmos
One catch is that granary currently converts all items on the page, so the AS2 Article
object is inside the items
array field.
Hmm! Sounds like https://granary.io/ would work? eg the link to convert https://kwaa.dev/redmi2-pmos to AS2 is https://granary.io/url?input=html&output=as2&url=https%3A%2F%2Fkwaa.dev%2Fredmi2-pmos
One catch is that granary currently converts all items on the page, so the AS2
Article
object is inside theitems
array field.
The main reason I want this feature is to be able to quickly search for URLs to reply to.
Hmm, maybe I don't understand. If you want to search in Mastodon for a URL on your site and have it show your corresponding Mastodon post, granary is close. That's kind of a hack, though, since they're really two different posts. If you want Mastodon to treat them as the same, via federation, try https://fed.brid.gy/ instead.
(If you mean you want to search for posts that include a given URL, Mastodon search doesn't allow that, by design: https://docs.joinmastodon.org/user/network/#search )
Oh also, you can get the AS2 URL of the Mastodon post that Bridgy Publish created in the response's Location
header. If you're using webmention, it's also in the response body JSON uri
field. Docs: https://brid.gy/about#response
Oh also, you can get the AS2 URL of the Mastodon post that Bridgy Publish created in the response's
Location
header. If you're using webmention, it's also in the response body JSONuri
field. Docs: https://brid.gy/about#response
Hmm... so maybe I wasn't clear enough. First of all, Bridgy Fed does not support Pleroma, so I need to use Bridgy Mastodon Publish... Then I hope that Mastodon users can search for the corresponding post and reply or other operations through the URL, so I manually set the alternate and make sure it works ...and then there's this issue's feature request. Since auto-created post URLs are often extremely random, I wanted a predictable redirection link... so I don't need to manually set alternate for each blog article, that's it.
Sure! Thanks, understood. Did you look at how Bridgy Publish returns the Mastodon post's URL in Location
and uri
, like I mentioned? That URL serves your post as AS2, so you can use it in your link
.
Sure! Thanks, understood. Did you look at how Bridgy Publish returns the Mastodon post's URL in
Location
anduri
, like I mentioned? That URL serves your post as AS2, so you can use it in yourlink
.
Since my blog is static, this isn't much different than if I had set it up manually.
At this point, as stated in the title, if such a redirect is provided
https://brid.gy/**/kwaa.dev/redmi2-pmos
(domain and path) => https://kwaa.moe/objects/2ead478f-aa7e-4bb9-9051-b106b65a81dc
(the AS2 JSON URL returned when publishing via Bridgy Mastodon)
I would be able to set up all articles once and for all.
Ah, ok. If you use a static site generator, and you don't capture webmention responses to update it, I can see how this would help. I don't currently have plans to add this right now, but I can definitely take it as a feature request!