Compare commits

..

15 Commits

Author SHA1 Message Date
Tulir Asokan 53bf278f1e Bump version to 0.15.3 2025-07-16 11:50:47 +03:00
Tulir Asokan 35f137ccc1 Hardcode v11 for new rooms
Upcoming breaking changes in room v12 prevent safely using the default
room version and security embargoes prevent fixing them ahead of time.
2025-07-15 14:20:19 +03:00
Tulir Asokan 31846e7a98 Update changelog 2025-06-16 13:33:52 +03:00
Tulir Asokan 9ab2ee2970 Disable reply fallbacks by default 2025-06-16 13:24:17 +03:00
Tulir Asokan c7dd08ecd1 Update dependencies 2025-06-16 13:20:07 +03:00
Tulir Asokan 8fbd723bfa Enable captions by default 2025-05-07 13:40:39 +03:00
Tulir Asokan 530bd9e52e Update telethon 2025-04-19 15:32:39 +03:00
Tulir Asokan 6480e7925e Fix login QR filename 2025-03-19 20:47:08 +02:00
Tulir Asokan c70ab2a12b Update Telethon 2025-03-19 20:47:08 +02:00
Tulir Asokan 070bfd4f55 Update dependencies 2025-03-09 13:10:39 +02:00
Tulir Asokan 88c3a93526 Fix text in poll bridging 2025-03-09 13:07:29 +02:00
Tulir Asokan caefda582b Disable kicking unauthenticated users 2025-01-19 20:38:39 +02:00
Tulir Asokan e1b181ed55 Update mautrix-python to support MSC4190 2025-01-15 18:54:54 +02:00
Tulir Asokan cc6a915ef4 Update dependencies 2025-01-15 17:54:33 +02:00
Tulir Asokan de4df57278 Ignore partial quotes on sticker messages 2025-01-15 17:49:18 +02:00
10 changed files with 43 additions and 22 deletions
+12
View File
@@ -1,3 +1,15 @@
# v0.15.3 (2025-07-16)
* Updated Telegram API to layer 204.
* Added support for MSC4190.
* Enabled captions by default, as they are now supported by most clients.
* Existing configs will still need to enable `caption_in_message` manually.
* Changed new room creation to hardcode room v11 to avoid v12 rooms being
created before proper support for them can be added.
* Fixed bridging sticker messages with partial quote replies from Telegram.
* Fixed text in poll bridging.
* Disabled kicking unauthenticated users from portals.
# v0.15.2 (2024-07-16)
* Dropped support for Python 3.9.
+1 -1
View File
@@ -1,2 +1,2 @@
__version__ = "0.15.2"
__version__ = "0.15.3"
__author__ = "Tulir Asokan <tulir@maunium.net>"
@@ -121,6 +121,7 @@ async def login_qr(evt: CommandEvent) -> EventID:
mxc = await evt.az.intent.upload_media(qr, "image/png", "login-qr.png", len(qr))
content = MediaMessageEventContent(
body=qr_login.url,
filename="login-qr.png",
url=mxc,
msgtype=MessageType.IMAGE,
info=ImageInfo(mimetype="image/png", size=len(qr), width=size, height=size),
+10 -4
View File
@@ -216,8 +216,7 @@ bridge:
# to resolve redirects in invite links.
invite_link_resolve: false
# Send captions in the same message as images. This will send data compatible with both MSC2530 and MSC3552.
# This is currently not supported in most clients.
caption_in_message: false
caption_in_message: true
# Maximum size of image in megabytes before sending to Telegram as a document.
image_as_file_size: 10
# Maximum number of pixels in an image before sending to Telegram as a document. Defaults to 4096x4096 = 16777216.
@@ -272,8 +271,15 @@ bridge:
# Default to encryption, force-enable encryption in all portals the bridge creates
# This will cause the bridge bot to be in private chats for the encryption to work properly.
default: false
# Whether to use MSC2409/MSC3202 instead of /sync long polling for receiving encryption-related data.
# Whether to use MSC3202/MSC4203 instead of /sync long polling for receiving encryption-related data.
# This option is not yet compatible with standard Matrix servers like Synapse and should not be used.
# Changing this option requires updating the appservice registration file.
appservice: false
# Whether to use MSC4190 instead of appservice login to create the bridge bot device.
# Requires the homeserver to support MSC4190 and the device masquerading parts of MSC3202.
# Only relevant when using end-to-bridge encryption, required when using encryption with next-gen auth (MSC3861).
# Changing this option requires updating the appservice registration file.
msc4190: false
# Require encryption, drop any unencrypted messages.
require: false
# Enable key sharing? If enabled, key requests for rooms where users are in will be fulfilled.
@@ -346,7 +352,7 @@ bridge:
private_chat_portal_meta: default
# Disable generating reply fallbacks? Some extremely bad clients still rely on them,
# but they're being phased out and will be completely removed in the future.
disable_reply_fallbacks: false
disable_reply_fallbacks: true
# Should cross-chat replies from Telegram be bridged? Most servers and clients don't support this.
cross_room_replies: false
# Whether or not the bridge should send a read receipt from the bridge bot when a message has
+3 -2
View File
@@ -70,7 +70,6 @@ from telethon.tl.functions.channels import (
InviteToChannelRequest,
JoinChannelRequest,
UpdateUsernameRequest,
ViewSponsoredMessageRequest,
)
from telethon.tl.functions.messages import (
AddChatUserRequest,
@@ -87,6 +86,7 @@ from telethon.tl.functions.messages import (
SetTypingRequest,
UnpinAllMessagesRequest,
UpdatePinnedMessageRequest,
ViewSponsoredMessageRequest,
)
from telethon.tl.patched import Message, MessageService
from telethon.tl.types import (
@@ -1038,6 +1038,7 @@ class Portal(DBPortal, BasePortal):
initial_state=initial_state,
creation_content=creation_content,
beeper_auto_join_invites=autojoin_invites,
room_version="11",
)
if not room_id:
raise Exception(f"Failed to create room")
@@ -1200,7 +1201,7 @@ class Portal(DBPortal, BasePortal):
continue
if mx_user.is_bot:
await mx_user.unregister_portal(*self.tgid_full)
if not self.has_bot:
if not self.has_bot and mx_user.tgid:
try:
await self.main_intent.kick_user(
self.mxid, mx_user.mxid, "You had left this Telegram chat."
@@ -282,7 +282,7 @@ class TelegramMessageConverter:
elif isinstance(evt.reply_to, MessageReplyStoryHeader):
return
if evt.reply_to.quote and content.msgtype.is_text:
if evt.reply_to.quote and content.msgtype and content.msgtype.is_text:
content.ensure_has_html()
quote_html = await formatter.telegram_text_to_matrix_html(
source, evt.reply_to.quote_text, evt.reply_to.quote_entities
@@ -763,18 +763,18 @@ class TelegramMessageConverter:
_n += 1
return _n
text_answers = "\n".join(f"{n()}. {answer.text}" for answer in poll.answers)
html_answers = "\n".join(f"<li>{answer.text}</li>" for answer in poll.answers)
text_answers = "\n".join(f"{n()}. {answer.text.text}" for answer in poll.answers)
html_answers = "\n".join(f"<li>{answer.text.text}</li>" for answer in poll.answers)
vote_command = f"{self.command_prefix} vote {poll_id}"
content = TextMessageEventContent(
msgtype=MessageType.TEXT,
format=Format.HTML,
body=(
f"Poll: {poll.question}\n{text_answers}\n"
f"Poll: {poll.question.text}\n{text_answers}\n"
f"Vote with {vote_command} <choice number>"
),
formatted_body=(
f"<strong>Poll</strong>: {poll.question}<br/>\n"
f"<strong>Poll</strong>: {poll.question.text}<br/>\n"
f"<ol>{html_answers}</ol>\n"
f"Vote with <code>{vote_command} &lt;choice number&gt;</code>"
),
@@ -18,7 +18,7 @@ from __future__ import annotations
import base64
import html
from telethon.tl.functions.channels import GetSponsoredMessagesRequest
from telethon.tl.functions.messages import GetSponsoredMessagesRequest
from telethon.tl.types import Channel, InputChannel, PeerChannel, PeerUser, SponsoredMessage, User
from telethon.tl.types.messages import SponsoredMessages, SponsoredMessagesEmpty
+6 -6
View File
@@ -2,19 +2,19 @@
# Uncommented lines after the group definition insert things into that group.
#/speedups
cryptg>=0.1,<0.5
cryptg>=0.1,<0.6
aiodns
brotli
#/qr_login
pillow>=10.0.1,<11
qrcode>=6,<8
pillow>=10.0.1,<12
qrcode>=6,<9
#/formattednumbers
phonenumbers>=8,<9
phonenumbers>=8,<10
#/metrics
prometheus_client>=0.6,<0.21
prometheus_client>=0.6,<0.23
#/e2be
python-olm>=3,<4
@@ -22,7 +22,7 @@ pycryptodome>=3,<4
unpaddedbase64>=1,<3
#/sqlite
aiosqlite>=0.16,<0.21
aiosqlite>=0.16,<0.22
#/proxy
python-socks[asyncio]
+3 -3
View File
@@ -3,8 +3,8 @@ python-magic>=0.4,<0.5
commonmark>=0.8,<0.10
aiohttp>=3,<4
yarl>=1,<2
mautrix>=0.20.6,<0.21
tulir-telethon==1.37.0a1
asyncpg>=0.20,<0.30
mautrix>=0.20.8,<0.21
tulir-telethon==1.99.0a6
asyncpg>=0.20,<1
mako>=1,<2
setuptools
+1
View File
@@ -63,6 +63,7 @@ setuptools.setup(
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
],
package_data={"mautrix_telegram": [
"web/public/*.mako", "web/public/*.png", "web/public/*.css",