Signalling "open in app" behaviour for AP content
-
julian: I could theoretically override the anchor click handler to do a backend round-trip to check whether we could load the content in-app, otherwise fall back to a regular browser behaviour (a page navigation). i believe this is what mastodon does, but it's also worth mentioning fep-e232 Object Links as a way to tag a given Link with the appropriate mediaType used for content negotiation: { "@context": "https://www.w3.org/ns/activitystreams", "content": "
This is an object link.
", "tag": { "type": "Link", "name": "object link", "href": "https://example.com/some-object", "mediaType": "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"" } } -
@[email protected] Thanks! That's helpful (the link was purple, so I must've at least looked at it in the past...)
For those implementations using FEP-e232 I can then at least proactively update the anchor.
It's sounding more and more like I'll need to piece together multiple strategies:
- Object Links if provided
- On click, check with backend to see if a local representation can be navigated to
- Otherwise, standard browser navigation
-
@evan @julian @nightpool for what it's worth, webfinger should be (re: is) able to do this, even if the implementations in the wild don't. The intent at the time was for webfinger to be the "DNS records" for "social addresses", and the main reasons we didn't just use DNS was because (1) DNS doesn't support anything but bare domain names, (2) management of DNS records at scale is hard, and (3) it wasn't possible to query DNS via the web.
-
@evan @julian @nightpool lots of folks advocated to support any URI scheme in a webfinger lookup, and that's why we have the "acct" scheme at all - so that email-style addresses could be used alongside http etc URIs!
The <Link> approach definitely works, but feels a bit reinventing-webfinger/creating more complexity in lookups (on the client side).
Hope the context is helpful!
-
Evan Prodromoureplied to blaine on last edited by [email protected]
So, for finding the AP equivalent of an URL that I think is a Web page, I'd take these steps:
- Link header: HEAD and look for the Link: header (easy, fast)
- Webfinger: Webfinger the URL (a little more complicated)
- Content negotiation: GET with Accept header set to AS2 type
- Parsing: GET and look for Link: header or <link> element -
Evan Prodromoureplied to Evan Prodromou on last edited by
For finding the HTML page for an AP object:
- Link header: HEAD and look for Link:
- Content negotiation: HEAD with Accept: set to text/html
- AS2: GET and look for `url` at top level -
@evan @julian @nightpool in the Postel sense, though, it's too bad that a client implementor needs to maintain (at least) four discovery pathways, and may require four separate requests to validate the information. Similarly, an ap host doesn't know which spots a client will check, so needs to implement all four. I'm well out of the standards game, but I'd very much advocate for "pick one and stick with it"
-
@blaine @julian @nightpool we need you back in the standards game
-
@[email protected] @[email protected] indeed, four different implementations is not ideal. We're at the point where they're all vying for attention.
Would need to weigh pros and cons of each and see whether there is one winner we can all agree on.
-
When you work on this, consider that there are some situations where the user may want or need to go to the official profile and channel. Older content does not get distributed via ActivityPub, so you have to go to the source (originating website) to see everything.
And I have rarely seen an entire conversation be delivered via ActivityPub. The Zot protocol downloads the whole conversation, but not ActivityPub. With ActivityPub, there are always holes and you have to go to the original thread on the original website to see the whole thing. Maybe we can fix that by adding the ability to download entire threads, not just new posts, but right now seeing the whole conversation over ActivityPub is hit or miss.
Also, many platforms have profile information that is not transmitted over ActivityPub and you would need to visit their real profile to get all of the details.
Plus, in my opinion, it is poor form to create a local profile for someone on another platform and fail to acknowledge that the user is using another platform. At the very least, there should be a link back to their official profile and/or channel (i.e. their posts).
Until ActivityPub can reliably transmit the entire thread, you will need to link back to the original website. -
Scott M. Stolzreplied to julian on last edited by [email protected]@julian
For example, let's say I link out to Evan's profile here. If NodeBB knew that this link had an alternative AP endpoint, then we could redirect the user instead to the local representation of his profile
Wouldn't Evan's AP endpoint be the same as his HTML endpoint?
Most platforms are going to send you to the authoritative profile, which is the one at the user's server.
And if you wanted to redirect a link to a local profile instead of his official profile, you don't need an endpoint to do that. You could simply parse the post and swap out the URL, since you should have data about the user in your database anyway from when you first detected the user.
Maybe I am misunderstanding the use case here, but I am not sure why a platform would send you to a different platform to view the profile or channel. -
@[email protected] said in Signalling "open in app" behaviour for AP content:
And if you wanted to redirect a link to a local profile instead of his official profile, you don't need an endpoint to do that. You could simply parse the post and swap out the URL, since you should have data about the user in your database anyway from when you first detected the user.
Correct. In this scenario I don't want to be going to the authoritative profile, I would want to keep the user on-site.
If I had the user's
url
available, then yes, I can (and already do) swap out the URL. However, if somebody links out to some resource, I might not already know about that user, status, post, article, etc.In which case an opportunistic
HEAD
call would be one way to figure out pre-flight whether an AP object exists or not. -
-
@julian @silverpill the HTML discovery tf doc is filling in. There's still a lot to do but maybe that's a good place to ask questions.
-
@julian @silverpill no recos for consumers yet, but: I'd start with content negotiation, then Link headers. From there, fallback to <link> elements in HTML. Last recourse, try Webfinger, especially for non-HTML resources like images.
-
Hi @kariboka @julian @evan @silverpill,
I read page, not host. Please refrain from idiosyncratic or obsolete legacy. -
@[email protected] @[email protected] Thank you for the update. Independently of this draft, I partially implemented this in NodeBB so that clicking external links in-app go through a middleman step where existing known resources are loaded in-app, and retrieved via AP otherwise. Fallback is just to send the user to the url as originally intended.
Section 2.1 details use of content negotiation, but I have not implemented that yet mainly because early tests indicated that I'd more often than not receive HTML back despite the AP
Accept
header.So right now it's:
- Redirect to in-app representation if recognized
- HEAD call to search for
Link
header - Return failure and send user off-site.