From cd75cb0d351f33400a4c2de2387a890998d18cca Mon Sep 17 00:00:00 2001 From: Andrew Ferrazzutti Date: Thu, 22 Jul 2021 03:26:39 -0400 Subject: [PATCH] Minor tweaks --- matrix_puppeteer_line/portal.py | 4 ++-- matrix_puppeteer_line/user.py | 8 +++++--- puppet/src/contentscript.js | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/matrix_puppeteer_line/portal.py b/matrix_puppeteer_line/portal.py index bda9e26..2036e8a 100644 --- a/matrix_puppeteer_line/portal.py +++ b/matrix_puppeteer_line/portal.py @@ -136,8 +136,8 @@ class Portal(DBPortal, BasePortal): async def handle_matrix_message(self, sender: 'u.User', message: MessageEventContent, event_id: EventID) -> None: - if not sender.client: - self.log.debug(f"Ignoring message {event_id} as user is not connected") + if not await sender.is_logged_in(): + self.log.debug(f"Ignoring message {event_id} as sender {sender.mxid} is not connected") return elif ((message.get(self.bridge.real_user_content_key, False) and await p.Puppet.get_by_custom_mxid(sender.mxid))): diff --git a/matrix_puppeteer_line/user.py b/matrix_puppeteer_line/user.py index bccc482..6dc7a55 100644 --- a/matrix_puppeteer_line/user.py +++ b/matrix_puppeteer_line/user.py @@ -178,9 +178,11 @@ class User(DBUser, BaseUser): chat_id = portal.chat_id self.log.info(f"Viewing (and syncing) chat {chat_id}") await self.client.pause() - chat = await self.client.get_chat(chat_id, True) - await portal.update_matrix_room(self, chat) - await self.client.resume() + try: + chat = await self.client.get_chat(chat_id, True) + await portal.update_matrix_room(self, chat) + finally: + await self.client.resume() async def sync_own_profile(self) -> None: self.log.info("Syncing own LINE profile info") diff --git a/puppet/src/contentscript.js b/puppet/src/contentscript.js index a629f83..e6eba83 100644 --- a/puppet/src/contentscript.js +++ b/puppet/src/contentscript.js @@ -1752,7 +1752,7 @@ new MutationObserver(() => { if (!layer.classList.contains("MdNonDisp")) { const button = layer.querySelector("dialog button") if (button) { - console.log("Something expired, clicking OK button to continue") + console.log("Popup appeared, clicking OK button to continue") button.click() } }