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

Update BlueskyBridge.php #4367

Merged
merged 5 commits into from
Jan 2, 2025
Merged

Update BlueskyBridge.php #4367

merged 5 commits into from
Jan 2, 2025

Conversation

mruac
Copy link
Contributor

@mruac mruac commented Dec 15, 2024

  • Used human readable terms
  • Include quote and reply post
  • Added video support
  • Replaced Youtube embed with thumbnail preview
  • Added link embed preview
  • Included visible alt text to images

* Used human readable terms
* Include quote and reply post
* Added video support
* Replaced Youtube embed with thumbnail preview
* Added link embed preview
* Included visible alt text to images
Copy link

github-actions bot commented Dec 15, 2024

Pull request artifacts

Bridge Context Status
Bluesky 1 untitled (current) ✔️
Bluesky 1 untitled (pr) ✔️

last change: Friday 2024-12-20 11:11:32

$facets = $record['facets'];
foreach ($facets as $facet) {
if ($facet['features'][0]['$type'] === 'app.bsky.richtext.facet#link') {
$substring = substr($text_copy, $facet['index']['byteStart'], $facet['index']['byteEnd'] - $facet['index']['byteStart']);
Copy link
Contributor

Choose a reason for hiding this comment

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

Careful... does it break for unicode text?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think so. Testing with urls that have emojis and international characters in them are either converted to punycode or percent coded when published. When using rich text via third party clients, PHP was able to get the right string from the byte indexes alone.

$description .= $this->parseExternal($post['post']['record']['embed']['external'], $authorDid);
if (Debug::isEnabled()) {
$url = explode('/', $post['post']['uri']);
error_log('https://bsky.app/profile/' . $url[2] . '/post/' . $url[4]);
Copy link
Contributor

Choose a reason for hiding this comment

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

Please dont use error_log directly. Use $this->logger->warning() or $this->logger->error()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

noted, this should probably be mentioned in the documentation.

@dvikan dvikan merged commit 2a44a00 into RSS-Bridge:master Jan 2, 2025
8 of 9 checks passed
@dvikan
Copy link
Contributor

dvikan commented Jan 2, 2025

I merged despite my nit picks. Good work @mruac !

@mruac
Copy link
Contributor Author

mruac commented Jan 4, 2025

Thank you! Being nit picky to an extent is good to keep coding styles uniform and readable.
When I finish working on another bridge I'll look to expand this further to support User Lists, Feeds and Starter packs.

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 this pull request may close these issues.

2 participants