From b0ae449c1abffa95ced860f20affb02fa939ba8a Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 26 May 2020 21:47:52 +0100 Subject: [PATCH] Checkbox to remove custom font --- daemon.py | 21 +++++++++++++++++++++ webinterface.py | 8 ++++++++ 2 files changed, 29 insertions(+) diff --git a/daemon.py b/daemon.py index 3d368f87..f85c9f11 100644 --- a/daemon.py +++ b/daemon.py @@ -5779,6 +5779,7 @@ class PubServer(BaseHTTPRequestHandler): removeScheduledPosts(self.server.baseDir, nickname, self.server.domain) + approveFollowers = False if fields.get('approveFollowers'): if fields['approveFollowers'] == 'on': @@ -5788,6 +5789,26 @@ class PubServer(BaseHTTPRequestHandler): actorJson['manuallyApprovesFollowers'] = \ approveFollowers 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'): self.server.mediaInstance = False self.server.defaultTimeline = 'inbox' diff --git a/webinterface.py b/webinterface.py index aa360de1..88873b08 100644 --- a/webinterface.py +++ b/webinterface.py @@ -1158,6 +1158,14 @@ def htmlEditProfile(translate: {}, baseDir: str, path: str, themesDropdown += \ ' ' + 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 += \ + ' ' + \ + translate['Remove the custom font'] + '
' themesDropdown += '' themeName = getConfigParam(baseDir, 'theme') themesDropdown = \