Function for flag files

main
bashrc 2026-04-28 15:36:12 +01:00
parent ff9c304702
commit a9f9982a3d
17 changed files with 166 additions and 141 deletions

View File

@ -56,6 +56,7 @@ from session import get_json
from data import load_string
from data import load_list
from data import save_string
from data import save_flag_file
from data import append_string
@ -1246,9 +1247,9 @@ def mute_post(base_dir: str, nickname: str, domain: str, port: int,
else:
print('MUTE: cached post not found ' + cached_post_filename)
if not save_string('\n', post_filename + '.muted',
'EX: Failed to save mute file ' +
post_filename + '.muted'):
if not save_flag_file(post_filename + '.muted',
'EX: Failed to save mute file ' +
post_filename + '.muted'):
return
print('MUTE: ' + post_filename + '.muted file added')

View File

@ -22,6 +22,7 @@ from keys import get_instance_actor_key
from session import get_json
from session import get_json_valid
from data import save_string
from data import save_flag_file
from data import append_string
@ -93,8 +94,8 @@ def mute_conversation(base_dir: str, nickname: str, domain: str,
return
if os.path.isfile(conversation_filename + '.muted'):
return
save_string('\n', conversation_filename + '.muted',
'EX: unable to write mute ' + conversation_filename)
save_flag_file(conversation_filename + '.muted',
'EX: unable to write mute ' + conversation_filename)
def unmute_conversation(base_dir: str, nickname: str, domain: str,

View File

@ -49,7 +49,7 @@ from blocking import blocked_quote_toots_remove
from notifyOnPost import add_notify_on_post
from notifyOnPost import remove_notify_on_post
from flags import is_moderator
from data import save_string
from data import save_flag_file
def _person_options_page_number(options_confirm_params: str) -> int:
@ -612,9 +612,10 @@ def _person_options_post_to_news(self, options_confirm_params: str,
else:
if os.path.isdir(account_dir):
nw_filename = newswire_blocked_filename
if save_string('\n', nw_filename,
'EX: _person_options_post_to_news unable ' +
'to write ' + nw_filename + ' [ex]'):
if save_flag_file(nw_filename,
'EX: _person_options_post_to_news ' +
'unable to write ' + nw_filename +
' [ex]'):
refresh_newswire(base_dir)
users_path_str = \
users_path + '/' + default_timeline + \
@ -665,10 +666,10 @@ def _person_options_post_to_features(self, options_confirm_params: str,
else:
if os.path.isdir(account_dir):
feat_filename = features_blocked_filename
if save_string('\n', feat_filename,
'EX: _person_options_post_to_features ' +
'unable to write ' + feat_filename +
' [ex]'):
if save_flag_file(feat_filename,
'EX: _person_options_post_to_features ' +
'unable to write ' + feat_filename +
' [ex]'):
refresh_newswire(base_dir)
users_path_str = \
users_path + '/' + default_timeline + \
@ -718,9 +719,9 @@ def _person_options_mod_news(self, options_confirm_params: str,
else:
if os.path.isdir(account_dir):
nw_filename = newswire_mod_filename
save_string('\n', nw_filename,
'EX: _person_options_mod_news ' +
'unable to write ' + nw_filename)
save_flag_file(nw_filename,
'EX: _person_options_mod_news ' +
'unable to write ' + nw_filename)
users_path_str = \
users_path + '/' + default_timeline + \
'?page=' + str(page_number)

View File

@ -149,6 +149,7 @@ from cache import remove_avatar_from_cache
from cache import store_person_in_cache
from daemon_utils import post_to_outbox
from data import save_string
from data import save_flag_file
def _profile_post_deactivate_account(base_dir: str, nickname: str, domain: str,
@ -732,9 +733,9 @@ def _profile_post_notify_reactions(base_dir: str,
if on_final_welcome_screen:
# default setting from welcome screen
notify_react_filename = notify_reactions_filename
save_string('\n', notify_react_filename,
'EX: unable to write notify reactions ' +
notify_reactions_filename)
save_flag_file(notify_react_filename,
'EX: unable to write notify reactions ' +
notify_reactions_filename)
actor_changed = True
else:
notify_reactions_active: bool = False
@ -742,10 +743,10 @@ def _profile_post_notify_reactions(base_dir: str,
if fields['notifyReactions'] == 'on' and \
not hide_reaction_button_active:
notify_reactions_active = True
save_string('\n', notify_reactions_filename,
'EX: unable to write ' +
'notify reactions ' +
notify_reactions_filename)
save_flag_file(notify_reactions_filename,
'EX: unable to write ' +
'notify reactions ' +
notify_reactions_filename)
if not notify_reactions_active:
if os.path.isfile(notify_reactions_filename):
try:
@ -766,9 +767,9 @@ def _profile_post_notify_likes(on_final_welcome_screen: bool,
"""
if on_final_welcome_screen:
# default setting from welcome screen
save_string('\n', notify_likes_filename,
'EX: unable to write notify likes ' +
notify_likes_filename)
save_flag_file(notify_likes_filename,
'EX: unable to write notify likes ' +
notify_likes_filename)
actor_changed = True
else:
notify_likes_active: bool = False
@ -776,9 +777,9 @@ def _profile_post_notify_likes(on_final_welcome_screen: bool,
if fields['notifyLikes'] == 'on' and \
not hide_like_button_active:
notify_likes_active = True
save_string('\n', notify_likes_filename,
'EX: unable to write notify likes ' +
notify_likes_filename)
save_flag_file(notify_likes_filename,
'EX: unable to write notify likes ' +
notify_likes_filename)
if not notify_likes_active:
if os.path.isfile(notify_likes_filename):
try:
@ -878,9 +879,9 @@ def _profile_post_no_reply_boosts(base_dir: str, nickname: str, domain: str,
no_reply_boosts = True
if no_reply_boosts:
if not os.path.isfile(no_reply_boosts_filename):
save_string('\n', no_reply_boosts_filename,
'EX: unable to write noReplyBoosts ' +
no_reply_boosts_filename)
save_flag_file(no_reply_boosts_filename,
'EX: unable to write noReplyBoosts ' +
no_reply_boosts_filename)
if not no_reply_boosts:
if os.path.isfile(no_reply_boosts_filename):
try:
@ -903,9 +904,9 @@ def _profile_post_no_seen_posts(base_dir: str, nickname: str, domain: str,
no_seen_posts = True
if no_seen_posts:
if not os.path.isfile(no_seen_posts_filename):
save_string('\n', no_seen_posts_filename,
'EX: unable to write noSeenPosts ' +
no_seen_posts_filename)
save_flag_file(no_seen_posts_filename,
'EX: unable to write noSeenPosts ' +
no_seen_posts_filename)
if not no_seen_posts:
if os.path.isfile(no_seen_posts_filename):
try:
@ -929,9 +930,9 @@ def _profile_post_watermark_enabled(base_dir: str,
watermark_enabled = True
if watermark_enabled:
if not os.path.isfile(watermark_enabled_filename):
save_string('\n', watermark_enabled_filename,
'EX: unable to write watermarkEnabled ' +
watermark_enabled_filename)
save_flag_file(watermark_enabled_filename,
'EX: unable to write watermarkEnabled ' +
watermark_enabled_filename)
if not watermark_enabled:
if os.path.isfile(watermark_enabled_filename):
try:
@ -960,9 +961,9 @@ def _profile_post_hide_follows(base_dir: str, nickname: str, domain: str,
actor_json['hideFollows'] = True
actor_changed = True
if not os.path.isfile(hide_follows_filename):
save_string('\n', hide_follows_filename,
'EX: unable to write hideFollows ' +
hide_follows_filename)
save_flag_file(hide_follows_filename,
'EX: unable to write hideFollows ' +
hide_follows_filename)
if not hide_follows:
actor_json['hideFollows'] = False
if self.server.hide_follows.get(nickname):
@ -996,9 +997,9 @@ def _profile_post_hide_recent_posts(base_dir: str, nickname: str, domain: str,
actor_json['hideRecentPosts'] = True
actor_changed = True
if not os.path.isfile(hide_recent_posts_filename):
save_string('\n', hide_recent_posts_filename,
'EX: unable to write hideRecentPosts ' +
hide_recent_posts_filename)
save_flag_file(hide_recent_posts_filename,
'EX: unable to write hideRecentPosts ' +
hide_recent_posts_filename)
if not hide_recent_posts:
actor_json['hideRecentPosts'] = False
if self.server.hide_recent_posts.get(nickname):
@ -1031,9 +1032,9 @@ def _profile_post_mutuals_replies(account_dir: str, fields: {}) -> None:
show_replies_mutuals_file)
else:
if show_replies_mutuals:
save_string('\n', show_replies_mutuals_file,
'EX: unable to write repliesFromMutualsOnly file ' +
show_replies_mutuals_file)
save_flag_file(show_replies_mutuals_file,
'EX: unable to write repliesFromMutualsOnly file ' +
show_replies_mutuals_file)
def _profile_post_only_follower_replies(fields: {},
@ -1055,10 +1056,10 @@ def _profile_post_only_follower_replies(fields: {},
show_replies_followers_file)
else:
if show_replies_followers:
save_string('\n', show_replies_followers_file,
'EX: unable to write ' +
'repliesFromFollowersOnly file ' +
show_replies_followers_file)
save_flag_file(show_replies_followers_file,
'EX: unable to write ' +
'repliesFromFollowersOnly file ' +
show_replies_followers_file)
def _profile_post_show_quote_toots(fields: {}, account_dir: str) -> None:
@ -1078,9 +1079,9 @@ def _profile_post_show_quote_toots(fields: {}, account_dir: str) -> None:
show_quote_toots_file)
else:
if show_quote_toots:
save_string('\n', show_quote_toots_file,
'EX: unable to write allowQuotes file ' +
show_quote_toots_file)
save_flag_file(show_quote_toots_file,
'EX: unable to write allowQuotes file ' +
show_quote_toots_file)
def _profile_post_show_questions(fields: {}, account_dir: str) -> None:
@ -1100,9 +1101,9 @@ def _profile_post_show_questions(fields: {}, account_dir: str) -> None:
show_vote_file)
else:
if not show_vote_posts:
save_string('\n', show_vote_file,
'EX: unable to write noVotes file ' +
show_vote_file)
save_flag_file(show_vote_file,
'EX: unable to write noVotes file ' +
show_vote_file)
def _profile_post_reverse_timelines(base_dir: str, nickname: str,
@ -1136,9 +1137,9 @@ def _profile_post_bold_reading(base_dir: str,
if fields['boldReading'] == 'on':
bold_reading = True
self.server.bold_reading[nickname] = True
save_string('\n', bold_reading_filename,
'EX: unable to write bold reading ' +
bold_reading_filename)
save_flag_file(bold_reading_filename,
'EX: unable to write bold reading ' +
bold_reading_filename)
if not bold_reading:
if self.server.bold_reading.get(nickname):
del self.server.bold_reading[nickname]
@ -1163,9 +1164,9 @@ def _profile_post_hide_reaction_button2(base_dir: str,
if fields.get('hideReactionButton'):
if fields['hideReactionButton'] == 'on':
hide_reaction_button_active = True
save_string('\n', hide_reaction_button_file,
'EX: unable to write hide reaction ' +
hide_reaction_button_file)
save_flag_file(hide_reaction_button_file,
'EX: unable to write hide reaction ' +
hide_reaction_button_file)
# remove notify Reaction selection
if os.path.isfile(notify_reactions_filename):
try:
@ -1218,9 +1219,9 @@ def _profile_post_hide_like_button2(base_dir: str, nickname: str, domain: str,
if fields.get('hideLikeButton'):
if fields['hideLikeButton'] == 'on':
hide_like_button_active = True
save_string('\n', hide_like_button_file,
'EX: unable to write hide like ' +
hide_like_button_file)
save_flag_file(hide_like_button_file,
'EX: unable to write hide like ' +
hide_like_button_file)
# remove notify likes selection
if os.path.isfile(notify_likes_filename):
try:
@ -1247,9 +1248,9 @@ def _profile_post_remove_retweets(base_dir: str, nickname: str, domain: str,
if fields.get('removeTwitter'):
if fields['removeTwitter'] == 'on':
remove_twitter_active = True
save_string('\n', remove_twitter_filename,
'EX: unable to write remove twitter ' +
remove_twitter_filename)
save_flag_file(remove_twitter_filename,
'EX: unable to write remove twitter ' +
remove_twitter_filename)
if not remove_twitter_active:
if os.path.isfile(remove_twitter_filename):
try:
@ -1269,18 +1270,18 @@ def _profile_post_dms_from_followers(base_dir: str, nickname: str, domain: str,
if on_final_welcome_screen:
# initial default setting created via
# the welcome screen
save_string('\n', follow_dms_filename,
'EX: unable to write follow DMs ' +
follow_dms_filename)
save_flag_file(follow_dms_filename,
'EX: unable to write follow DMs ' +
follow_dms_filename)
actor_changed = True
else:
follow_dms_active: bool = False
if fields.get('followDMs'):
if fields['followDMs'] == 'on':
follow_dms_active = True
save_string('\n', follow_dms_filename,
'EX: unable to write follow DMs 2 ' +
follow_dms_filename)
save_flag_file(follow_dms_filename,
'EX: unable to write follow DMs 2 ' +
follow_dms_filename)
if not follow_dms_active:
if os.path.isfile(follow_dms_filename):
try:
@ -1375,8 +1376,8 @@ def _profile_post_reject_spam_actors(base_dir: str,
curr_reject_spam_actors = True
if reject_spam_actors != curr_reject_spam_actors:
if reject_spam_actors:
save_string('\n', actor_spam_filter_filename,
'EX: unable to write reject spam actors')
save_flag_file(actor_spam_filter_filename,
'EX: unable to write reject spam actors')
else:
try:
os.remove(actor_spam_filter_filename)

View File

@ -88,6 +88,15 @@ def save_string(text: str, filename: str, exception_text: str) -> bool:
return _store_base(text, filename, exception_text, 'w+')
def save_flag_file(filename: str, exception_text: str) -> bool:
"""Saves a flag file
This creates a file containing a single character, and the presence
or absence of the file is used to implement the checkbox profile
options
"""
return _store_base('\n', filename, exception_text, 'w+')
def save_binary(text: str, filename: str, exception_text: str) -> bool:
"""Saves a binary to file
"""

View File

@ -139,6 +139,7 @@ from inbox_receive_undo import receive_undo_bookmark
from inbox_receive_undo import receive_undo_announce
from inbox_receive_undo import receive_undo
from data import save_string
from data import save_flag_file
from data import load_string
from data import append_string
@ -2529,9 +2530,9 @@ def _inbox_after_initial(server, inbox_start_time,
# via a third party
destination_filename_mitm = \
destination_filename.replace('.json', '') + '.mitm'
save_string('\n', destination_filename_mitm,
'EX: _inbox_after_initial unable to write ' +
destination_filename_mitm)
save_flag_file(destination_filename_mitm,
'EX: _inbox_after_initial unable to write ' +
destination_filename_mitm)
_low_frequency_post_notification(base_dir, http_prefix,
nickname, domain, port,
@ -2546,9 +2547,9 @@ def _inbox_after_initial(server, inbox_start_time,
if is_reply_to_muted_post:
print('MUTE REPLY: ' + destination_filename)
destination_filename_muted = destination_filename + '.muted'
save_string('\n', destination_filename_muted,
'EX: _inbox_after_initial unable to write 2 ' +
destination_filename_muted)
save_flag_file(destination_filename_muted,
'EX: _inbox_after_initial unable to write 2 ' +
destination_filename_muted)
# is this an edit of a previous post?
# in Mastodon "delete and redraft"

View File

@ -87,6 +87,7 @@ from speaker import update_speaker
from webapp_post import individual_post_as_html
from webapp_hashtagswarm import store_hash_tags
from data import save_string
from data import save_flag_file
from data import append_string
from data import load_string
@ -1996,8 +1997,8 @@ def receive_announce(recent_posts_cache: {},
if mitm:
post_filename_mitm = \
post_filename.replace('.json', '') + '.mitm'
save_string('\n', post_filename_mitm,
'EX: unable to write mitm ' + post_filename_mitm)
save_flag_file(post_filename_mitm,
'EX: unable to write mitm ' + post_filename_mitm)
minimize_all_images = False
if nickname in min_images_for_accounts:
minimize_all_images = True
@ -2135,9 +2136,9 @@ def receive_announce(recent_posts_cache: {},
translate, lookup_actor,
theme_name, system_language,
'inbox')
save_string('\n', post_filename + '.tts',
'EX: unable to write recent post ' +
post_filename)
save_flag_file(post_filename + '.tts',
'EX: unable to write recent post ' +
post_filename)
if debug:
print('DEBUG: Obtaining actor for announce post ' +

View File

@ -13,6 +13,7 @@ from utils import acct_dir
from utils import text_in_file
from data import load_string
from data import save_string
from data import save_flag_file
def _notify_on_post_arrival(base_dir: str, nickname: str, domain: str,
@ -126,7 +127,7 @@ def notify_when_person_posts(base_dir: str, nickname: str, domain: str,
handle = following_nickname + '@' + following_domain
if not os.path.isfile(notify_on_post_filename):
# create a new notifyOnPost file
save_string('\n', notify_on_post_filename,
'EX: notify_when_person_posts unable to write ' +
notify_on_post_filename)
save_flag_file(notify_on_post_filename,
'EX: notify_when_person_posts unable to write ' +
notify_on_post_filename)
return text_in_file(handle + '\n', notify_on_post_filename, False)

View File

@ -93,6 +93,7 @@ from filters import is_filtered_bio
from follow import is_following_actor
from data import load_list
from data import save_string
from data import save_flag_file
from data import load_string
from data import append_string
@ -785,24 +786,25 @@ def create_person(base_dir: str, nickname: str, domain: str, port: int,
if manual_follower_approval:
follow_dms_filename = \
acct_dir(base_dir, nickname, domain) + '/.followDMs'
save_string('\n', follow_dms_filename,
'EX: create_person unable to write ' + follow_dms_filename)
save_flag_file(follow_dms_filename,
'EX: create_person unable to write ' +
follow_dms_filename)
# notify when posts are liked
if nickname != 'news':
notify_likes_filename = \
acct_dir(base_dir, nickname, domain) + '/.notifyLikes'
save_string('\n', notify_likes_filename,
'EX: create_person unable to write 2 ' +
notify_likes_filename)
save_flag_file(notify_likes_filename,
'EX: create_person unable to write 2 ' +
notify_likes_filename)
# notify when posts have emoji reactions
if nickname != 'news':
notify_reactions_filename = \
acct_dir(base_dir, nickname, domain) + '/.notifyReactions'
save_string('\n', notify_reactions_filename,
'EX: create_person unable to write 3 ' +
notify_reactions_filename)
save_flag_file(notify_reactions_filename,
'EX: create_person unable to write 3 ' +
notify_reactions_filename)
theme = get_config_param(base_dir, 'theme')
if not theme:

View File

@ -147,6 +147,7 @@ from quote import quote_toots_allowed
from data import load_list
from data import load_string
from data import save_string
from data import save_flag_file
from data import append_string
@ -5495,9 +5496,9 @@ def set_post_expiry_keep_dms(base_dir: str, nickname: str, domain: str,
print('EX: unable to write set_post_expiry_keep_dms False ' +
expire_dms_filename)
return
save_string('\n', expire_dms_filename,
'EX: unable to write set_post_expiry_keep_dms True ' +
expire_dms_filename)
save_flag_file(expire_dms_filename,
'EX: unable to write set_post_expiry_keep_dms True ' +
expire_dms_filename)
def expire_posts(base_dir: str, http_prefix: str,
@ -6269,9 +6270,9 @@ def _reject_announce(announce_filename: str,
if os.path.isfile(announce_filename + '.reject'):
return
save_string('\n', announce_filename + '.reject',
'EX: _reject_announce unable to write ' +
announce_filename + '.reject')
save_flag_file(announce_filename + '.reject',
'EX: _reject_announce unable to write ' +
announce_filename + '.reject')
def download_announce(session, base_dir: str, http_prefix: str,

View File

@ -30,6 +30,7 @@ from content import dangerous_css
from textmode import set_text_mode_theme
from data import load_string
from data import save_string
from data import save_flag_file
def import_theme(base_dir: str, filename: str) -> bool:
@ -441,9 +442,9 @@ def enable_grayscale(base_dir: str) -> None:
filename + ' [ex]')
grayscale_filename = data_dir(base_dir) + '/.grayscale'
if not os.path.isfile(grayscale_filename):
save_string(' ', grayscale_filename,
'EX: enable_grayscale unable to write ' +
grayscale_filename + ' [ex]')
save_flag_file(grayscale_filename,
'EX: enable_grayscale unable to write ' +
grayscale_filename + ' [ex]')
def disable_grayscale(base_dir: str) -> None:
@ -806,8 +807,9 @@ def _set_clear_cache_flag(base_dir: str) -> None:
if not os.path.isdir(dir_str):
return
flag_filename = dir_str + '/.clear_cache'
save_string('\n', flag_filename,
'EX: _set_clear_cache_flag unable to write ' + flag_filename)
save_flag_file(flag_filename,
'EX: _set_clear_cache_flag unable to write ' +
flag_filename)
def set_theme(base_dir: str, name: str, domain: str,

View File

@ -24,6 +24,7 @@ from unicodetext import standardize_text
from formats import get_image_extensions
from data import load_list
from data import save_string
from data import save_flag_file
from data import load_string
from data import append_string
@ -524,9 +525,9 @@ def refresh_newswire(base_dir: str) -> None:
refresh_newswire_filename = data_dir(base_dir) + '/.refresh_newswire'
if os.path.isfile(refresh_newswire_filename):
return
save_string('\n', refresh_newswire_filename,
'EX: refresh_newswire unable to write ' +
refresh_newswire_filename)
save_flag_file(refresh_newswire_filename,
'EX: refresh_newswire unable to write ' +
refresh_newswire_filename)
def get_sha_256(msg: str):
@ -2764,9 +2765,9 @@ def reject_post_id(base_dir: str, nickname: str, domain: str,
if recent_posts_cache['html'].get(post_url):
del recent_posts_cache['html'][post_url]
save_string('\n', post_filename + '.reject',
'EX: reject_post_id unable to write ' +
post_filename + '.reject')
save_flag_file(post_filename + '.reject',
'EX: reject_post_id unable to write ' +
post_filename + '.reject')
# if the post is in the inbox index then remove it
index_file = \
@ -3489,9 +3490,9 @@ def set_minimize_all_images(base_dir: str,
if nickname not in min_images_for_accounts:
min_images_for_accounts.append(nickname)
if not os.path.isfile(filename):
save_string('\n', filename,
'EX: set_minimize_all_images unable to write ' +
filename)
save_flag_file(filename,
'EX: set_minimize_all_images unable to write ' +
filename)
return
if nickname in min_images_for_accounts:
@ -3539,9 +3540,9 @@ def save_reverse_timeline(base_dir: str, reverse_sequence: []) -> None:
acct_dir(base_dir, nickname, domain) + '/.reverse_timeline'
if nickname in reverse_sequence:
if not os.path.isfile(reverse_filename):
save_string('\n', reverse_filename,
'EX: failed to save reverse ' +
reverse_filename)
save_flag_file(reverse_filename,
'EX: failed to save reverse ' +
reverse_filename)
else:
if os.path.isfile(reverse_filename):
try:
@ -4100,9 +4101,9 @@ def set_premium_account(base_dir: str, nickname: str, domain: str,
return False
else:
if flag_state:
if not save_string('\n', premium_filename,
'EX: unable to set premium flag ' +
premium_filename):
if not save_flag_file(premium_filename,
'EX: unable to set premium flag ' +
premium_filename):
return False
return True

View File

@ -9,7 +9,7 @@ __module_group__ = "Timeline"
import os
from utils import acct_dir
from data import save_string
from data import save_flag_file
def is_minimal(base_dir: str, domain: str, nickname: str) -> bool:
@ -40,5 +40,5 @@ def set_minimal(base_dir: str, domain: str, nickname: str,
except OSError:
print('EX: set_minimal unable to delete ' + minimal_filename)
elif not minimal and not minimal_file_exists:
save_string('\n', minimal_filename,
'EX: unable to write minimal ' + minimal_filename)
save_flag_file(minimal_filename,
'EX: unable to write minimal ' + minimal_filename)

View File

@ -44,6 +44,7 @@ from filters import is_filtered
from availability import get_availability
from data import load_string
from data import save_string
from data import save_flag_file
def _minimize_attached_images(base_dir: str, nickname: str, domain: str,
@ -85,9 +86,9 @@ def _minimize_attached_images(base_dir: str, nickname: str, domain: str,
# create a new minimize file from the following file
print('Creating minimize file ' + minimize_filename)
if add:
save_string('\n', minimize_filename,
'EX: minimize_attached_images unable to write ' +
minimize_filename)
save_flag_file('\n', minimize_filename,
'EX: minimize_attached_images unable to write ' +
minimize_filename)
# already in the minimize file?
if handle + '\n' in minimize_handles:

View File

@ -147,6 +147,7 @@ from blog import html_blog_post_markdown
from blog import html_blog_post_gemini_links
from data import load_list
from data import save_string
from data import save_flag_file
# maximum length for display name within html posts
MAX_DISPLAY_NAME_LENGTH = 42
@ -2607,9 +2608,9 @@ def individual_post_as_html(signing_priv_key_pem: str,
translate, actor_url,
theme_name, system_language,
box_name)
save_string('\n', announce_filename + '.tts',
'EX: unable to write tts ' +
announce_filename + '.tts')
save_flag_file(announce_filename + '.tts',
'EX: unable to write tts ' +
announce_filename + '.tts')
is_announced = True

View File

@ -60,7 +60,7 @@ from blocking import allowed_announce
from shares import vf_proposal_from_share
from webapp_pwa import get_pwa_theme_colors
from data import load_list
from data import save_string
from data import save_flag_file
from data import save_binary
from data import load_string
@ -83,8 +83,9 @@ def minimizing_attached_images(base_dir: str, nickname: str, domain: str,
if not os.path.isfile(following_filename):
return False
# create a new minimize file from the following file
save_string('\n', minimize_filename,
'EX: minimizing_attached_images 2 ' + minimize_filename)
save_flag_file(minimize_filename,
'EX: minimizing_attached_images 2 ' +
minimize_filename)
return text_in_file(handle + '\n', minimize_filename, False)

View File

@ -16,7 +16,7 @@ from utils import acct_dir
from webapp_utils import html_header_with_external_style
from webapp_utils import html_footer
from markdown import markdown_to_html
from data import save_string
from data import save_flag_file
from data import load_string
@ -39,9 +39,9 @@ def welcome_screen_is_complete(base_dir: str,
if not os.path.isdir(account_path):
return
complete_filename = account_path + '/.welcome_complete'
save_string('\n', complete_filename,
'EX: welcome_screen_is_complete unable to write ' +
complete_filename)
save_flag_file(complete_filename,
'EX: welcome_screen_is_complete unable to write ' +
complete_filename)
def html_welcome_screen(base_dir: str, nickname: str,