Checkbox to remove custom font

main
Bob Mottram 2020-05-26 21:47:52 +01:00
parent 270e4300eb
commit b0ae449c1a
2 changed files with 29 additions and 0 deletions

View File

@ -5779,6 +5779,7 @@ class PubServer(BaseHTTPRequestHandler):
removeScheduledPosts(self.server.baseDir, removeScheduledPosts(self.server.baseDir,
nickname, nickname,
self.server.domain) self.server.domain)
approveFollowers = False approveFollowers = False
if fields.get('approveFollowers'): if fields.get('approveFollowers'):
if fields['approveFollowers'] == 'on': if fields['approveFollowers'] == 'on':
@ -5788,6 +5789,26 @@ class PubServer(BaseHTTPRequestHandler):
actorJson['manuallyApprovesFollowers'] = \ actorJson['manuallyApprovesFollowers'] = \
approveFollowers approveFollowers
actorChanged = True actorChanged = True
if fields.get('removeCustomFont'):
if fields['removeCustomFont'] == 'on':
if os.path.isfile(self.server.baseDir +
'/fonts/custom.woff'):
os.remove(self.server.baseDir +
'/fonts/custom.woff')
elif os.path.isfile(self.server.baseDir +
'/fonts/custom.woff2'):
os.remove(self.server.baseDir +
'/fonts/custom.woff2')
elif os.path.isfile(self.server.baseDir +
'/fonts/custom.otf'):
os.remove(self.server.baseDir +
'/fonts/custom.otf')
elif os.path.isfile(self.server.baseDir +
'/fonts/custom.ttf'):
os.remove(self.server.baseDir +
'/fonts/custom.ttf')
if fields.get('mediaInstance'): if fields.get('mediaInstance'):
self.server.mediaInstance = False self.server.mediaInstance = False
self.server.defaultTimeline = 'inbox' self.server.defaultTimeline = 'inbox'

View File

@ -1158,6 +1158,14 @@ def htmlEditProfile(translate: {}, baseDir: str, path: str,
themesDropdown += \ themesDropdown += \
' <input type="file" id="customFont" name="customFont"' ' <input type="file" id="customFont" name="customFont"'
themesDropdown += ' accept="' + fontFormats + '">' themesDropdown += ' accept="' + fontFormats + '">'
if os.path.isfile(baseDir + '/fonts/custom.woff') or \
os.path.isfile(baseDir + '/fonts/custom.woff2') or \
os.path.isfile(baseDir + '/fonts/custom.otf') or \
os.path.isfile(baseDir + '/fonts/custom.ttf'):
themesDropdown += \
' <input type="checkbox" class="profilecheckbox" ' + \
'name="removeCustomFont">' + \
translate['Remove the custom font'] + '<br>'
themesDropdown += '</div>' themesDropdown += '</div>'
themeName = getConfigParam(baseDir, 'theme') themeName = getConfigParam(baseDir, 'theme')
themesDropdown = \ themesDropdown = \