Remove max_document_size option and use media repo config directly
This commit is contained in:
@@ -137,7 +137,6 @@ class Config(BaseBridgeConfig):
|
|||||||
copy("bridge.inline_images")
|
copy("bridge.inline_images")
|
||||||
copy("bridge.image_as_file_size")
|
copy("bridge.image_as_file_size")
|
||||||
copy("bridge.image_as_file_pixels")
|
copy("bridge.image_as_file_pixels")
|
||||||
copy("bridge.max_document_size")
|
|
||||||
copy("bridge.parallel_file_transfer")
|
copy("bridge.parallel_file_transfer")
|
||||||
copy("bridge.federate_rooms")
|
copy("bridge.federate_rooms")
|
||||||
copy("bridge.animated_sticker.target")
|
copy("bridge.animated_sticker.target")
|
||||||
|
|||||||
@@ -210,8 +210,6 @@ bridge:
|
|||||||
image_as_file_size: 10
|
image_as_file_size: 10
|
||||||
# Maximum number of pixels in an image before sending to Telegram as a document. Defaults to 1280x1280 = 1638400.
|
# Maximum number of pixels in an image before sending to Telegram as a document. Defaults to 1280x1280 = 1638400.
|
||||||
image_as_file_pixels: 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
|
# Enable experimental parallel file transfer, which makes uploads/downloads much faster by
|
||||||
# streaming from/to Matrix and using many connections for Telegram.
|
# streaming from/to Matrix and using many connections for Telegram.
|
||||||
# Note that generating HQ thumbnails for videos is not possible with streamed transfers.
|
# Note that generating HQ thumbnails for videos is not possible with streamed transfers.
|
||||||
|
|||||||
@@ -2354,7 +2354,7 @@ class Portal(DBPortal, BasePortal):
|
|||||||
|
|
||||||
attrs = self._parse_telegram_document_attributes(document.attributes)
|
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 ""
|
name = attrs.name or ""
|
||||||
caption = f"\n{evt.message}" if evt.message else ""
|
caption = f"\n{evt.message}" if evt.message else ""
|
||||||
# TODO encrypt
|
# TODO encrypt
|
||||||
@@ -2758,7 +2758,7 @@ class Portal(DBPortal, BasePortal):
|
|||||||
"chats": self.peer_type == "chat",
|
"chats": self.peer_type == "chat",
|
||||||
"users": self.peer_type == "user",
|
"users": self.peer_type == "user",
|
||||||
"channels": (self.peer_type == "channel" and not self.megagroup),
|
"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(
|
async def backfill(
|
||||||
|
|||||||
Reference in New Issue
Block a user