From a0b47b37f846e36e8e2fe0e0b8fa07e7be3221df Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 9 Jan 2023 15:17:30 +0000 Subject: [PATCH] Sowing public replies as json --- daemon.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/daemon.py b/daemon.py index 1ea66fdf2..bd68c5960 100644 --- a/daemon.py +++ b/daemon.py @@ -277,6 +277,7 @@ from languages import set_actor_languages from languages import get_understood_languages from like import update_likes_collection from reaction import update_reaction_collection +from utils import is_public_post_from_url from utils import license_link_from_name from utils import acct_handle_dir from utils import load_reverse_timeline @@ -11588,10 +11589,10 @@ class PubServer(BaseHTTPRequestHandler): # get the replies file post_dir = \ acct_dir(base_dir, nickname, domain) + '/' + boxname + orig_post_url = http_prefix + ':##' + domain_full + '#users#' + \ + nickname + '#statuses#' + status_number post_replies_filename = \ - post_dir + '/' + \ - http_prefix + ':##' + domain_full + '#users#' + \ - nickname + '#statuses#' + status_number + '.replies' + post_dir + '/' + orig_post_url + '.replies' if not os.path.isfile(post_replies_filename): # There are no replies, # so show empty collection @@ -11720,6 +11721,13 @@ class PubServer(BaseHTTPRequestHandler): 'type': 'OrderedCollectionPage' } + # if the original post is public then return the replies + replies_are_public = \ + is_public_post_from_url(base_dir, nickname, domain, + orig_post_url) + if replies_are_public: + authorized = True + # populate the items list with replies populate_replies_json(base_dir, nickname, domain, post_replies_filename,