Posting to BlueSky returns an `at://` URI instead of an `https://` link
Opened this issue · 1 comments
Already discussed on the Discord, but thought I'd make an issue too for tracking purposes.
The problem
When posting to BlueSky their API currently responds with an AT Protocol URI, which obviously can't be opened by the average user in their browser, instead of the normal HTTPS link that people would be expecting.
This becomes further problematic when this is provided as a source to e621 resulting in an unclickable link, which requires making an API tool to figure out where it was posted.
To mitigate this problem for now, I'm running a bot that automatically resolves the URIs, but a permanent solution would be much better.
The solution?
If the API itself won't give us the URL, we're left with no option but to construct it ourselves. We know the last part of the URL is the unique identifier for the post - but identifying the author is the harder part.
The hackiest solution - the user is already authenticated with PostyBirb, so we should know their handle they logged in with, and should be able to construct a URL with the format https://bsky.app/profile/${user_handle}/post/${post_id}
. Currently untested: Is the user able to change their handle on BlueSky without killing their session within PostyBirb, resulting in incorrect source URLs?
A safer solution, though requiring an additional API call, would be to query the API for the handle of the DID found in the URI with agent.getProfile({actor: "did:plc:xxxx"})
which will respond with various information including the handle
that we need to construct the URL like above.
Unfortunately neither solution is future-proof as it would be hardcoding the links to the bsky.app
domain when it will eventually become federated, I imagine a lot of code is already going to need re-implementation for that change so this might not be a big deal.
Other discussion
Im agree, i think best solution is
agent.getProfile({actor: "did:plc:xxxx"})
because its more stable and +1 api call will be like +20ms which is okay