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

Bluesky translator #3400

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Bluesky translator #3400

wants to merge 8 commits into from

Conversation

urschrei
Copy link

@urschrei urschrei commented Dec 6, 2024

This adds the ability to save individual Bluesky posts. Details:

  • Saves snapshot
  • If a post is being quoted, the quoted post is added as a note identified as such
  • Replies to the post are added as individual notes. I believe the Bluesky API currently limits API responses to 25 items, so there won't be more than that. I'm happy to add a check and manually truncate if required.

The translator isn't working on Safari / Safari Technology Preview (I tested successfully with Scaffold, Firefox, and Chrome). I can't see any reason for this besides an issue on Safari's side.

The Bsky API in fact returns all replies, which is a non-starter for popular posts which may have hundreds or thousands – we don't want to store a separate note for each. Instead, we now store a note with the number of direct replies at the time of storage, as an ISO datetime.
Bluesky.js Show resolved Hide resolved
@rmzelle
Copy link
Contributor

rmzelle commented Dec 20, 2024

Hi @AbeJellinek, could I please request a merge/review of this PR? The current translator-less items saved for Bluesky are not great.

@urschrei, my only other suggestion is to just label these items as "Post" instead of "Skeet", which seems a rather colloquial term (and also use "Post" for the Twitter and Mastodon translators for consistency).

Copy link
Member

@AbeJellinek AbeJellinek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Some comments/suggestions.

Bluesky.js Outdated Show resolved Hide resolved
Bluesky.js Outdated Show resolved Hide resolved
Bluesky.js Outdated Show resolved Hide resolved
Bluesky.js Outdated Show resolved Hide resolved
Bluesky.js Outdated Show resolved Hide resolved
Bluesky.js Outdated Show resolved Hide resolved
Bluesky.js Show resolved Hide resolved
@AbeJellinek
Copy link
Member

The translator isn't working on Safari / Safari Technology Preview

Any error in the debug log?

@urschrei
Copy link
Author

The translator isn't working on Safari / Safari Technology Preview

Any error in the debug log?

Looks like Safari-specific CORS policy errors

CORS errors from debug log
[JavaScript Error: "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://events.bsky.app/v2/initialize. (Reason: CORS request did not succeed). Status code: (null)."]

[JavaScript Error: "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://events.bsky.app/v2/rgstr. (Reason: CORS request did not succeed). Status code: (null)."]

[JavaScript Error: "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://events.bsky.app/v2/rgstr. (Reason: CORS request did not succeed). Status code: (null)."]

[JavaScript Error: "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://events.bsky.app/v2/initialize. (Reason: CORS request did not succeed). Status code: (null)."]

[JavaScript Error: "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://events.bsky.app/v2/initialize. (Reason: CORS request did not succeed). Status code: (null)."]

[JavaScript Error: "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://events.bsky.app/v2/rgstr. (Reason: CORS request did not succeed). Status code: (null)."]

[JavaScript Error: "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://events.bsky.app/v2/rgstr. (Reason: CORS request did not succeed). Status code: (null)."]

[JavaScript Error: "Referrer Policy: Ignoring the less restricted referrer policy “origin-when-cross-origin” for the cross-site request: https://statsigapi.net/v1/sdk_exception" {file: "https://bsky.app/static/js/870.86199908.js" line: 2}]

[JavaScript Error: "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://events.bsky.app/v2/initialize. (Reason: CORS request did not succeed). Status code: (null)."]

[JavaScript Error: "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://events.bsky.app/v2/initialize. (Reason: CORS request did not succeed). Status code: (null)."]

[JavaScript Error: "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://statsigapi.net/v1/sdk_exception. (Reason: CORS request did not succeed). Status code: (null)."]

[JavaScript Error: "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://statsigapi.net/v1/sdk_exception. (Reason: CORS request did not succeed). Status code: (null)."]

[JavaScript Error: "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://events.bsky.app/v2/rgstr. (Reason: CORS request did not succeed). Status code: (null)."]

[JavaScript Error: "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://events.bsky.app/v2/rgstr. (Reason: CORS request did not succeed). Status code: (null)."]

@urschrei
Copy link
Author

I've made the suggested changes: please lmk if the regex changes in detectWeb are what you had in mind. Some additions:

  • If it's available, we now add the handle (e.g. urschrei.bsky.social) to extras. We also add the DID to extras. This is always available as it uniquely identifies the author of a piece of content in the ATProto network.

  • I haven't been able to find a post with both a blank display name (i.e. "") AND an invalid handle, but we now bail out with an error if both of those conditions are met, as it's no longer possible to add a meaningful creator. The new test does exercise the invalid handle check, however.

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

Successfully merging this pull request may close these issues.

3 participants