Post ATNbDlEFvOdnvyop9s by silvermoon82@strangeobject.space
(DIR) More posts by silvermoon82@strangeobject.space
(DIR) Post #ATNZ0BKhsFQMvqEWx6 by john@sauropods.win
2023-03-07T17:23:59Z
0 likes, 0 repeats
Bit of a technical question: is there any sort of convention around an attribute you can add to a link to mark it as referring to #Fediverse / #Mastodon / #ActivityPub object?#web #webdev
(DIR) Post #ATNZSryCwZThHEOBN2 by john@sauropods.win
2023-03-07T17:29:08Z
0 likes, 0 repeats
I realise that a url scheme is probably the best option in the long run, but that's a way off presumably. An attribute could be hacked on.
(DIR) Post #ATNZTsc42UCNYnVt6O by jalcine@todon.eu
2023-03-07T17:29:08Z
0 likes, 0 repeats
@john The closest (but non-working) would be using the "type" attribute and hinting it to be at "application/activity+json". That _should_ encourage any crawling tool to fetch with that type and expect a ActivityStreams JSON document.
(DIR) Post #ATNZh2YOOI7A9i4TfU by john@sauropods.win
2023-03-07T17:31:51Z
0 likes, 0 repeats
@jalcine Ah, I’ve miss-worded my question, because I want it to work on the HTML url of those AP object (just toots in this case).
(DIR) Post #ATNZrKgFqnUZGqelV2 by silvermoon82@strangeobject.space
2023-03-07T17:33:31Z
0 likes, 0 repeats
@john I don't know for sure (and it'll be 100% implementation dependent), but setting the MIME type of the Link (mediaType in AP, I think) to "application/activity+json" seems like the spec-correct way to do it.I suspect that in practice the done thing is for the client (or something in between) to probe the URL and just handle whatever comes back. Smarter software would send an Accept header that prefers AP, but even that will be iffy depending what the remote server does.
(DIR) Post #ATNbDlEFvOdnvyop9s by silvermoon82@strangeobject.space
2023-03-07T17:49:00Z
0 likes, 0 repeats
@john Okay, so you have an AP Link. The URL points to an HTML page that represents an AP object. You want the Link to explicitly state that. Correct?I don't think there's any way to mark the Link itself with "I point at the HTML, but it's also an AP object"; as far as I know the only way is that the HTML itself should have a <link rel="alternate"> that points back to the AP object itself.Maybe a worthwhile discussion to be had on extending AP with that? I could see Link.alternate being useful
(DIR) Post #ATNbg4VHr63Rp1HhrM by john@sauropods.win
2023-03-07T17:54:04Z
0 likes, 0 repeats
@silvermoon82 Yes - what I'm actually doing will help make it clear - I want to have a link that says “discuss this on Mastodon/Fediverse” (wording TBD), and I wanted to know if there was some sort of convention for marking such links that browser extensions could use to either open the right app, or refer it to your own Mastodon instance for importing.
(DIR) Post #ATNcZNErtrNBr4yVpg by mike@sauropods.win
2023-03-07T18:03:48Z
0 likes, 0 repeats
@john You mean like the way that if you proceed a name with an @-sign it's generally understood to be a Twitter handle? In that case, @mike seems pretty clear.
(DIR) Post #ATNcxOeCJZN7ApHGXQ by john@sauropods.win
2023-03-07T18:08:03Z
0 likes, 0 repeats
@mike Not really, I was wondering if there's a convention out there that browser extensions could use to handle Mastodon links appropriately (that is, open them in the right app, or import the object to your own instance ready for interaction.) Something like a custom data attribute in the anchor tag.
(DIR) Post #ATNczGhOpyrH6LfSdM by mike@sauropods.win
2023-03-07T18:08:38Z
0 likes, 0 repeats
@john Give me an example of what such a thing _could_ look like?
(DIR) Post #ATNdzknN2XUuOiFvmq by john@sauropods.win
2023-03-07T18:19:57Z
0 likes, 0 repeats
@mike Yeah, so lets say you have a page that is a representation of Toot. You could have link like so: <a href=“example.com/tootid” type=“mastodon”>Discuss on Mastodon</a> at the bottom. A browser extension could latch on to that type=“mastodon” and send the url to your Mastodon app, or alternatively to your own (preconfigured) home server. It wouldn't do anything for the most part, but it's much-needed functionality that can otherwise only come though a URL scheme I think.
(DIR) Post #ATNepUPtBGqserwTZI by mike@sauropods.win
2023-03-07T18:29:18Z
0 likes, 0 repeats
@john Got it. Make sense. And it "fails well" because a browser that doesn't recognize the type will just link to https://sauropods.win/@john/109983380130929268 as normal.
(DIR) Post #ATNfc1jQcRNPspE4HI by john@sauropods.win
2023-03-07T18:32:25Z
0 likes, 0 repeats
@mike Yeah. It doesn't seem like such a convention exists, but I think maybe type=“activitypub/html” for the HTML representation would be appropriate?
(DIR) Post #ATNfkE4acO9GTZ28n2 by mike@sauropods.win
2023-03-07T18:34:54Z
0 likes, 0 repeats
@john Something like that, yes. Wanna start the process of applying to register it?
(DIR) Post #ATNg0y5tHTwzqBcpvc by john@sauropods.win
2023-03-07T18:42:20Z
0 likes, 0 repeats
@mike I have no idea how to go about that, but I can look it up. But right now I have to go to pub quiz.
(DIR) Post #ATNvI2NW6VG3MbT1VI by assaf@mas.to
2023-03-07T21:33:48Z
0 likes, 0 repeats
@john this might be better handled with a rel attribute: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel
(DIR) Post #ATO0yaqKr1x2Bh3g4e by john@sauropods.win
2023-03-07T22:37:34Z
0 likes, 0 repeats
@assaf Yeh, I thought about rel, but I'm not sure, because what is needed is not the relation to the current document, but rather the capabilities in the linked url. The appropriate rel value would probably be “alternate”. rel=“activitypub” doesn't seem right.
(DIR) Post #ATO2O0r7NR2w3f6pmK by assaf@mas.to
2023-03-07T22:53:09Z
0 likes, 0 repeats
@john alternate would suggest the linked document is a different representation of the current page, but prefetch tells the browser to handle that link in a different way (load before a click), so I think by analogy rel=activitypub could tell the browser “open this profile using AP compatible user agent”