From a7e68e3e0ed57de37ecf2d3e3aea55de632e917a Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 13 Feb 2022 10:55:01 +0000 Subject: [PATCH 1/2] Avoid double file access for handles with @ prefix --- follow.py | 2 ++ webapp_podcast.py | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/follow.py b/follow.py index 73fc2eb90..e229502f8 100644 --- a/follow.py +++ b/follow.py @@ -177,6 +177,8 @@ def is_following_actor(base_dir: str, following_file = base_dir + '/accounts/' + handle + '/following.txt' if not os.path.isfile(following_file): return False + if actor.startswith('@'): + actor = actor[1:] if actor.lower() in open(following_file).read().lower(): return True following_nickname = get_nickname_from_actor(actor) diff --git a/webapp_podcast.py b/webapp_podcast.py index 3dedca232..80e9dd2c7 100644 --- a/webapp_podcast.py +++ b/webapp_podcast.py @@ -32,14 +32,15 @@ def _html_podcast_social_interactions(podcast_properties: {}, return '' if not podcast_properties['socialInteract'].get('text'): return '' - post_url = podcast_properties['socialInteract']['text'] + episode_post_url = podcast_properties['socialInteract']['text'] + podcast_str = \ '
\n' + \ ' 💬 ' + \ translate['Leave a comment'] + '\n' + \ - ' ' + \ translate['View comments'] + '\n' + \ '
\n' From b3db0c8ea5cd611f68a2b18b966c6a7a38e7e75c Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 13 Feb 2022 11:30:11 +0000 Subject: [PATCH 2/2] Add replyto actor if available --- webapp_podcast.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/webapp_podcast.py b/webapp_podcast.py index 80e9dd2c7..bdfc85df6 100644 --- a/webapp_podcast.py +++ b/webapp_podcast.py @@ -33,11 +33,17 @@ def _html_podcast_social_interactions(podcast_properties: {}, if not podcast_properties['socialInteract'].get('text'): return '' episode_post_url = podcast_properties['socialInteract']['text'] + actor_str = '' + if podcast_properties['socialInteract'].get('accountId'): + actor_handle = podcast_properties['socialInteract']['accountId'] + if actor_handle.startswith('@'): + actor_handle = actor_handle[1:] + actor_str = '?actor=' + actor_handle podcast_str = \ '
\n' + \ ' 💬 ' + \ translate['Leave a comment'] + '\n' + \ '