-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ATProto => ActivityPub @-mentions #959
Comments
I did a bit of sleuthing about how Mastodon parses mentions in
So in short: I think you can keep the mention format in the text, but you'll have to turn it into an HTML link so that it renders properly towards Mastodon clients and the web interface. I think the mentions in the |
Thanks! When we tested and got these working from web a while back in #493 (comment), the HTML link in content evidently wasn't necessary, but Also, the goal here is more than just a clickable link; it's to make Mastodon actually handle it as a mention, so that when you click on it, it loads the mentioned user in the local instance's UI, instead of navigating your browser to the remote instance. ( |
Right, I understood this issue here to be specifically about the inline presentation, which is largely handled separately, and for which I'm pretty certain either the link is necessary or maybe |
I finally found the place this is done, by searching for the This also confirms that the surrounding markup doesn't matter, you just need an Edit: Pixelfed seems to be sensitive to the (It has multiple |
Looked at this a bit. We need to convert the mention {
"$type": "app.bsky.feed.post",
"text": "maybe if @snarfed.indieweb.social.ap.brid.gy and #alf meet up",
"createdAt": "2024-05-20T03:49:56.091Z",
"facets": [{
"$type": "app.bsky.richtext.facet",
"features": [{
"$type": "app.bsky.richtext.facet#mention",
"did": "did:plc:bg5udl25mvzg3rt7l5n2hzet"
}],
"index": {
"byteEnd": 44,
"byteStart": 9
}
}],
} ...to AS2: {
"id": "https://bsky.brid.gy/convert/ap/at://did:plc:3ljmtyyjqcjee2kpewgsifvb/app.bsky.feed.post/3ksveg5r2qs24",
"url": "https://fed.brid.gy/r/https://bsky.app/profile/did:plc:3ljmtyyjqcjee2kpewgsifvb/post/3ksveg5r2qs24",
"content": "<p>maybe if <a href=\"https://bsky.brid.gy/ap/https://bsky.app/profile/did:plc:bg5udl25mvzg3rt7l5n2hzet\">@snarfed.indieweb.social.ap.brid.gy</a> and <a href=\"https://bsky.brid.gy/hashtag/alf\">#alf</a> meet up</p>",
"published": "2024-05-20T03:49:56.091Z",
"attributedTo": "https://bsky.brid.gy/ap/did:plc:3ljmtyyjqcjee2kpewgsifvb",
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Note",
"tag": [{
"type": "Mention",
"name": "@snarfed.indieweb.social.ap.brid.gy",
"href": "https://bsky.brid.gy/ap/https://bsky.app/profile/did:plc:bg5udl25mvzg3rt7l5n2hzet"
}],
} |
Current status: |
So that should eventually show the mention as "@snarfed@indieweb.social" in the post text on the Mastodon side, right? |
Yes, or just |
^ Progress. We're now at least generating the right The link doesn't get rewritten to point to the mentioned user inside the local instance, though. It's a normal HTML link that goes to the user on their own instance. Example of how I'd ideally like it to work: https://indieweb.social/@tchambers/112542225021901875 . I've gotten this working before with Web => AP, not sure what needs to change. Does the mention link text need to be the AP handle? Something else? Back to #493, my old nemesis. |
I'm pretty sure this is because you're using Remember that these get matched (I think this is another case of Mastodon overusing @@-handles again. Other apps may skip that indirection and use the href directly. I'm not sure there is actually any software that matches text-to- |
@qazmlp out of curiosity, are you talking about this section? https://www.w3.org/TR/activitystreams-vocabulary/#microsyntaxes
Not normative, but still, useful if so, thanks for the nudge. |
I'm talking about "EXAMPLE 158" which appears to have the post content as plaintext in JSON:
I'm not sure if any behaviour is actually being prescribed there, though, and in my opinion automatic parsing of incoming plaintext without markup isn't usually a great idea, generally speaking. |
Right! That whole section is non-normative, so no, they're not prescribing behavior per se, and they agree with you on avoiding parsing text content. From the beginning of the section:
|
Looking at this again. Here's the (pruned) AS2 object for the example above with the mention that notified the Mastodon user but didn't get rewritten. The mention {
"@context" : "https://www.w3.org/ns/activitystreams",
"type" : "Note",
"id" : "https://bsky.brid.gy/convert/ap/at://did:plc:3ljmtyyjqcjee2kpewgsifvb/app.bsky.feed.post/3ktxejevy3s2o",
"url" : "https://fed.brid.gy/r/https://bsky.app/profile/did:plc:3ljmtyyjqcjee2kpewgsifvb/post/3ktxejevy3s2o"
"attributedTo" : "https://bsky.brid.gy/ap/did:plc:3ljmtyyjqcjee2kpewgsifvb",
"content" : "<p><a href=\"https://indieweb.social/users/snarfed\">@snarfed.indieweb.social.ap.brid.gy</a> and <a href=\"https://bsky.brid.gy/hashtag/alf\">#alf</a> should meet up again</p>",
"tag" : [{
"href" : "https://indieweb.social/users/snarfed",
"name" : "@snarfed.indieweb.social.ap.brid.gy",
"type" : "Mention"
},{
"href" : "https://bsky.brid.gy/hashtag/alf",
"name" : "#alf",
"type" : "Hashtag"
}],
} |
It's not clear whether that describes what Mastodon actually does, or just what's generally possible with AS2 |
I think this is now the same as #887. |
Closing, will track the local rewriting in #887. |
Not working yet. Example Bluesky post and bridged fediverse post. Guess I'll go back and refresh my memory on #493.
Bluesky,
at://did:plc:3ljmtyyjqcjee2kpewgsifvb/app.bsky.feed.post/3kq6zmsmpc52z
:AS1:
AS2:
The text was updated successfully, but these errors were encountered: