Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Posting to BlueSky returns an at:// URI instead of an https:// link #242

Open
faucetlol opened this issue Sep 17, 2023 · 1 comment · Fixed by #254
Open

Posting to BlueSky returns an at:// URI instead of an https:// link #242

faucetlol opened this issue Sep 17, 2023 · 1 comment · Fixed by #254

Comments

@faucetlol
Copy link

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.

image

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.

image

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


@leaftail1880
Copy link
Contributor

leaftail1880 commented Sep 17, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants