diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2023-10-06 07:22:55 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-06 07:22:55 -0400 |
commit | 26b960b08ba0110ef3246e5749bb75b9b04a231c (patch) | |
tree | 986088fc432393048de330f6f28d82fc9892ab46 /synapse/media/media_repository.py | |
parent | Bump pyo3 from 0.17.1 to 0.19.2 (#16162) (diff) | |
download | synapse-26b960b08ba0110ef3246e5749bb75b9b04a231c.tar.xz |
Register media servlets via regex. (#16419)
This converts the media servlet URLs in the same way as (most) of the rest of Synapse. This will give more flexibility in the versions each endpoint exists under.
Diffstat (limited to 'synapse/media/media_repository.py')
-rw-r--r-- | synapse/media/media_repository.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/synapse/media/media_repository.py b/synapse/media/media_repository.py index 1b7b014f9a..d11c2ff4ee 100644 --- a/synapse/media/media_repository.py +++ b/synapse/media/media_repository.py @@ -48,6 +48,7 @@ from synapse.media.filepath import MediaFilePaths from synapse.media.media_storage import MediaStorage from synapse.media.storage_provider import StorageProviderWrapper from synapse.media.thumbnailer import Thumbnailer, ThumbnailError +from synapse.media.url_previewer import UrlPreviewer from synapse.metrics.background_process_metrics import run_as_background_process from synapse.types import UserID from synapse.util.async_helpers import Linearizer @@ -114,7 +115,7 @@ class MediaRepository: ) storage_providers.append(provider) - self.media_storage = MediaStorage( + self.media_storage: MediaStorage = MediaStorage( self.hs, self.primary_base_path, self.filepaths, storage_providers ) @@ -142,6 +143,13 @@ class MediaRepository: MEDIA_RETENTION_CHECK_PERIOD_MS, ) + if hs.config.media.url_preview_enabled: + self.url_previewer: Optional[UrlPreviewer] = UrlPreviewer( + hs, self, self.media_storage + ) + else: + self.url_previewer = None + def _start_update_recently_accessed(self) -> Deferred: return run_as_background_process( "update_recently_accessed_media", self._update_recently_accessed |