From 1eeabd4e11f362d8653577c378a18ba9f2bd90d8 Mon Sep 17 00:00:00 2001 From: Christopher Johnstone Date: Wed, 16 Apr 2025 10:56:14 -0400 Subject: [PATCH] Check login flows only if MSC4190 is not enabled Currently, the homeserver login flows are checked even if MSC4190 is enabled. However, the `flows` variable is unused when MSC4190 is enabled. This is an unnecessary network call, and also e.g. requires a reverse proxy soley for this purpose if bridges would otherwise directly connect to a homeserver that is delegating OIDC authentication. Closes #177. --- mautrix/bridge/e2ee.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mautrix/bridge/e2ee.py b/mautrix/bridge/e2ee.py index 266c8db9..56270942 100644 --- a/mautrix/bridge/e2ee.py +++ b/mautrix/bridge/e2ee.py @@ -247,12 +247,13 @@ async def decrypt(self, evt: EncryptedEvent, wait_session_timeout: int = 5) -> M return decrypted async def start(self) -> None: - flows = await self.client.get_login_flows() - if not self.msc4190 and not flows.supports_type(LoginType.APPSERVICE): - self.log.critical( - "Encryption enabled in config, but homeserver does not support appservice login" - ) - sys.exit(30) + if not self.msc4190: + flows = await self.client.get_login_flows() + if not flows.supports_type(LoginType.APPSERVICE): + self.log.critical( + "Encryption enabled in config, but homeserver does not support appservice login" + ) + sys.exit(30) self.log.debug("Logging in with bridge bot user") if self.crypto_db: try: