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

Url preview endpoint #3444

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open

Url preview endpoint #3444

wants to merge 17 commits into from

Conversation

adnull
Copy link
Contributor

@adnull adnull commented Nov 14, 2024

This PR introduces the missing URL Preview functionality ( Issue matrix-org/dendrite#1303 )

According to the specification that endpoint requests require authentication and are rate limited. There are both endpoints (v1 and v3) as some clients still use deprecated endpoints for url preview requests.

Key features:

  • takes info from html pages or image links. Max image size downloadable is configurable. Timeout is configurable
  • stores the url's image as a thumbnail in media storage if the thumbnail size for url previews is configured. Otherwise stores the original image (to make it sy-test compatible).
  • uses the maxThumbnailGenerators variable to prevent overload. Waits 30s for free generator.
  • keeps an in-memory cache of url preview responses. The cache entry expiration time is configurable
  • stores the the url preview json responses in the media storage to prevent any extra load
  • url preview blacklist is configurable as a list of regexps in the config

Missing:

  • some tests
  • synapse's ability to query/extract oEmbed resources
  • ip blacklist checks

I'd like somebody to take a look at the code.

Signed-off-by: adnull <d.lexand@gmail.com>

Signed-off-by: Aleksandr Dubovikov <d.lexand@gmail.com>
Signed-off-by: Aleksandr Dubovikov <d.lexand@gmail.com>
Signed-off-by: Aleksandr Dubovikov <d.lexand@gmail.com>
Signed-off-by: Aleksandr Dubovikov <d.lexand@gmail.com>
Signed-off-by: Aleksandr Dubovikov <d.lexand@gmail.com>
Signed-off-by: Aleksandr Dubovikov <d.lexand@gmail.com>
Signed-off-by: Aleksandr Dubovikov <d.lexand@gmail.com>
Signed-off-by: Aleksandr Dubovikov <d.lexand@gmail.com>
Signed-off-by: Aleksandr Dubovikov <d.lexand@gmail.com>
Signed-off-by: Aleksandr Dubovikov <d.lexand@gmail.com>
Signed-off-by: Aleksandr Dubovikov <d.lexand@gmail.com>
@adnull adnull requested a review from a team as a code owner November 14, 2024 18:23
@CLAassistant
Copy link

CLAassistant commented Nov 14, 2024

CLA assistant check
All committers have signed the CLA.

Signed-off-by: adnull <d.lexand@gmail.com>
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