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

Add support for URL previews in matrix-rust-sdk #4063

Open
satrujit11 opened this issue Oct 3, 2024 · 1 comment
Open

Add support for URL previews in matrix-rust-sdk #4063

satrujit11 opened this issue Oct 3, 2024 · 1 comment

Comments

@satrujit11
Copy link

Description

We need to add support for URL previews in the matrix-rust-sdk, specifically using the matrix_sdk::ruma::api::client::media::get_media_preview endpoint. URL previews are essential for clients like Fractal, and these previews should be handled server-side as per the Matrix specification.

The API should handle two different endpoints, depending on the Matrix version supported by the homeserver (similar to how get_media_content works). This ensures backward compatibility with older versions of the Matrix protocol.

Requirements

  • Implement API support for URL previews using the get_media_preview endpoint.
  • Handle compatibility with multiple Matrix versions by supporting both relevant endpoints (similar to how get_media_content is handled).
  • Ensure that URL previews are done server-side, not client-side, as specified by the Matrix protocol.

Additional Context

This feature is important for integrating URL preview functionality into Fractal, so it would be ideal to implement the API in the matrix-rust-sdk first and then use it within Fractal. This ensures a proper and standardized implementation of URL previews.

Thanks @afranke for the help with this suggestion.

@satrujit11 satrujit11 closed this as not planned Won't fix, can't repro, duplicate, stale Oct 6, 2024
@satrujit11 satrujit11 reopened this Oct 6, 2024
@satrujit11
Copy link
Author

Hi Everyone,

I am currently working on a binding for the get_media_preview functionality. I will be utilizing two endpoints: api::client::authenticated_media::get_media_preview and api::client::media::get_media_preview depending oon the matrix version.

My plan is to handle the extraction of URLs from messages using the SDK. Then, I will use the API to get previews for one or more links and send that information back in a single call.

Could you please advise whether I should use regex for URL extraction, or are there specific methods or crates available in the codebase that would be more appropriate?

Additionally, I welcome any suggestions regarding the path I intend to follow.

Thank you!

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

No branches or pull requests

1 participant