Open morganmay opened 4 years ago
Thanks for reporting @morganmay! Honestly, I'm not sure what the problem may be (not a Mastodon user myself, and not familiar with the platform).
IIRC, the lookup tool is just a UI wrapper that implements that workaround described in https://github.com/tootsuite/mastodon/issues/4588#issuecomment-348667202.
In looking at our reference example and tests for the Mastodon badges, I see a couple instances that are also running 3.0.1, and similarly the lookup tool isn't working (getting User or domain not found. Please try again
). In the raw requests/responses, the main data point that contains the user id appears to be missing:
https://mastodon.social/.well-known/webfinger?resource=acct:wilkie@mastodon.social https://mastodon.xyz/.well-known/webfinger?resource=acct:PhotonQyv@mastodon.xyz
I'm guessing that also means that the other method:
Failing that, you can also visit your profile page, where your user ID will be in the header in a tag like this:
Doesn't work either right?
Correct. I tried all of the methods listed and did some additional poking around and wasn't able to find the user ID anywhere.
On Mon, Jan 6, 2020 at 7:04 PM Caleb Cartwright notifications@github.com wrote:
Thanks for reporting @morganmay https://github.com/morganmay! Honestly, I'm not sure what the problem may be (not a Mastodon user myself, and not familiar with the platform).
IIRC, the lookup tool https://prouser123.me/misc/mastodon-userid-lookup.html is just a UI wrapper that implements that workaround described in tootsuite/mastodon#4588 (comment) https://github.com/tootsuite/mastodon/issues/4588#issuecomment-348667202 .
In looking at our reference example and tests for the Mastodon badges, I see a couple instances that are also running 3.0.1, and similarly the lookup tool isn't working (getting User or domain not found. Please try again). In the raw requests/responses, the main data point that contains the user id appears to be missing:
https://mastodon.social/.well-known/webfinger?resource=acct:wilkie@mastodon.social
https://mastodon.xyz/.well-known/webfinger?resource=acct:PhotonQyv@mastodon.xyz
I'm guessing that also means that the other method:
Failing that, you can also visit your profile page, where your user ID will be in the header in a tag like this:
Doesn't work either right?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/badges/shields/issues/4492?email_source=notifications&email_token=ACEWTZ7EZHBLBFF7OAG4EKLQ4PWMZA5CNFSM4KDAAOQ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIHRAIA#issuecomment-571412512, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACEWTZ3LZTW4NMO7D53JXYDQ4PWMZANCNFSM4KDAAOQQ .
That's unfortunate 🤔 We'll need to dig into this and see if there's any other way for folks to discover their respective user id.
If anyone has any insight or can help with this that would be greatly appreciated!
@calebcartwright
It seems that ActivityPub
https://docs.joinmastodon.org/spec/activitypub/ is now used instead of salmon.
As a workaround we can use https://{instance}/@{user}.rss
and from the image links at:
<rss><image><url>$X</url></image></rss>
<rss><webfeeds:icon>$X</webfeeds:icon></rss>
<rss><webfeeds:cover image="$X"/></rss>
(e.g. https://s3-mstdn.maud.io/accounts/avatars/000/007/337/$X...
) we can extract the user-id - in this case 7337
- seems to work, annoying that there isn't just an id key though.
Something to watch out for is that the URL path isn't consistent (eg. https://awoo.pub/system/accounts/avatars/000/000/002/$X...
) and can be on different domains as well (eg. https://cdn.awoo.chat/accounts/avatars/000/000/001/$X
) - just some examples I found while searching random instances
I'll take a look at updating it when I have some time and will let you know!
Thanks @Prouser123!
(e.g.
https://s3-mstdn.maud.io/accounts/avatars/000/007/337/$X...
) we can extract the user-id - in this case7337
- seems to work, annoying that there isn't just an id key though.
Here is how you can do it using js:
// `feed` is a string containing the downloaded RSS feed
const reAvatarPath = /\/accounts\/avatars\/(\d{3})\/(\d{3})\/(\d{3})/
const userId = feed.match(reAvatarPath)?.slice(1).join('')
console.log(userId)
//=> 000007337
You don't need to strip those leading zeros: https://mstdn.maud.io/api/v1/accounts/000007337 :tada:
:wave:
Apologies for the delay, but I've now rewritten the tool, as well as open-sourcing it here. Thank you @vladimyr for your comment on the leading zeros!
I'd also like to ask if it would it be worth refactoring / adding an additional route that does the lookup directly? Request time could be an issue with that, though.
Tool screenshot:
I'd also like to ask if it would it be worth refactoring / adding an additional route that does the lookup directly? Request time could be an issue with that, though.
And that is exactly how it is implemented for badgen.net: https://github.com/badgen/badgen.net/blob/38dabbd5/api/mastodon.ts#L14-L42 :wink:
I was able to create a followers badge for the server I'm on.
https://img.shields.io/badge/dynamic/json?label=Mastodon&query=totalItems&url=https%3A%2F%2Fhachyderm.io%2Fusers%2Fchris_hunt%2Ffollowers.json&logo=mastodon&style=flat-square
Here's a useful variant. It seems to work on any up to date Mastodon server I've tried.
I've been trying to create a Mastodon badge but the user ID lookup is not working for me with any account, including on a mastodon.social server. I get either "Invalid username" or "User found! Your ID is originalmissing.png."
I haven't had any success with the other two suggested methods for finding a user ID too (calling the api or looking at the header source).
I tried adapting the link text @cdhunt posted by replacing the url, also without success.
Any suggestions?
Are you experiencing an issue with...
:beetle: Description
I'm trying to make a Mastodon Follow badge, but none of the methods listed for finding my User ID work - the lookup tool can't find the instance, and examining the code at the specified URLs turned up no ID. I'm on Mastodon 3.0.1 - maybe the "user ID" lookup method just doesn't work anymore?
:link: Link to the badge
I wasn't able to get the info necessary to make a badge