Replies on public posts can default to unlisted

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

View File

@ -449,6 +449,12 @@ def _command_options() -> None:
type=str2bool, nargs='?',
const=True, default=False,
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",
dest='show_publish_as_icon',
type=str2bool, nargs='?',
@ -838,6 +844,13 @@ def _command_options() -> None:
print("--path option should not end with '/'")
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:
set_config_param(base_dir, 'admin', argb.setadmin)
sys.exit()
@ -3912,7 +3925,8 @@ def _command_options() -> None:
if __name__ == "__main__":
argb2, opt2 = _command_options()
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.mapFormat,
argb2.clacks,

View File

@ -873,8 +873,10 @@ def create_server_alice(path: str, domain: str, port: int,
map_format = 'gpx'
max_hashtags = 20
max_shares_on_profile = 8
public_replies_unlisted = False
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,
check_actor_timeout,
crawlers_allowed,
@ -1049,8 +1051,10 @@ def create_server_bob(path: str, domain: str, port: int,
map_format = 'gpx'
max_hashtags = 20
max_shares_on_profile = 8
public_replies_unlisted = False
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,
check_actor_timeout,
crawlers_allowed,
@ -1136,8 +1140,10 @@ def create_server_eve(path: str, domain: str, port: int, federation_list: [],
map_format = 'gpx'
max_hashtags = 20
max_shares_on_profile = 8
public_replies_unlisted = False
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,
check_actor_timeout,
crawlers_allowed,
@ -1225,8 +1231,10 @@ def create_server_group(path: str, domain: str, port: int,
map_format = 'gpx'
max_hashtags = 20
max_shares_on_profile = 8
public_replies_unlisted = False
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,
check_actor_timeout,
crawlers_allowed,