From 2813cd49de6016757f6b445d387a8f392aa92a6e Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 22 Feb 2022 11:11:55 +0000 Subject: [PATCH 1/3] Exception handling for outbox thread --- daemon.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/daemon.py b/daemon.py index dc3fe58ab..da83b077e 100644 --- a/daemon.py +++ b/daemon.py @@ -1526,8 +1526,12 @@ class PubServer(BaseHTTPRequestHandler): # remove any existing thread from the current index in the buffer if self.server.outboxThread.get(account_outbox_thread_name): acct = account_outbox_thread_name - if self.server.outboxThread[acct][index].is_alive(): - self.server.outboxThread[acct][index].kill() + if self.server.outboxThread[acct].get(index): + try: + if self.server.outboxThread[acct][index].is_alive(): + self.server.outboxThread[acct][index].kill() + except BaseException: + pass return index def _post_to_outbox_thread(self, message_json: {}) -> bool: From a41b0e6d312d4bf0c444fb3eac344751c9e0731f Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 22 Feb 2022 11:19:18 +0000 Subject: [PATCH 2/3] List not dict --- daemon.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/daemon.py b/daemon.py index da83b077e..603930312 100644 --- a/daemon.py +++ b/daemon.py @@ -1524,9 +1524,9 @@ class PubServer(BaseHTTPRequestHandler): self.server.outbox_thread_index[account_outbox_thread_name] = index # remove any existing thread from the current index in the buffer - if self.server.outboxThread.get(account_outbox_thread_name): - acct = account_outbox_thread_name - if self.server.outboxThread[acct].get(index): + acct = account_outbox_thread_name + if self.server.outboxThread.get(acct): + if len(self.server.outboxThread[acct]) > index: try: if self.server.outboxThread[acct][index].is_alive(): self.server.outboxThread[acct][index].kill() From 4f201ae658fdd8d26aa472212d44fea27e8a6c46 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 22 Feb 2022 12:03:56 +0000 Subject: [PATCH 3/3] Handle peertube videos path --- webapp_media.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/webapp_media.py b/webapp_media.py index ebde02736..912a6ae16 100644 --- a/webapp_media.py +++ b/webapp_media.py @@ -176,8 +176,13 @@ def _add_embedded_video_from_sites(translate: {}, content: str, if '/c/' in url: # don't try to embed peertube channel page continue - url = url.replace('/w/', '/embed/') + if '/w/' in url: + if '/videos/' not in url: + url = url.replace('/w/', '/videos/embed/') + else: + url = url.replace('/w/', '/embed/') url = url.replace('/watch/', '/embed/') + content += \ "
\n