anze3db / fedidevs

Discover amazing developers across the fediverse 🌐
https://fedidevs.com
MIT License
12 stars 6 forks source link

Support instances with a different federation domain #53

Open RealOrangeOne opened 2 weeks ago

RealOrangeOne commented 2 weeks ago

For example, my Mastodon instance federates as theorangeone.net, but is deployed at mastodon.theorangeone.net. This results in the wrong (but still valid) handle being shown:

image

Instead, it should be @jake@theorangeone.net - although I'm only assuming this information is available from the APIs.

anze3db commented 2 weeks ago

Hm... this is all the data that I have on your account:

id username acct display_name locked bot discoverable group noindex created_at last_status_at last_sync_at followers_count following_count statuses_count note url avatar avatar_static header header_static emojis roles fields instance account_id moved
2943694 jake jake Jake Howard f f t f f 2022-11-06 00:00:00+00 2024-06-18 01:00:00+01 2024-06-18 10:23:23.116262+01 187 184 142

Part Developer, Part SysAdmin, Part InfoSec. Avid self-hoster, lover of .

All things systems @ Torchbox. Core, Security & Performance @ Wagtail.

Mostly writing :python: and :django:, but I do love :rust:!

Opinions are a belief or construct held with confidence.

https://mastodon.theorangeone.net/@jake https://mastodon.theorangeone.net/system/accounts/avatars/109/298/767/812/734/272/original/8e22d82522289933.png https://mastodon.theorangeone.net/system/accounts/avatars/109/298/767/812/734/272/original/8e22d82522289933.png https://mastodon.theorangeone.net/system/accounts/headers/109/298/767/812/734/272/original/92a2538671ecacc7.webp https://mastodon.theorangeone.net/system/accounts/headers/109/298/767/812/734/272/original/92a2538671ecacc7.webp [{"url": "https://mastodon.theorangeone.net/system/custom_emojis/images/000/013/205/original/a1a7b9de197e9c7b.png", "shortcode": "python", "static_url": "https://mastodon.theorangeone.net/system/custom_emojis/images/000/013/205/static/a1a7b9de197e9c7b.png", "visible_in_picker": true}, {"url": "https://mastodon.theorangeone.net/system/custom_emojis/images/000/013/206/original/75d98a48af14145f.png", "shortcode": "django", "static_url": "https://mastodon.theorangeone.net/system/custom_emojis/images/000/013/206/static/75d98a48af14145f.png", "visible_in_picker": true}, {"url": "https://mastodon.theorangeone.net/system/custom_emojis/images/000/013/207/original/62ad06a884dd16dd.png", "shortcode": "rust", "static_url": "https://mastodon.theorangeone.net/system/custom_emojis/images/000/013/207/static/62ad06a884dd16dd.png", "visible_in_picker": true}] [{"id": "3", "name": "Owner", "color": ""}] [{"name": "Website", "value": "<a href=\"https://theorangeone.net\" target=\"_blank\" rel=\"nofollow noopener noreferrer me\" translate=\"no\"><span class=\"invisible\">https://<span class=\"\">theorangeone.net<span class=\"invisible\">", "verified_at": "2023-07-21T07:56:08.178+00:00"}, {"name": "GitHub", "value": "<a href=\"https://github.com/RealOrangeOne\" target=\"_blank\" rel=\"nofollow noopener noreferrer me\" translate=\"no\"><span class=\"invisible\">https://<span class=\"\">github.com/RealOrangeOne<span class=\"invisible\">", "verified_at": null}, {"name": "Twiter", "value": "<a href=\"https://twitter.com/RealOrangeOne\" target=\"_blank\" rel=\"nofollow noopener noreferrer me\" translate=\"no\"><span class=\"invisible\">https://<span class=\"\">twitter.com/RealOrangeOne<span class=\"invisible\">", "verified_at": null}] mastodon.theorangeone.net 109298767812734272

(all of this is from the public API of your instance, but let me know if you prefer if I remove it from this comment).

As you can see, all the fields point to mastodon.theorangeone.net. Can you check if there is a way for you to adjust the fields on your end? I don't have my own Mastodon instance so I don't know what options are there.

RealOrangeOne commented 2 weeks ago

It's something which is configured when you deploy Mastodon, as opposed to in the UI. However, I think I've found the solution.

It looks like you've made the assumption that the domain of the instance is the federating domain (example). In fact, there's an API you should use per-instance to get this information:

https://mastodon.theorangeone.net/api/v2/instance shows the domain key as being theorangeone.net (as it should), whereas for a simpler server (https://fosstodon.org/api/v2/instance), it's still fosstodon.org. Unfortunately, it's another API call, but it can be done once per server. A person's username then becomes {acct}@{domain} if you're pulling the user's details directly from the instance. There's a tiny footnote here about that. Unfortunately, that might be a large change :sweat_smile:

anze3db commented 2 weeks ago

If it's just one API call per instance to figure this out it shouldn't be a big deal. I'll get it done, but only in a couple of days because I'm getting swamped at work and in personal life right now 😅

(I also want to contribute to your Django Tasks project, but just hadn't had the time yet!)

RealOrangeOne commented 2 weeks ago

Absolutely no rush :grin: It seems to work as-is now - it's just a nice optimisation.