dendrite icon indicating copy to clipboard operation
dendrite copied to clipboard

Url preview endpoint

Open adnull opened this issue 4 months ago • 1 comments

This PR introduces the missing URL Preview functionality ( Issue #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:

  • tests
  • synapse's ability to query/extract oEmbed resources

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

Signed-off-by: Aleksandr Dubovikov <[email protected]>

adnull avatar Sep 30 '24 11:09 adnull