Snake case

main
Bob Mottram 2022-01-04 14:44:48 +00:00
parent f826caedb5
commit 580f58eb8b
1 changed files with 63 additions and 61 deletions

View File

@ -34,100 +34,102 @@ def html_welcome_profile(base_dir: str, nickname: str, domain: str,
copyfile(base_dir + '/accounts/welcome-background-custom.jpg',
base_dir + '/accounts/welcome-background.jpg')
profileText = 'Welcome to Epicyon'
profileFilename = base_dir + '/accounts/welcome_profile.md'
if not os.path.isfile(profileFilename):
defaultFilename = None
profile_text = 'Welcome to Epicyon'
profile_filename = base_dir + '/accounts/welcome_profile.md'
if not os.path.isfile(profile_filename):
default_filename = None
if theme_name:
defaultFilename = \
default_filename = \
base_dir + '/theme/' + theme_name + '/welcome/' + \
'profile_' + language + '.md'
if not os.path.isfile(defaultFilename):
defaultFilename = None
if not defaultFilename:
defaultFilename = \
if not os.path.isfile(default_filename):
default_filename = None
if not default_filename:
default_filename = \
base_dir + '/defaultwelcome/profile_' + language + '.md'
if not os.path.isfile(defaultFilename):
defaultFilename = base_dir + '/defaultwelcome/profile_en.md'
copyfile(defaultFilename, profileFilename)
if not os.path.isfile(default_filename):
default_filename = base_dir + '/defaultwelcome/profile_en.md'
copyfile(default_filename, profile_filename)
instanceTitle = \
instance_title = \
get_config_param(base_dir, 'instanceTitle')
if not instanceTitle:
instanceTitle = 'Epicyon'
if not instance_title:
instance_title = 'Epicyon'
if os.path.isfile(profileFilename):
with open(profileFilename, 'r') as profileFile:
profileText = profileFile.read()
profileText = profileText.replace('INSTANCE', instanceTitle)
profileText = markdown_to_html(remove_html(profileText))
if os.path.isfile(profile_filename):
with open(profile_filename, 'r') as fp_pro:
profile_text = fp_pro.read()
profile_text = profile_text.replace('INSTANCE', instance_title)
profile_text = markdown_to_html(remove_html(profile_text))
profileForm = ''
profile_form = ''
css_filename = base_dir + '/epicyon-welcome.css'
if os.path.isfile(base_dir + '/welcome.css'):
css_filename = base_dir + '/welcome.css'
profileForm = \
html_header_with_external_style(css_filename, instanceTitle, None)
profile_form = \
html_header_with_external_style(css_filename, instance_title, None)
# get the url of the avatar
ext = 'png'
for ext in get_image_extensions():
avatarFilename = \
avatar_filename = \
acct_dir(base_dir, nickname, domain) + '/avatar.' + ext
if os.path.isfile(avatarFilename):
if os.path.isfile(avatar_filename):
break
avatarUrl = \
local_actor_url(http_prefix, nickname, domain_full) + '/avatar.' + ext
avatar_url = \
local_actor_url(http_prefix, nickname, domain_full) + \
'/avatar.' + ext
imageFormats = get_image_formats()
profileForm += '<div class="container">' + profileText + '</div>\n'
profileForm += \
image_formats = get_image_formats()
profile_form += '<div class="container">' + profile_text + '</div>\n'
profile_form += \
'<form enctype="multipart/form-data" method="POST" ' + \
'accept-charset="UTF-8" ' + \
'action="/users/' + nickname + '/profiledata">\n'
profileForm += '<div class="container">\n'
profileForm += ' <center>\n'
profileForm += ' <img class="welcomeavatar" src="'
profileForm += avatarUrl + '"><br>\n'
profileForm += ' <input type="file" id="avatar" name="avatar" '
profileForm += 'accept="' + imageFormats + '">\n'
profileForm += ' </center>\n'
profileForm += '</div>\n'
profile_form += '<div class="container">\n'
profile_form += ' <center>\n'
profile_form += ' <img class="welcomeavatar" src="'
profile_form += avatar_url + '"><br>\n'
profile_form += ' <input type="file" id="avatar" name="avatar" '
profile_form += 'accept="' + image_formats + '">\n'
profile_form += ' </center>\n'
profile_form += '</div>\n'
profileForm += '<center>\n'
profileForm += \
profile_form += '<center>\n'
profile_form += \
' <button type="submit" class="button" ' + \
'name="previewAvatar">' + translate['Preview'] + '</button> '
profileForm += '</center>\n'
profile_form += '</center>\n'
actorFilename = acct_dir(base_dir, nickname, domain) + '.json'
actor_json = load_json(actorFilename)
displayNickname = actor_json['name']
profileForm += '<div class="container">\n'
profileForm += \
actor_filename = acct_dir(base_dir, nickname, domain) + '.json'
actor_json = load_json(actor_filename)
display_nickname = actor_json['name']
profile_form += '<div class="container">\n'
profile_form += \
edit_text_field(translate['Nickname'], 'displayNickname',
displayNickname)
display_nickname)
bioStr = \
bio_str = \
actor_json['summary'].replace('<p>', '').replace('</p>', '')
if not bioStr:
bioStr = translate['Your bio']
profileForm += ' <label class="labels">' + \
if not bio_str:
bio_str = translate['Your bio']
profile_form += ' <label class="labels">' + \
translate['Your bio'] + '</label><br>\n'
profileForm += ' <textarea id="message" name="bio" ' + \
profile_form += ' <textarea id="message" name="bio" ' + \
'style="height:130px" spellcheck="true">' + \
bioStr + '</textarea>\n'
profileForm += '</div>\n'
bio_str + '</textarea>\n'
profile_form += '</div>\n'
profileForm += '<div class="container next">\n'
profileForm += \
profile_form += '<div class="container next">\n'
profile_form += \
' <button type="submit" class="button" ' + \
'name="initialWelcomeScreen">' + translate['Go Back'] + '</button> '
profileForm += \
profile_form += \
' <button type="submit" class="button" ' + \
'name="finalWelcomeScreen">' + translate['Next'] + '</button>\n'
profileForm += '</div>\n'
profile_form += '</div>\n'
profileForm += '</form>\n'
profileForm += html_footer()
return profileForm
profile_form += '</form>\n'
profile_form += html_footer()
return profile_form