Remove max_document_size option and use media repo config directly

This commit is contained in:
Tulir Asokan
2022-02-20 13:47:40 +02:00
parent 4a55cf589c
commit 951d82ad27
3 changed files with 2 additions and 5 deletions
-1
View File
@@ -137,7 +137,6 @@ class Config(BaseBridgeConfig):
copy("bridge.inline_images")
copy("bridge.image_as_file_size")
copy("bridge.image_as_file_pixels")
copy("bridge.max_document_size")
copy("bridge.parallel_file_transfer")
copy("bridge.federate_rooms")
copy("bridge.animated_sticker.target")
-2
View File
@@ -210,8 +210,6 @@ bridge:
image_as_file_size: 10
# Maximum number of pixels in an image before sending to Telegram as a document. Defaults to 1280x1280 = 1638400.
image_as_file_pixels: 1638400
# Maximum size of Telegram documents in megabytes to bridge.
max_document_size: 100
# Enable experimental parallel file transfer, which makes uploads/downloads much faster by
# streaming from/to Matrix and using many connections for Telegram.
# Note that generating HQ thumbnails for videos is not possible with streamed transfers.
+2 -2
View File
@@ -2354,7 +2354,7 @@ class Portal(DBPortal, BasePortal):
attrs = self._parse_telegram_document_attributes(document.attributes)
if document.size > self.config["bridge.max_document_size"] * 1000**2:
if document.size > self.matrix.media_config.upload_size:
name = attrs.name or ""
caption = f"\n{evt.message}" if evt.message else ""
# TODO encrypt
@@ -2758,7 +2758,7 @@ class Portal(DBPortal, BasePortal):
"chats": self.peer_type == "chat",
"users": self.peer_type == "user",
"channels": (self.peer_type == "channel" and not self.megagroup),
"max_file_size": min(self.config["bridge.max_document_size"], 2000) * 1024 * 1024,
"max_file_size": min(self.matrix.media_config.upload_size, 2000 * 1024 * 1024),
}
async def backfill(