Replies on public posts can default to unlisted

merge-requests/30/head
Bob Mottram 2023-09-20 18:42:09 +01:00
parent 20803dd1c9
commit 5e8cb2673e
3 changed files with 36 additions and 7 deletions

View File

@ -20223,7 +20223,11 @@ class PubServer(BaseHTTPRequestHandler):
# if m.startswith('actor='): # if m.startswith('actor='):
# replytoActor = m.replace('actor=', '') # replytoActor = m.replace('actor=', '')
in_reply_to_url = mentions_list[0] in_reply_to_url = mentions_list[0]
if not self.path.public_replies_unlisted:
self.path = self.path.split('?replyto=')[0] + '/newpost' self.path = self.path.split('?replyto=')[0] + '/newpost'
else:
self.path = \
self.path.split('?replyto=')[0] + '/newunlisted'
if self.server.debug: if self.server.debug:
print('DEBUG: replyto path ' + self.path) print('DEBUG: replyto path ' + self.path)
@ -23863,7 +23867,8 @@ def load_tokens(base_dir: str, tokens_dict: {}, tokens_lookup: {}) -> None:
break break
def run_daemon(max_shares_on_profile: int, def run_daemon(public_replies_unlisted: int,
max_shares_on_profile: int,
max_hashtags: int, max_hashtags: int,
map_format: str, map_format: str,
clacks: str, clacks: str,
@ -24001,6 +24006,8 @@ def run_daemon(max_shares_on_profile: int,
else: else:
httpd.clacks = 'GNU Natalie Nguyen' httpd.clacks = 'GNU Natalie Nguyen'
httpd.public_replies_unlisted = public_replies_unlisted
# load a list of dogwhistle words # load a list of dogwhistle words
dogwhistles_filename = base_dir + '/accounts/dogwhistles.txt' dogwhistles_filename = base_dir + '/accounts/dogwhistles.txt'
if not os.path.isfile(dogwhistles_filename): if not os.path.isfile(dogwhistles_filename):

View File

@ -449,6 +449,12 @@ def _command_options() -> None:
type=str2bool, nargs='?', type=str2bool, nargs='?',
const=True, default=False, const=True, default=False,
help="Caldav") help="Caldav")
parser.add_argument("--public_replies_unlisted",
dest='public_replies_unlisted',
type=str2bool, nargs='?',
const=True, default=False,
help="Whether replies to public posts " +
"should be unlisted")
parser.add_argument("--show_publish_as_icon", parser.add_argument("--show_publish_as_icon",
dest='show_publish_as_icon', dest='show_publish_as_icon',
type=str2bool, nargs='?', type=str2bool, nargs='?',
@ -838,6 +844,13 @@ def _command_options() -> None:
print("--path option should not end with '/'") print("--path option should not end with '/'")
sys.exit() sys.exit()
if not argb.public_replies_unlisted:
pub_replies_unlisted = \
get_config_param(base_dir, 'publicRepliesUnlisted')
if pub_replies_unlisted is not None:
if isinstance(pub_replies_unlisted, bool):
argb.public_replies_unlisted = pub_replies_unlisted
if argb.setadmin: if argb.setadmin:
set_config_param(base_dir, 'admin', argb.setadmin) set_config_param(base_dir, 'admin', argb.setadmin)
sys.exit() sys.exit()
@ -3912,7 +3925,8 @@ def _command_options() -> None:
if __name__ == "__main__": if __name__ == "__main__":
argb2, opt2 = _command_options() argb2, opt2 = _command_options()
print('allowdeletion: ' + str(argb2.allowdeletion)) print('allowdeletion: ' + str(argb2.allowdeletion))
run_daemon(argb2.max_shares_on_profile, run_daemon(argb2.public_replies_unlisted,
argb2.max_shares_on_profile,
argb2.max_hashtags, argb2.max_hashtags,
argb2.mapFormat, argb2.mapFormat,
argb2.clacks, argb2.clacks,

View File

@ -873,8 +873,10 @@ def create_server_alice(path: str, domain: str, port: int,
map_format = 'gpx' map_format = 'gpx'
max_hashtags = 20 max_hashtags = 20
max_shares_on_profile = 8 max_shares_on_profile = 8
public_replies_unlisted = False
print('Server running: Alice') print('Server running: Alice')
run_daemon(max_shares_on_profile, max_hashtags, map_format, run_daemon(public_replies_unlisted,
max_shares_on_profile, max_hashtags, map_format,
clacks, preferred_podcast_formats, clacks, preferred_podcast_formats,
check_actor_timeout, check_actor_timeout,
crawlers_allowed, crawlers_allowed,
@ -1049,8 +1051,10 @@ def create_server_bob(path: str, domain: str, port: int,
map_format = 'gpx' map_format = 'gpx'
max_hashtags = 20 max_hashtags = 20
max_shares_on_profile = 8 max_shares_on_profile = 8
public_replies_unlisted = False
print('Server running: Bob') print('Server running: Bob')
run_daemon(max_shares_on_profile, max_hashtags, map_format, run_daemon(public_replies_unlisted,
max_shares_on_profile, max_hashtags, map_format,
clacks, preferred_podcast_formats, clacks, preferred_podcast_formats,
check_actor_timeout, check_actor_timeout,
crawlers_allowed, crawlers_allowed,
@ -1136,8 +1140,10 @@ def create_server_eve(path: str, domain: str, port: int, federation_list: [],
map_format = 'gpx' map_format = 'gpx'
max_hashtags = 20 max_hashtags = 20
max_shares_on_profile = 8 max_shares_on_profile = 8
public_replies_unlisted = False
print('Server running: Eve') print('Server running: Eve')
run_daemon(max_shares_on_profile, max_hashtags, map_format, run_daemon(public_replies_unlisted,
max_shares_on_profile, max_hashtags, map_format,
clacks, preferred_podcast_formats, clacks, preferred_podcast_formats,
check_actor_timeout, check_actor_timeout,
crawlers_allowed, crawlers_allowed,
@ -1225,8 +1231,10 @@ def create_server_group(path: str, domain: str, port: int,
map_format = 'gpx' map_format = 'gpx'
max_hashtags = 20 max_hashtags = 20
max_shares_on_profile = 8 max_shares_on_profile = 8
public_replies_unlisted = False
print('Server running: Group') print('Server running: Group')
run_daemon(max_shares_on_profile, max_hashtags, map_format, run_daemon(public_replies_unlisted,
max_shares_on_profile, max_hashtags, map_format,
clacks, preferred_podcast_formats, clacks, preferred_podcast_formats,
check_actor_timeout, check_actor_timeout,
crawlers_allowed, crawlers_allowed,