- ๐บ๐ธUnited States markdorison
A GitHub team member shared a bit on Mastodon about how they are validating hosts. Sharing that here just in case it is helpful:
We make a NodeInfo request to non-obvious hosts to check server metadata.
- ๐บ๐ธUnited States markdorison
I was trying to determine if any processing is already done on
field_social_links
. It seems like there must be as if you enter a URL for a known site like Twitter, GitHub, or LinkedIn URL, it renders with the site name as the link text as opposed to just a raw URL:<a href="http://www.linkedin.com/in/username" rel="nofollow">LinkedIn</a>
I was searching for that logic here and in bluecheese, but I came up short.
- ๐บ๐ธUnited States markdorison
Secondarily, allow the user to request the rel="me" attribute be included with the link.
Instead of a follow-on, maybe this could be an incremental step for Mastodon links. Could we safely add
rel=me
to all social links? - ๐ธ๐ฎSlovenia useernamee Ljubljana
This is a feature I'm looking forward to. I tried just adding a link to my bio, but
rel=me
tag just gets filtered out. - ๐บ๐ธUnited States markdorison
@useernamee A version of this went live in โจ Add XFN rel-me to external links on profile page Fixed , but it only works on links added to the "Social Links" field. Check out my user account for an example.
- Status changed to Needs review
about 1 year ago 9:02am 7 November 2023 - ๐ง๐ชBelgium BramDriesen Belgium ๐ง๐ช
There is a list of regex patterns used to parse the links on your user profile (
drupal.org/static-files/sites/default/settings.php
).See โจ Parse Flickr under social links Fixed for an example where a regex pattern was added.
Here is the (untested) regex pattern for Mastodon. @drumm could add this (not sure who else has access to the bitbucket).
'%^https?://mastodon\.social/@[^/]+/?%' => 'Mastodon', '%^https?://drupal\.community/@[^/]+/?%' => 'Mastodon (Drupal)',
This should match users and posts:
https://MASTODON_URL/@USER
https://MASTODON_URL/@USER/POSTIDGiven the decentralised nature, I think it only makes sense to support those two.
- ๐ง๐ชBelgium BramDriesen Belgium ๐ง๐ช
Fixing a typo in the title and renaming it. Updating IS as well to reflect what this ticket is about.
- Status changed to Fixed
about 1 year ago 11:35pm 8 November 2023 - ๐บ๐ธUnited States drumm NY, US
Thanks, I made one small change -
Mastodon (drupal.community)
to match the siteโs branding. - ๐บ๐ธUnited States neclimdul Houston, TX
I'm not sure I understand what got fixed. My Mastodon link looks the same.
- ๐ง๐ชBelgium BramDriesen Belgium ๐ง๐ช
It's parsing fine for me :) I guess it wasn't deployed or your profile was cached.
- ๐ง๐ชBelgium BramDriesen Belgium ๐ง๐ช
@neclimdul I checked your profile, you have a mastodon URL from https://hachyderm.io which is not added as a pattern.
If you add "https://drupal.community/@neclimdul" it will go to your community profile there and show a link to your main profile. Or this one https://mastodon.social/@neclimdul@hachyderm.io which will redirect to hachyderm.io
- ๐จ๐ฆCanada mikeohara Moncton, NB
Mine is also not updated - but it is a drupal.community url
- ๐ง๐ชBelgium BramDriesen Belgium ๐ง๐ช
I checked your profile and the URL should match the regex. Can you maybe check in your profile if there is no extra space or something in the URL field, and maybe save your profile to see if that busts the cache (if it's a cache issue)
- ๐ณ๐ฑNetherlands ekes
> maybe save your profile to see if that busts the cache (if it's a cache issue)
I found resaving my profile updated it.
- ๐บ๐ธUnited States neclimdul Houston, TX
Doesn't sound like we really addressed this in the decentralized way mastadon actually works.
- ๐ง๐ชBelgium BramDriesen Belgium ๐ง๐ช
@neclimdul Like discussed in #8 we only added the main Mastodon and Drupal URL to the regex pattern.
Given the decentralised way, it's next to impossible to build a regex for that without a form of API integration to verify what server a URL might belong to (not even sure there is an API for listing all servers). Not to forget there also is the self-hosted option which probably isn't listed on the servers listing either.
Stackexchange poses the same issue, there we also only support StackOverflow and Drupal Answers, and none of the many other subsites.
I think for the scope of this issue we've addressed it. And there also is a workaround that redirects you to your main profile as shown in #15. The only real way of fixing this without adding a few hundred regex patterns would be to make the URL field also have a "Title/Label" field that you can fill in your own, but then you end up with a bunch of different writings for the same thing, which in the end might also be misleading.
- ๐บ๐ธUnited States drumm NY, US
I did not bulk update existing accounts with matching URLs, so the label will update as people save their user account.
- ๐บ๐ธUnited States neclimdul Houston, TX
The new scope you defined was but I don't feel like the original intent was. There are lots of inclusivity reasons and just general choice reasons someone would choose a server outside the to provided options.
I actually appreciate the effort a lot and the motion on this, just think we can do better.
- ๐จ๐ฆCanada mikeohara Moncton, NB
I appreciate the effort, but I am also inclined to agree with the others.
Mastodon provides methods to identify the community and properly attribute, I think it would make more sense to build that detection scheme.
I think the best way to approach it would be two-fold:
Do a regex pattern to see if the entered URL contains the @ symbol as part of the last URL segment. If so, do a query against the URL to get information on the Mastodon instance to validate it. See #4
I think for the most part, it makes more sense to just render the link with a Generic โMastodonโ link title. This avoids issues with how to visualize the disparate instances names and configurations.
We can, still, choose to specially treat the Drupal Community Mastodon instance the same way with the link text as โMastodon (drupal.community)โ to call it out specifically. This would also be useful if a user were to have more than one Mastodon link in their profile.
- Status changed to Needs work
about 1 year ago 12:29am 10 November 2023 - ๐บ๐ธUnited States drumm NY, US
https://git.drupalcode.org/project/drupalorg/-/blob/7.x-3.x/drupalorg/dr... is where the titles of links are set. We would need:
- A way to detect what is a link to a Mastodon site.
- That will almost certainly require making an HTTP request, and HTTP requests are slow. The result needs to be cached for each site.
- ๐บ๐ธUnited States drumm NY, US
Permalink for the above code, since its location will change https://git.drupalcode.org/project/drupalorg/-/blob/aafab131276211ba4f0b...
Its the
field_social_links
processing withindrupalorg_entity_presave()
- ๐ฆ๐บAustralia dpi Perth, Australia
Ideally we wouldnt stick to the behaviour of Mastodon, and live by the rules of the protocol that it lives by: ActivityPub.
We should be able to accept handles instead of profile links. ie
dpi@mastodon.social
. (Note @ prefix is a Mastodon convention and must be stripped).Links would bind detection to the Mastodon platform.
If you want to verify a profile exists without making tings too complicated, while following the rules of federation:
- Given dpi@mastodon.social
- Extract the domain: mastodon.social
- GET https://mastodon.social/.well-known/host-meta
- Extract the template URL.
- Replace {uri} with `acct:username@domain.com`, such that:
- GET https://mastodon.social/.well-known/webfinger?resource=acct:dpi@mastodon.... Stop here if you got a 200 and want to confirm existence only.
- In the
links
section of the response, determine if there is a entry with rel=self, type="application/activity+json". If so, the last request: - GET href from above item. E.g
GET https://mastodon.social/users/dpi Accept: application/activity+json
- Done. Do what you want from the profile info.