mirror of https://gitlab.com/bashrc2/epicyon
parent
a9e9cbe515
commit
c0e4c5540a
|
|
@ -148,7 +148,6 @@ from cwlists import get_cw_list_variable
|
||||||
from cache import remove_avatar_from_cache
|
from cache import remove_avatar_from_cache
|
||||||
from cache import store_person_in_cache
|
from cache import store_person_in_cache
|
||||||
from daemon_utils import post_to_outbox
|
from daemon_utils import post_to_outbox
|
||||||
from data import save_string
|
|
||||||
|
|
||||||
|
|
||||||
def _profile_post_deactivate_account(base_dir: str, nickname: str, domain: str,
|
def _profile_post_deactivate_account(base_dir: str, nickname: str, domain: str,
|
||||||
|
|
@ -251,9 +250,12 @@ def _profile_post_git_projects(base_dir: str, nickname: str, domain: str,
|
||||||
git_projects_filename = \
|
git_projects_filename = \
|
||||||
acct_dir(base_dir, nickname, domain) + '/gitprojects.txt'
|
acct_dir(base_dir, nickname, domain) + '/gitprojects.txt'
|
||||||
if fields.get('gitProjects'):
|
if fields.get('gitProjects'):
|
||||||
text = fields['gitProjects'].lower()
|
try:
|
||||||
save_string(text, git_projects_filename,
|
with open(git_projects_filename, 'w+',
|
||||||
'EX: unable to write git ' + git_projects_filename)
|
encoding='utf-8') as fp_git:
|
||||||
|
fp_git.write(fields['gitProjects'].lower())
|
||||||
|
except OSError:
|
||||||
|
print('EX: unable to write git ' + git_projects_filename)
|
||||||
else:
|
else:
|
||||||
if os.path.isfile(git_projects_filename):
|
if os.path.isfile(git_projects_filename):
|
||||||
try:
|
try:
|
||||||
|
|
@ -270,8 +272,12 @@ def _profile_post_peertube_instances(base_dir: str, fields: {}, self,
|
||||||
peertube_instances_file = data_dir(base_dir) + '/peertube.txt'
|
peertube_instances_file = data_dir(base_dir) + '/peertube.txt'
|
||||||
if fields.get('ptInstances'):
|
if fields.get('ptInstances'):
|
||||||
peertube_instances.clear()
|
peertube_instances.clear()
|
||||||
save_string(fields['ptInstances'], peertube_instances_file,
|
try:
|
||||||
'EX: unable to write peertube ' +
|
with open(peertube_instances_file, 'w+',
|
||||||
|
encoding='utf-8') as fp_peertube:
|
||||||
|
fp_peertube.write(fields['ptInstances'])
|
||||||
|
except OSError:
|
||||||
|
print('EX: unable to write peertube ' +
|
||||||
peertube_instances_file)
|
peertube_instances_file)
|
||||||
pt_instances_list = fields['ptInstances'].split('\n')
|
pt_instances_list = fields['ptInstances'].split('\n')
|
||||||
if pt_instances_list:
|
if pt_instances_list:
|
||||||
|
|
@ -325,8 +331,12 @@ def _profile_post_robots_txt(base_dir: str, fields: {}, self) -> None:
|
||||||
' unable to delete ' +
|
' unable to delete ' +
|
||||||
robots_txt_filename)
|
robots_txt_filename)
|
||||||
else:
|
else:
|
||||||
save_string(new_robots_txt, robots_txt_filename,
|
try:
|
||||||
'EX: _profile_post_robots_txt unable to save ' +
|
with open(robots_txt_filename, 'w+',
|
||||||
|
encoding='utf-8') as fp_robots:
|
||||||
|
fp_robots.write(new_robots_txt)
|
||||||
|
except OSError:
|
||||||
|
print('EX: _profile_post_robots_txt unable to save ' +
|
||||||
robots_txt_filename)
|
robots_txt_filename)
|
||||||
|
|
||||||
self.server.robots_txt = new_robots_txt
|
self.server.robots_txt = new_robots_txt
|
||||||
|
|
@ -439,8 +449,12 @@ def _profile_post_allowed_instances(base_dir: str, nickname: str, domain: str,
|
||||||
acct_dir(base_dir, nickname, domain) + '/allowedinstances.txt'
|
acct_dir(base_dir, nickname, domain) + '/allowedinstances.txt'
|
||||||
if fields.get('allowedInstances'):
|
if fields.get('allowedInstances'):
|
||||||
inst_filename = allowed_instances_filename
|
inst_filename = allowed_instances_filename
|
||||||
save_string(fields['allowedInstances'], inst_filename,
|
try:
|
||||||
'EX: unable to write allowed instances ' +
|
with open(inst_filename, 'w+',
|
||||||
|
encoding='utf-8') as fp_inst:
|
||||||
|
fp_inst.write(fields['allowedInstances'])
|
||||||
|
except OSError:
|
||||||
|
print('EX: unable to write allowed instances ' +
|
||||||
allowed_instances_filename)
|
allowed_instances_filename)
|
||||||
else:
|
else:
|
||||||
if os.path.isfile(allowed_instances_filename):
|
if os.path.isfile(allowed_instances_filename):
|
||||||
|
|
@ -461,9 +475,12 @@ def _profile_post_dm_instances(base_dir: str, nickname: str, domain: str,
|
||||||
dm_allowed_instances_filename = \
|
dm_allowed_instances_filename = \
|
||||||
acct_dir(base_dir, nickname, domain) + '/dmAllowedInstances.txt'
|
acct_dir(base_dir, nickname, domain) + '/dmAllowedInstances.txt'
|
||||||
if fields.get('dmAllowedInstances'):
|
if fields.get('dmAllowedInstances'):
|
||||||
save_string(fields['dmAllowedInstances'],
|
try:
|
||||||
dm_allowed_instances_filename,
|
with open(dm_allowed_instances_filename, 'w+',
|
||||||
'EX: unable to write allowed DM instances ' +
|
encoding='utf-8') as fp_dm:
|
||||||
|
fp_dm.write(fields['dmAllowedInstances'])
|
||||||
|
except OSError:
|
||||||
|
print('EX: unable to write allowed DM instances ' +
|
||||||
dm_allowed_instances_filename)
|
dm_allowed_instances_filename)
|
||||||
else:
|
else:
|
||||||
if os.path.isfile(dm_allowed_instances_filename):
|
if os.path.isfile(dm_allowed_instances_filename):
|
||||||
|
|
@ -506,8 +523,12 @@ def _profile_post_import_follows(base_dir: str, nickname: str, domain: str,
|
||||||
follows_str = fields['importFollows']
|
follows_str = fields['importFollows']
|
||||||
while follows_str.startswith('\n'):
|
while follows_str.startswith('\n'):
|
||||||
follows_str = follows_str[1:]
|
follows_str = follows_str[1:]
|
||||||
save_string(follows_str, filename_base,
|
try:
|
||||||
'EX: unable to write imported follows ' +
|
with open(filename_base, 'w+',
|
||||||
|
encoding='utf-8') as fp_foll:
|
||||||
|
fp_foll.write(follows_str)
|
||||||
|
except OSError:
|
||||||
|
print('EX: unable to write imported follows ' +
|
||||||
filename_base)
|
filename_base)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -534,8 +555,12 @@ def _profile_post_auto_cw(base_dir: str, nickname: str, domain: str,
|
||||||
auto_cw_filename = \
|
auto_cw_filename = \
|
||||||
acct_dir(base_dir, nickname, domain) + '/autocw.txt'
|
acct_dir(base_dir, nickname, domain) + '/autocw.txt'
|
||||||
if fields.get('autoCW'):
|
if fields.get('autoCW'):
|
||||||
save_string(fields['autoCW'], auto_cw_filename,
|
try:
|
||||||
'EX: unable to write auto CW ' +
|
with open(auto_cw_filename, 'w+',
|
||||||
|
encoding='utf-8') as fp_auto_cw:
|
||||||
|
fp_auto_cw.write(fields['autoCW'])
|
||||||
|
except OSError:
|
||||||
|
print('EX: unable to write auto CW ' +
|
||||||
auto_cw_filename)
|
auto_cw_filename)
|
||||||
self.server.auto_cw_cache[nickname] = fields['autoCW'].split('\n')
|
self.server.auto_cw_cache[nickname] = fields['autoCW'].split('\n')
|
||||||
else:
|
else:
|
||||||
|
|
@ -557,8 +582,12 @@ def _profile_post_autogenerated_tags(base_dir: str,
|
||||||
auto_tags_filename = \
|
auto_tags_filename = \
|
||||||
acct_dir(base_dir, nickname, domain) + '/autotags.txt'
|
acct_dir(base_dir, nickname, domain) + '/autotags.txt'
|
||||||
if fields.get('autoTags'):
|
if fields.get('autoTags'):
|
||||||
save_string(fields['autoTags'], auto_tags_filename,
|
try:
|
||||||
'EX: unable to write auto tags ' +
|
with open(auto_tags_filename, 'w+',
|
||||||
|
encoding='utf-8') as fp_auto:
|
||||||
|
fp_auto.write(fields['autoTags'])
|
||||||
|
except OSError:
|
||||||
|
print('EX: unable to write auto tags ' +
|
||||||
auto_tags_filename)
|
auto_tags_filename)
|
||||||
else:
|
else:
|
||||||
if os.path.isfile(auto_tags_filename):
|
if os.path.isfile(auto_tags_filename):
|
||||||
|
|
@ -577,8 +606,12 @@ def _profile_post_word_replacements(base_dir: str,
|
||||||
switch_filename = \
|
switch_filename = \
|
||||||
acct_dir(base_dir, nickname, domain) + '/replacewords.txt'
|
acct_dir(base_dir, nickname, domain) + '/replacewords.txt'
|
||||||
if fields.get('switchwords'):
|
if fields.get('switchwords'):
|
||||||
save_string(fields['switchwords'], switch_filename,
|
try:
|
||||||
'EX: unable to write switches ' +
|
with open(switch_filename, 'w+',
|
||||||
|
encoding='utf-8') as fp_switch:
|
||||||
|
fp_switch.write(fields['switchwords'])
|
||||||
|
except OSError:
|
||||||
|
print('EX: unable to write switches ' +
|
||||||
switch_filename)
|
switch_filename)
|
||||||
else:
|
else:
|
||||||
if os.path.isfile(switch_filename):
|
if os.path.isfile(switch_filename):
|
||||||
|
|
@ -598,8 +631,12 @@ def _profile_post_filtered_words_within_bio(base_dir: str,
|
||||||
filter_bio_filename = \
|
filter_bio_filename = \
|
||||||
acct_dir(base_dir, nickname, domain) + '/filters_bio.txt'
|
acct_dir(base_dir, nickname, domain) + '/filters_bio.txt'
|
||||||
if fields.get('filteredWordsBio'):
|
if fields.get('filteredWordsBio'):
|
||||||
save_string(fields['filteredWordsBio'], filter_bio_filename,
|
try:
|
||||||
'EX: unable to write bio filter ' +
|
with open(filter_bio_filename, 'w+',
|
||||||
|
encoding='utf-8') as fp_filter:
|
||||||
|
fp_filter.write(fields['filteredWordsBio'])
|
||||||
|
except OSError:
|
||||||
|
print('EX: unable to write bio filter ' +
|
||||||
filter_bio_filename)
|
filter_bio_filename)
|
||||||
else:
|
else:
|
||||||
if os.path.isfile(filter_bio_filename):
|
if os.path.isfile(filter_bio_filename):
|
||||||
|
|
@ -617,8 +654,12 @@ def _profile_post_filtered_words(base_dir: str, nickname: str, domain: str,
|
||||||
"""
|
"""
|
||||||
filter_filename = acct_dir(base_dir, nickname, domain) + '/filters.txt'
|
filter_filename = acct_dir(base_dir, nickname, domain) + '/filters.txt'
|
||||||
if fields.get('filteredWords'):
|
if fields.get('filteredWords'):
|
||||||
save_string(fields['filteredWords'], filter_filename,
|
try:
|
||||||
'EX: unable to write filter ' +
|
with open(filter_filename, 'w+',
|
||||||
|
encoding='utf-8') as fp_filter:
|
||||||
|
fp_filter.write(fields['filteredWords'])
|
||||||
|
except OSError:
|
||||||
|
print('EX: unable to write filter ' +
|
||||||
filter_filename)
|
filter_filename)
|
||||||
else:
|
else:
|
||||||
if os.path.isfile(filter_filename):
|
if os.path.isfile(filter_filename):
|
||||||
|
|
@ -732,8 +773,12 @@ def _profile_post_notify_reactions(base_dir: str,
|
||||||
if on_final_welcome_screen:
|
if on_final_welcome_screen:
|
||||||
# default setting from welcome screen
|
# default setting from welcome screen
|
||||||
notify_react_filename = notify_reactions_filename
|
notify_react_filename = notify_reactions_filename
|
||||||
save_string('\n', notify_react_filename,
|
try:
|
||||||
'EX: unable to write notify reactions ' +
|
with open(notify_react_filename, 'w+',
|
||||||
|
encoding='utf-8') as fp_notify:
|
||||||
|
fp_notify.write('\n')
|
||||||
|
except OSError:
|
||||||
|
print('EX: unable to write notify reactions ' +
|
||||||
notify_reactions_filename)
|
notify_reactions_filename)
|
||||||
actor_changed = True
|
actor_changed = True
|
||||||
else:
|
else:
|
||||||
|
|
@ -742,8 +787,12 @@ def _profile_post_notify_reactions(base_dir: str,
|
||||||
if fields['notifyReactions'] == 'on' and \
|
if fields['notifyReactions'] == 'on' and \
|
||||||
not hide_reaction_button_active:
|
not hide_reaction_button_active:
|
||||||
notify_reactions_active = True
|
notify_reactions_active = True
|
||||||
save_string('\n', notify_reactions_filename,
|
try:
|
||||||
'EX: unable to write ' +
|
with open(notify_reactions_filename, 'w+',
|
||||||
|
encoding='utf-8') as fp_notify:
|
||||||
|
fp_notify.write('\n')
|
||||||
|
except OSError:
|
||||||
|
print('EX: unable to write ' +
|
||||||
'notify reactions ' +
|
'notify reactions ' +
|
||||||
notify_reactions_filename)
|
notify_reactions_filename)
|
||||||
if not notify_reactions_active:
|
if not notify_reactions_active:
|
||||||
|
|
@ -766,8 +815,12 @@ def _profile_post_notify_likes(on_final_welcome_screen: bool,
|
||||||
"""
|
"""
|
||||||
if on_final_welcome_screen:
|
if on_final_welcome_screen:
|
||||||
# default setting from welcome screen
|
# default setting from welcome screen
|
||||||
save_string('\n', notify_likes_filename,
|
try:
|
||||||
'EX: unable to write notify likes ' +
|
with open(notify_likes_filename, 'w+',
|
||||||
|
encoding='utf-8') as fp_notify:
|
||||||
|
fp_notify.write('\n')
|
||||||
|
except OSError:
|
||||||
|
print('EX: unable to write notify likes ' +
|
||||||
notify_likes_filename)
|
notify_likes_filename)
|
||||||
actor_changed = True
|
actor_changed = True
|
||||||
else:
|
else:
|
||||||
|
|
@ -776,8 +829,12 @@ def _profile_post_notify_likes(on_final_welcome_screen: bool,
|
||||||
if fields['notifyLikes'] == 'on' and \
|
if fields['notifyLikes'] == 'on' and \
|
||||||
not hide_like_button_active:
|
not hide_like_button_active:
|
||||||
notify_likes_active = True
|
notify_likes_active = True
|
||||||
save_string('\n', notify_likes_filename,
|
try:
|
||||||
'EX: unable to write notify likes ' +
|
with open(notify_likes_filename, 'w+',
|
||||||
|
encoding='utf-8') as fp_notify:
|
||||||
|
fp_notify.write('\n')
|
||||||
|
except OSError:
|
||||||
|
print('EX: unable to write notify likes ' +
|
||||||
notify_likes_filename)
|
notify_likes_filename)
|
||||||
if not notify_likes_active:
|
if not notify_likes_active:
|
||||||
if os.path.isfile(notify_likes_filename):
|
if os.path.isfile(notify_likes_filename):
|
||||||
|
|
@ -878,8 +935,12 @@ def _profile_post_no_reply_boosts(base_dir: str, nickname: str, domain: str,
|
||||||
no_reply_boosts = True
|
no_reply_boosts = True
|
||||||
if no_reply_boosts:
|
if no_reply_boosts:
|
||||||
if not os.path.isfile(no_reply_boosts_filename):
|
if not os.path.isfile(no_reply_boosts_filename):
|
||||||
save_string('\n', no_reply_boosts_filename,
|
try:
|
||||||
'EX: unable to write noReplyBoosts ' +
|
with open(no_reply_boosts_filename, 'w+',
|
||||||
|
encoding='utf-8') as fp_reply:
|
||||||
|
fp_reply.write('\n')
|
||||||
|
except OSError:
|
||||||
|
print('EX: unable to write noReplyBoosts ' +
|
||||||
no_reply_boosts_filename)
|
no_reply_boosts_filename)
|
||||||
if not no_reply_boosts:
|
if not no_reply_boosts:
|
||||||
if os.path.isfile(no_reply_boosts_filename):
|
if os.path.isfile(no_reply_boosts_filename):
|
||||||
|
|
@ -903,8 +964,12 @@ def _profile_post_no_seen_posts(base_dir: str, nickname: str, domain: str,
|
||||||
no_seen_posts = True
|
no_seen_posts = True
|
||||||
if no_seen_posts:
|
if no_seen_posts:
|
||||||
if not os.path.isfile(no_seen_posts_filename):
|
if not os.path.isfile(no_seen_posts_filename):
|
||||||
save_string('\n', no_seen_posts_filename,
|
try:
|
||||||
'EX: unable to write noSeenPosts ' +
|
with open(no_seen_posts_filename, 'w+',
|
||||||
|
encoding='utf-8') as fp_seen:
|
||||||
|
fp_seen.write('\n')
|
||||||
|
except OSError:
|
||||||
|
print('EX: unable to write noSeenPosts ' +
|
||||||
no_seen_posts_filename)
|
no_seen_posts_filename)
|
||||||
if not no_seen_posts:
|
if not no_seen_posts:
|
||||||
if os.path.isfile(no_seen_posts_filename):
|
if os.path.isfile(no_seen_posts_filename):
|
||||||
|
|
@ -929,8 +994,12 @@ def _profile_post_watermark_enabled(base_dir: str,
|
||||||
watermark_enabled = True
|
watermark_enabled = True
|
||||||
if watermark_enabled:
|
if watermark_enabled:
|
||||||
if not os.path.isfile(watermark_enabled_filename):
|
if not os.path.isfile(watermark_enabled_filename):
|
||||||
save_string('\n', watermark_enabled_filename,
|
try:
|
||||||
'EX: unable to write watermarkEnabled ' +
|
with open(watermark_enabled_filename, 'w+',
|
||||||
|
encoding='utf-8') as fp_wm:
|
||||||
|
fp_wm.write('\n')
|
||||||
|
except OSError:
|
||||||
|
print('EX: unable to write watermarkEnabled ' +
|
||||||
watermark_enabled_filename)
|
watermark_enabled_filename)
|
||||||
if not watermark_enabled:
|
if not watermark_enabled:
|
||||||
if os.path.isfile(watermark_enabled_filename):
|
if os.path.isfile(watermark_enabled_filename):
|
||||||
|
|
@ -960,8 +1029,12 @@ def _profile_post_hide_follows(base_dir: str, nickname: str, domain: str,
|
||||||
actor_json['hideFollows'] = True
|
actor_json['hideFollows'] = True
|
||||||
actor_changed = True
|
actor_changed = True
|
||||||
if not os.path.isfile(hide_follows_filename):
|
if not os.path.isfile(hide_follows_filename):
|
||||||
save_string('\n', hide_follows_filename,
|
try:
|
||||||
'EX: unable to write hideFollows ' +
|
with open(hide_follows_filename, 'w+',
|
||||||
|
encoding='utf-8') as fp_hide:
|
||||||
|
fp_hide.write('\n')
|
||||||
|
except OSError:
|
||||||
|
print('EX: unable to write hideFollows ' +
|
||||||
hide_follows_filename)
|
hide_follows_filename)
|
||||||
if not hide_follows:
|
if not hide_follows:
|
||||||
actor_json['hideFollows'] = False
|
actor_json['hideFollows'] = False
|
||||||
|
|
@ -996,8 +1069,12 @@ def _profile_post_hide_recent_posts(base_dir: str, nickname: str, domain: str,
|
||||||
actor_json['hideRecentPosts'] = True
|
actor_json['hideRecentPosts'] = True
|
||||||
actor_changed = True
|
actor_changed = True
|
||||||
if not os.path.isfile(hide_recent_posts_filename):
|
if not os.path.isfile(hide_recent_posts_filename):
|
||||||
save_string('\n', hide_recent_posts_filename,
|
try:
|
||||||
'EX: unable to write hideRecentPosts ' +
|
with open(hide_recent_posts_filename, 'w+',
|
||||||
|
encoding='utf-8') as fp_hide:
|
||||||
|
fp_hide.write('\n')
|
||||||
|
except OSError:
|
||||||
|
print('EX: unable to write hideRecentPosts ' +
|
||||||
hide_recent_posts_filename)
|
hide_recent_posts_filename)
|
||||||
if not hide_recent_posts:
|
if not hide_recent_posts:
|
||||||
actor_json['hideRecentPosts'] = False
|
actor_json['hideRecentPosts'] = False
|
||||||
|
|
@ -1031,8 +1108,12 @@ def _profile_post_mutuals_replies(account_dir: str, fields: {}) -> None:
|
||||||
show_replies_mutuals_file)
|
show_replies_mutuals_file)
|
||||||
else:
|
else:
|
||||||
if show_replies_mutuals:
|
if show_replies_mutuals:
|
||||||
save_string('\n', show_replies_mutuals_file,
|
try:
|
||||||
'EX: unable to write repliesFromMutualsOnly file ' +
|
with open(show_replies_mutuals_file, 'w+',
|
||||||
|
encoding='utf-8') as fp_replies:
|
||||||
|
fp_replies.write('\n')
|
||||||
|
except OSError:
|
||||||
|
print('EX: unable to write repliesFromMutualsOnly file ' +
|
||||||
show_replies_mutuals_file)
|
show_replies_mutuals_file)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1055,8 +1136,12 @@ def _profile_post_only_follower_replies(fields: {},
|
||||||
show_replies_followers_file)
|
show_replies_followers_file)
|
||||||
else:
|
else:
|
||||||
if show_replies_followers:
|
if show_replies_followers:
|
||||||
save_string('\n', show_replies_followers_file,
|
try:
|
||||||
'EX: unable to write ' +
|
with open(show_replies_followers_file, 'w+',
|
||||||
|
encoding='utf-8') as fp_replies:
|
||||||
|
fp_replies.write('\n')
|
||||||
|
except OSError:
|
||||||
|
print('EX: unable to write ' +
|
||||||
'repliesFromFollowersOnly file ' +
|
'repliesFromFollowersOnly file ' +
|
||||||
show_replies_followers_file)
|
show_replies_followers_file)
|
||||||
|
|
||||||
|
|
@ -1078,8 +1163,12 @@ def _profile_post_show_quote_toots(fields: {}, account_dir: str) -> None:
|
||||||
show_quote_toots_file)
|
show_quote_toots_file)
|
||||||
else:
|
else:
|
||||||
if show_quote_toots:
|
if show_quote_toots:
|
||||||
save_string('\n', show_quote_toots_file,
|
try:
|
||||||
'EX: unable to write allowQuotes file ' +
|
with open(show_quote_toots_file, 'w+',
|
||||||
|
encoding='utf-8') as fp_quotes:
|
||||||
|
fp_quotes.write('\n')
|
||||||
|
except OSError:
|
||||||
|
print('EX: unable to write allowQuotes file ' +
|
||||||
show_quote_toots_file)
|
show_quote_toots_file)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1100,8 +1189,12 @@ def _profile_post_show_questions(fields: {}, account_dir: str) -> None:
|
||||||
show_vote_file)
|
show_vote_file)
|
||||||
else:
|
else:
|
||||||
if not show_vote_posts:
|
if not show_vote_posts:
|
||||||
save_string('\n', show_vote_file,
|
try:
|
||||||
'EX: unable to write noVotes file ' +
|
with open(show_vote_file, 'w+',
|
||||||
|
encoding='utf-8') as fp_votes:
|
||||||
|
fp_votes.write('\n')
|
||||||
|
except OSError:
|
||||||
|
print('EX: unable to write noVotes file ' +
|
||||||
show_vote_file)
|
show_vote_file)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1136,8 +1229,12 @@ def _profile_post_bold_reading(base_dir: str,
|
||||||
if fields['boldReading'] == 'on':
|
if fields['boldReading'] == 'on':
|
||||||
bold_reading = True
|
bold_reading = True
|
||||||
self.server.bold_reading[nickname] = True
|
self.server.bold_reading[nickname] = True
|
||||||
save_string('\n', bold_reading_filename,
|
try:
|
||||||
'EX: unable to write bold reading ' +
|
with open(bold_reading_filename, 'w+',
|
||||||
|
encoding='utf-8') as fp_bold:
|
||||||
|
fp_bold.write('\n')
|
||||||
|
except OSError:
|
||||||
|
print('EX: unable to write bold reading ' +
|
||||||
bold_reading_filename)
|
bold_reading_filename)
|
||||||
if not bold_reading:
|
if not bold_reading:
|
||||||
if self.server.bold_reading.get(nickname):
|
if self.server.bold_reading.get(nickname):
|
||||||
|
|
@ -1163,8 +1260,12 @@ def _profile_post_hide_reaction_button2(base_dir: str,
|
||||||
if fields.get('hideReactionButton'):
|
if fields.get('hideReactionButton'):
|
||||||
if fields['hideReactionButton'] == 'on':
|
if fields['hideReactionButton'] == 'on':
|
||||||
hide_reaction_button_active = True
|
hide_reaction_button_active = True
|
||||||
save_string('\n', hide_reaction_button_file,
|
try:
|
||||||
'EX: unable to write hide reaction ' +
|
with open(hide_reaction_button_file, 'w+',
|
||||||
|
encoding='utf-8') as fp_hide:
|
||||||
|
fp_hide.write('\n')
|
||||||
|
except OSError:
|
||||||
|
print('EX: unable to write hide reaction ' +
|
||||||
hide_reaction_button_file)
|
hide_reaction_button_file)
|
||||||
# remove notify Reaction selection
|
# remove notify Reaction selection
|
||||||
if os.path.isfile(notify_reactions_filename):
|
if os.path.isfile(notify_reactions_filename):
|
||||||
|
|
@ -1218,8 +1319,12 @@ def _profile_post_hide_like_button2(base_dir: str, nickname: str, domain: str,
|
||||||
if fields.get('hideLikeButton'):
|
if fields.get('hideLikeButton'):
|
||||||
if fields['hideLikeButton'] == 'on':
|
if fields['hideLikeButton'] == 'on':
|
||||||
hide_like_button_active = True
|
hide_like_button_active = True
|
||||||
save_string('\n', hide_like_button_file,
|
try:
|
||||||
'EX: unable to write hide like ' +
|
with open(hide_like_button_file, 'w+',
|
||||||
|
encoding='utf-8') as rfil:
|
||||||
|
rfil.write('\n')
|
||||||
|
except OSError:
|
||||||
|
print('EX: unable to write hide like ' +
|
||||||
hide_like_button_file)
|
hide_like_button_file)
|
||||||
# remove notify likes selection
|
# remove notify likes selection
|
||||||
if os.path.isfile(notify_likes_filename):
|
if os.path.isfile(notify_likes_filename):
|
||||||
|
|
@ -1247,8 +1352,12 @@ def _profile_post_remove_retweets(base_dir: str, nickname: str, domain: str,
|
||||||
if fields.get('removeTwitter'):
|
if fields.get('removeTwitter'):
|
||||||
if fields['removeTwitter'] == 'on':
|
if fields['removeTwitter'] == 'on':
|
||||||
remove_twitter_active = True
|
remove_twitter_active = True
|
||||||
save_string('\n', remove_twitter_filename,
|
try:
|
||||||
'EX: unable to write remove twitter ' +
|
with open(remove_twitter_filename, 'w+',
|
||||||
|
encoding='utf-8') as fp_remove:
|
||||||
|
fp_remove.write('\n')
|
||||||
|
except OSError:
|
||||||
|
print('EX: unable to write remove twitter ' +
|
||||||
remove_twitter_filename)
|
remove_twitter_filename)
|
||||||
if not remove_twitter_active:
|
if not remove_twitter_active:
|
||||||
if os.path.isfile(remove_twitter_filename):
|
if os.path.isfile(remove_twitter_filename):
|
||||||
|
|
@ -1269,8 +1378,12 @@ def _profile_post_dms_from_followers(base_dir: str, nickname: str, domain: str,
|
||||||
if on_final_welcome_screen:
|
if on_final_welcome_screen:
|
||||||
# initial default setting created via
|
# initial default setting created via
|
||||||
# the welcome screen
|
# the welcome screen
|
||||||
save_string('\n', follow_dms_filename,
|
try:
|
||||||
'EX: unable to write follow DMs ' +
|
with open(follow_dms_filename, 'w+',
|
||||||
|
encoding='utf-8') as fp_foll:
|
||||||
|
fp_foll.write('\n')
|
||||||
|
except OSError:
|
||||||
|
print('EX: unable to write follow DMs ' +
|
||||||
follow_dms_filename)
|
follow_dms_filename)
|
||||||
actor_changed = True
|
actor_changed = True
|
||||||
else:
|
else:
|
||||||
|
|
@ -1278,8 +1391,12 @@ def _profile_post_dms_from_followers(base_dir: str, nickname: str, domain: str,
|
||||||
if fields.get('followDMs'):
|
if fields.get('followDMs'):
|
||||||
if fields['followDMs'] == 'on':
|
if fields['followDMs'] == 'on':
|
||||||
follow_dms_active = True
|
follow_dms_active = True
|
||||||
save_string('\n', follow_dms_filename,
|
try:
|
||||||
'EX: unable to write follow DMs 2 ' +
|
with open(follow_dms_filename, 'w+',
|
||||||
|
encoding='utf-8') as fp_foll:
|
||||||
|
fp_foll.write('\n')
|
||||||
|
except OSError:
|
||||||
|
print('EX: unable to write follow DMs 2 ' +
|
||||||
follow_dms_filename)
|
follow_dms_filename)
|
||||||
if not follow_dms_active:
|
if not follow_dms_active:
|
||||||
if os.path.isfile(follow_dms_filename):
|
if os.path.isfile(follow_dms_filename):
|
||||||
|
|
@ -1375,8 +1492,12 @@ def _profile_post_reject_spam_actors(base_dir: str,
|
||||||
curr_reject_spam_actors = True
|
curr_reject_spam_actors = True
|
||||||
if reject_spam_actors != curr_reject_spam_actors:
|
if reject_spam_actors != curr_reject_spam_actors:
|
||||||
if reject_spam_actors:
|
if reject_spam_actors:
|
||||||
save_string('\n', actor_spam_filter_filename,
|
try:
|
||||||
'EX: unable to write reject spam actors')
|
with open(actor_spam_filter_filename, 'w+',
|
||||||
|
encoding='utf-8') as fp_spam:
|
||||||
|
fp_spam.write('\n')
|
||||||
|
except OSError:
|
||||||
|
print('EX: unable to write reject spam actors')
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
os.remove(actor_spam_filter_filename)
|
os.remove(actor_spam_filter_filename)
|
||||||
|
|
@ -1776,8 +1897,12 @@ def _profile_post_ntfy_topic(base_dir: str, nickname: str, domain: str,
|
||||||
"""
|
"""
|
||||||
if fields.get('ntfyTopic'):
|
if fields.get('ntfyTopic'):
|
||||||
ntfy_topic_file = acct_dir(base_dir, nickname, domain) + '/.ntfy_topic'
|
ntfy_topic_file = acct_dir(base_dir, nickname, domain) + '/.ntfy_topic'
|
||||||
save_string(fields['ntfyTopic'], ntfy_topic_file,
|
try:
|
||||||
'EX: unable to save ntfy topic ' +
|
with open(ntfy_topic_file, 'w+',
|
||||||
|
encoding='utf-8') as fp_ntfy:
|
||||||
|
fp_ntfy.write(fields['ntfyTopic'])
|
||||||
|
except OSError:
|
||||||
|
print('EX: unable to save ntfy topic ' +
|
||||||
ntfy_topic_file)
|
ntfy_topic_file)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1787,8 +1912,12 @@ def _profile_post_ntfy_url(base_dir: str, nickname: str, domain: str,
|
||||||
"""
|
"""
|
||||||
if fields.get('ntfyUrl'):
|
if fields.get('ntfyUrl'):
|
||||||
ntfy_url_file = acct_dir(base_dir, nickname, domain) + '/.ntfy_url'
|
ntfy_url_file = acct_dir(base_dir, nickname, domain) + '/.ntfy_url'
|
||||||
save_string(fields['ntfyUrl'], ntfy_url_file,
|
try:
|
||||||
'EX: unable to save ntfy url ' +
|
with open(ntfy_url_file, 'w+',
|
||||||
|
encoding='utf-8') as fp_ntfy:
|
||||||
|
fp_ntfy.write(fields['ntfyUrl'])
|
||||||
|
except OSError:
|
||||||
|
print('EX: unable to save ntfy url ' +
|
||||||
ntfy_url_file)
|
ntfy_url_file)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -2570,8 +2699,12 @@ def _profile_post_change_city(base_dir: str, nickname: str, domain: str,
|
||||||
"""
|
"""
|
||||||
if fields.get('cityDropdown'):
|
if fields.get('cityDropdown'):
|
||||||
city_filename = acct_dir(base_dir, nickname, domain) + '/city.txt'
|
city_filename = acct_dir(base_dir, nickname, domain) + '/city.txt'
|
||||||
save_string(fields['cityDropdown'], city_filename,
|
try:
|
||||||
'EX: edit profile unable to write city ' + city_filename)
|
with open(city_filename, 'w+',
|
||||||
|
encoding='utf-8') as fp_city:
|
||||||
|
fp_city.write(fields['cityDropdown'])
|
||||||
|
except OSError:
|
||||||
|
print('EX: edit profile unable to write city ' + city_filename)
|
||||||
|
|
||||||
|
|
||||||
def _profile_post_set_reply_interval(base_dir: str, nickname: str, domain: str,
|
def _profile_post_set_reply_interval(base_dir: str, nickname: str, domain: str,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue