diff --git a/daemon.py b/daemon.py index 17ed8d5b7..831ef1c87 100644 --- a/daemon.py +++ b/daemon.py @@ -1303,7 +1303,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.low_bandwidth, self.server.signing_priv_key_pem, self.server.peertubeInstances, - self.server.themeName, + self.server.theme_name, self.server.max_like_count, self.server.max_recent_posts, self.server.cw_lists, @@ -2131,7 +2131,7 @@ class PubServer(BaseHTTPRequestHandler): domain: str, domainFull: str, port: int, onion_domain: str, i2p_domain: str, debug: bool, accessKeys: {}, - defaultTimeline: str, themeName: str, + defaultTimeline: str, theme_name: str, allow_local_network_access: bool, system_language: str) -> None: """Receive POST from webapp_themeDesigner @@ -2168,10 +2168,10 @@ class PubServer(BaseHTTPRequestHandler): if 'submitThemeDesignerReset=' in themeParams or \ 'submitThemeDesigner=' not in themeParams: if 'submitThemeDesignerReset=' in themeParams: - resetThemeDesignerSettings(base_dir, themeName, domain, + resetThemeDesignerSettings(base_dir, theme_name, domain, allow_local_network_access, system_language) - setTheme(base_dir, themeName, domain, + setTheme(base_dir, theme_name, domain, allow_local_network_access, system_language) if callingDomain.endswith('.onion') and onion_domain: @@ -2200,7 +2200,7 @@ class PubServer(BaseHTTPRequestHandler): # Check for boolean values which are False. # These don't come through via themeParams, # so need to be checked separately - themeFilename = base_dir + '/theme/' + themeName + '/theme.json' + themeFilename = base_dir + '/theme/' + theme_name + '/theme.json' themeJson = loadJson(themeFilename) if themeJson: for variableName, value in themeJson.items(): @@ -2216,7 +2216,7 @@ class PubServer(BaseHTTPRequestHandler): variableName = variableName.replace('themeSetting_', '') themeDesignerParams[variableName] = key - setThemeFromDesigner(base_dir, themeName, domain, + setThemeFromDesigner(base_dir, theme_name, domain, themeDesignerParams, allow_local_network_access, system_language) @@ -2710,7 +2710,7 @@ class PubServer(BaseHTTPRequestHandler): domainFull, self.server.defaultTimeline, self.server.newswire, - self.server.themeName, + self.server.theme_name, True, accessKeys, customSubmitText, conversationId, @@ -2844,7 +2844,7 @@ class PubServer(BaseHTTPRequestHandler): domainFull, self.server.defaultTimeline, self.server.newswire, - self.server.themeName, + self.server.theme_name, True, accessKeys, customSubmitText, conversationId, @@ -3310,7 +3310,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.show_published_date_only, self.server.peertubeInstances, self.server.allow_local_network_access, - self.server.themeName, + self.server.theme_name, self.server.system_language, self.server.max_like_count, self.server.signing_priv_key_pem, @@ -3405,7 +3405,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.show_published_date_only, self.server.peertubeInstances, self.server.allow_local_network_access, - self.server.themeName, 'outbox', + self.server.theme_name, 'outbox', self.server.system_language, self.server.max_like_count, self.server.signing_priv_key_pem, @@ -3473,7 +3473,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.show_published_date_only, self.server.peertubeInstances, self.server.allow_local_network_access, - self.server.themeName, 'bookmarks', + self.server.theme_name, 'bookmarks', self.server.system_language, self.server.max_like_count, self.server.signing_priv_key_pem, @@ -3572,7 +3572,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.defaultTimeline, self.server.peertubeInstances, allow_local_network_access, - self.server.themeName, + self.server.theme_name, accessKeys, self.server.system_language, self.server.max_like_count, @@ -4859,9 +4859,9 @@ class PubServer(BaseHTTPRequestHandler): print('submitExportTheme') themeDownloadPath = actorStr if exportTheme(self.server.base_dir, - self.server.themeName): + self.server.theme_name): themeDownloadPath += \ - '/exports/' + self.server.themeName + '.zip' + '/exports/' + self.server.theme_name + '.zip' print('submitExportTheme path=' + themeDownloadPath) self._redirect_headers(themeDownloadPath, cookie, callingDomain) @@ -5010,8 +5010,8 @@ class PubServer(BaseHTTPRequestHandler): isArtist(base_dir, nickname): # change theme if fields.get('themeDropdown'): - self.server.themeName = fields['themeDropdown'] - setTheme(base_dir, self.server.themeName, domain, + self.server.theme_name = fields['themeDropdown'] + setTheme(base_dir, self.server.theme_name, domain, allow_local_network_access, system_language) self.server.text_mode_banner = \ @@ -5068,7 +5068,7 @@ class PubServer(BaseHTTPRequestHandler): # is this a news theme? if isNewsThemeName(self.server.base_dir, - self.server.themeName): + self.server.theme_name): fields['news_instance'] = 'on' # change news instance status @@ -5948,7 +5948,7 @@ class PubServer(BaseHTTPRequestHandler): ext + '.etag') currTheme = getTheme(base_dir) if currTheme: - self.server.themeName = currTheme + self.server.theme_name = currTheme allow_local_network_access = \ self.server.allow_local_network_access setTheme(base_dir, currTheme, domain, @@ -6676,13 +6676,13 @@ class PubServer(BaseHTTPRequestHandler): if 'image/avif' in self.headers['Accept']: favType = 'image/avif' favFilename = favFilename.split('.')[0] + '.avif' - if not self.server.themeName: - self.themeName = getConfigParam(base_dir, 'theme') - if not self.server.themeName: - self.server.themeName = 'default' + if not self.server.theme_name: + self.theme_name = getConfigParam(base_dir, 'theme') + if not self.server.theme_name: + self.server.theme_name = 'default' # custom favicon faviconFilename = \ - base_dir + '/theme/' + self.server.themeName + \ + base_dir + '/theme/' + self.server.theme_name + \ '/icons/' + favFilename if not favFilename.endswith('.ico'): if not os.path.isfile(faviconFilename): @@ -7326,10 +7326,10 @@ class PubServer(BaseHTTPRequestHandler): return mediaStr = path.split('/icons/')[1] if '/' not in mediaStr: - if not self.server.themeName: + if not self.server.theme_name: theme = 'default' else: - theme = self.server.themeName + theme = self.server.theme_name iconFilename = mediaStr else: theme = mediaStr.split('/')[0] @@ -7382,10 +7382,10 @@ class PubServer(BaseHTTPRequestHandler): return mediaStr = path.split('/helpimages/')[1] if '/' not in mediaStr: - if not self.server.themeName: + if not self.server.theme_name: theme = 'default' else: - theme = self.server.themeName + theme = self.server.theme_name iconFilename = mediaStr else: theme = mediaStr.split('/')[0] @@ -7550,7 +7550,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.show_published_date_only, self.server.peertubeInstances, self.server.allow_local_network_access, - self.server.themeName, + self.server.theme_name, self.server.system_language, self.server.max_like_count, self.server.signing_priv_key_pem, @@ -7763,7 +7763,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.show_published_date_only, self.server.peertubeInstances, self.server.allow_local_network_access, - self.server.themeName, + self.server.theme_name, self.server.system_language, self.server.max_like_count, showRepeats, @@ -8223,7 +8223,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.show_published_date_only, self.server.peertubeInstances, self.server.allow_local_network_access, - self.server.themeName, + self.server.theme_name, self.server.system_language, self.server.max_like_count, showRepeats, @@ -8377,7 +8377,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.show_published_date_only, self.server.peertubeInstances, self.server.allow_local_network_access, - self.server.themeName, + self.server.theme_name, self.server.system_language, self.server.max_like_count, showRepeats, @@ -8561,7 +8561,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.show_published_date_only, self.server.peertubeInstances, self.server.allow_local_network_access, - self.server.themeName, + self.server.theme_name, self.server.system_language, self.server.max_like_count, showRepeats, @@ -8733,7 +8733,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.show_published_date_only, self.server.peertubeInstances, self.server.allow_local_network_access, - self.server.themeName, + self.server.theme_name, self.server.system_language, self.server.max_like_count, showRepeats, @@ -8831,7 +8831,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.show_published_date_only, self.server.peertubeInstances, self.server.allow_local_network_access, - self.server.themeName, + self.server.theme_name, self.server.system_language, self.server.max_like_count, self.server.signing_priv_key_pem, @@ -8953,7 +8953,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.show_published_date_only, self.server.peertubeInstances, self.server.allow_local_network_access, - self.server.themeName, + self.server.theme_name, self.server.system_language, self.server.max_like_count, showRepeats, @@ -9081,7 +9081,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.show_published_date_only, self.server.peertubeInstances, self.server.allow_local_network_access, - self.server.themeName, + self.server.theme_name, self.server.system_language, self.server.max_like_count, showRepeats, @@ -9178,7 +9178,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.show_published_date_only, self.server.peertubeInstances, self.server.allow_local_network_access, - self.server.themeName, + self.server.theme_name, self.server.system_language, self.server.max_like_count, self.server.signing_priv_key_pem, @@ -9283,7 +9283,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.show_published_date_only, self.server.peertubeInstances, self.server.allow_local_network_access, - self.server.themeName, + self.server.theme_name, self.server.system_language, self.server.max_like_count, showRepeats, @@ -9393,7 +9393,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.show_published_date_only, self.server.peertubeInstances, self.server.allow_local_network_access, - self.server.themeName, + self.server.theme_name, self.server.system_language, self.server.max_like_count, showRepeats, @@ -9515,7 +9515,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.show_published_date_only, peertubeInstances, self.server.allow_local_network_access, - self.server.themeName, + self.server.theme_name, self.server.system_language, self.server.max_like_count, self.server.signing_priv_key_pem, @@ -9607,7 +9607,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.show_published_date_only, peertubeInstances, self.server.allow_local_network_access, - self.server.themeName, + self.server.theme_name, self.server.system_language, self.server.max_like_count, self.server.signing_priv_key_pem, @@ -9709,7 +9709,7 @@ class PubServer(BaseHTTPRequestHandler): twitter_replacement_domain, self.server.show_published_date_only, self.server.newswire, - self.server.themeName, + self.server.theme_name, self.server.dormant_months, self.server.peertubeInstances, self.server.allow_local_network_access, @@ -9825,7 +9825,7 @@ class PubServer(BaseHTTPRequestHandler): twitter_replacement_domain, show_published_date_only, self.server.newswire, - self.server.themeName, + self.server.theme_name, self.server.dormant_months, self.server.peertubeInstances, allow_local_network_access, @@ -9997,7 +9997,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.show_published_date_only, self.server.peertubeInstances, self.server.allow_local_network_access, - self.server.themeName, + self.server.theme_name, self.server.system_language, self.server.max_like_count, self.server.signing_priv_key_pem, @@ -10257,7 +10257,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.rss_icon_at_top, self.server.publish_button_at_top, authorized, - self.server.themeName, + self.server.theme_name, self.server.peertubeInstances, self.server.allow_local_network_access, self.server.text_mode_banner, @@ -10409,7 +10409,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.icons_as_buttons, self.server.rss_icon_at_top, self.server.publish_button_at_top, - authorized, self.server.themeName, + authorized, self.server.theme_name, self.server.peertubeInstances, allow_local_network_access, self.server.text_mode_banner, @@ -10554,7 +10554,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.icons_as_buttons, self.server.rss_icon_at_top, self.server.publish_button_at_top, - authorized, self.server.themeName, + authorized, self.server.theme_name, self.server.peertubeInstances, allow_local_network_access, self.server.text_mode_banner, @@ -10696,7 +10696,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.rss_icon_at_top, self.server.publish_button_at_top, authorized, - self.server.themeName, + self.server.theme_name, self.server.peertubeInstances, self.server.allow_local_network_access, self.server.text_mode_banner, @@ -10838,7 +10838,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.rss_icon_at_top, self.server.publish_button_at_top, authorized, - self.server.themeName, + self.server.theme_name, self.server.peertubeInstances, self.server.allow_local_network_access, self.server.text_mode_banner, @@ -10990,7 +10990,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.rss_icon_at_top, self.server.publish_button_at_top, authorized, - self.server.themeName, + self.server.theme_name, self.server.peertubeInstances, self.server.allow_local_network_access, self.server.text_mode_banner, @@ -11141,7 +11141,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.rss_icon_at_top, self.server.publish_button_at_top, authorized, - self.server.themeName, + self.server.theme_name, self.server.peertubeInstances, allow_local_network_access, self.server.text_mode_banner, @@ -11249,7 +11249,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.icons_as_buttons, self.server.rss_icon_at_top, self.server.publish_button_at_top, - authorized, self.server.themeName, + authorized, self.server.theme_name, self.server.peertubeInstances, self.server.allow_local_network_access, self.server.text_mode_banner, @@ -11334,7 +11334,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.icons_as_buttons, self.server.rss_icon_at_top, self.server.publish_button_at_top, - authorized, self.server.themeName, + authorized, self.server.theme_name, self.server.peertubeInstances, self.server.allow_local_network_access, self.server.text_mode_banner, @@ -11459,7 +11459,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.rss_icon_at_top, self.server.publish_button_at_top, authorized, - self.server.themeName, + self.server.theme_name, self.server.peertubeInstances, allow_local_network_access, self.server.text_mode_banner, @@ -11597,7 +11597,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.rss_icon_at_top, self.server.publish_button_at_top, authorized, - self.server.themeName, + self.server.theme_name, self.server.peertubeInstances, self.server.allow_local_network_access, self.server.text_mode_banner, @@ -11731,7 +11731,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.rss_icon_at_top, self.server.publish_button_at_top, authorized, moderationActionStr, - self.server.themeName, + self.server.theme_name, self.server.peertubeInstances, allow_local_network_access, self.server.text_mode_banner, @@ -11850,7 +11850,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.twitter_replacement_domain, self.server.show_published_date_only, self.server.newswire, - self.server.themeName, + self.server.theme_name, self.server.dormant_months, self.server.peertubeInstances, self.server.allow_local_network_access, @@ -11971,7 +11971,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.twitter_replacement_domain, self.server.show_published_date_only, self.server.newswire, - self.server.themeName, + self.server.theme_name, self.server.dormant_months, self.server.peertubeInstances, self.server.allow_local_network_access, @@ -12091,7 +12091,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.twitter_replacement_domain, self.server.show_published_date_only, self.server.newswire, - self.server.themeName, + self.server.theme_name, self.server.dormant_months, self.server.peertubeInstances, self.server.allow_local_network_access, @@ -12227,7 +12227,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.twitter_replacement_domain, self.server.show_published_date_only, self.server.newswire, - self.server.themeName, + self.server.theme_name, self.server.dormant_months, self.server.peertubeInstances, self.server.allow_local_network_access, @@ -12682,7 +12682,7 @@ class PubServer(BaseHTTPRequestHandler): return True def _showDefaultProfileBackground(self, callingDomain: str, path: str, - base_dir: str, themeName: str, + base_dir: str, theme_name: str, GETstartTime) -> bool: """If a background image is missing after searching for a handle then substitute this image @@ -12690,7 +12690,7 @@ class PubServer(BaseHTTPRequestHandler): imageExtensions = getImageExtensions() for ext in imageExtensions: bgFilename = \ - base_dir + '/theme/' + themeName + '/image.' + ext + base_dir + '/theme/' + theme_name + '/image.' + ext if os.path.isfile(bgFilename): if self._etag_exists(bgFilename): # The file has not changed @@ -12978,7 +12978,7 @@ class PubServer(BaseHTTPRequestHandler): domainFull, self.server.defaultTimeline, self.server.newswire, - self.server.themeName, + self.server.theme_name, noDropDown, accessKeys, customSubmitText, conversationId, @@ -13075,7 +13075,7 @@ class PubServer(BaseHTTPRequestHandler): port, http_prefix, self.server.defaultTimeline, - self.server.themeName, + self.server.theme_name, peertubeInstances, self.server.text_mode_banner, city, @@ -13149,7 +13149,7 @@ class PubServer(BaseHTTPRequestHandler): port, http_prefix, self.server.defaultTimeline, - self.server.themeName, + self.server.theme_name, accessKeys).encode('utf-8') if msg: msglen = len(msg) @@ -14206,7 +14206,7 @@ class PubServer(BaseHTTPRequestHandler): itemID, self.server.translate, self.server.shared_items_federated_domains, self.server.defaultTimeline, - self.server.themeName, 'shares', category) + self.server.theme_name, 'shares', category) if not msg: if callingDomain.endswith('.onion') and \ self.server.onion_domain: @@ -14245,7 +14245,7 @@ class PubServer(BaseHTTPRequestHandler): itemID, self.server.translate, self.server.shared_items_federated_domains, self.server.defaultTimeline, - self.server.themeName, 'wanted', category) + self.server.theme_name, 'wanted', category) if not msg: if callingDomain.endswith('.onion') and \ self.server.onion_domain: @@ -14466,7 +14466,7 @@ class PubServer(BaseHTTPRequestHandler): nickname, self.server.domain, self.server.translate, self.server.defaultTimeline, - self.server.themeName, + self.server.theme_name, self.server.accessKeys) msg = msg.encode('utf-8') msglen = len(msg) @@ -14494,7 +14494,7 @@ class PubServer(BaseHTTPRequestHandler): htmlWelcomeScreen(self.server.base_dir, nickname, self.server.system_language, self.server.translate, - self.server.themeName) + self.server.theme_name) msg = msg.encode('utf-8') msglen = len(msg) self._login_headers('text/html', msglen, callingDomain) @@ -14522,7 +14522,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.domainFull, self.server.system_language, self.server.translate, - self.server.themeName) + self.server.theme_name) msg = msg.encode('utf-8') msglen = len(msg) self._login_headers('text/html', msglen, callingDomain) @@ -14550,7 +14550,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.domainFull, self.server.system_language, self.server.translate, - self.server.themeName) + self.server.theme_name) msg = msg.encode('utf-8') msglen = len(msg) self._login_headers('text/html', msglen, callingDomain) @@ -14763,7 +14763,7 @@ class PubServer(BaseHTTPRequestHandler): if self.path.startswith('/defaultprofilebackground'): self._showDefaultProfileBackground(callingDomain, self.path, self.server.base_dir, - self.server.themeName, + self.server.theme_name, GETstartTime) return @@ -14996,7 +14996,7 @@ class PubServer(BaseHTTPRequestHandler): rss_icon_at_top, icons_as_buttons, defaultTimeline, - self.server.themeName, + self.server.theme_name, accessKeys).encode('utf-8') msglen = len(msg) self._set_headers('text/html', msglen, @@ -15035,7 +15035,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.rss_icon_at_top, icons_as_buttons, defaultTimeline, - self.server.themeName, + self.server.theme_name, accessKeys, sharedItemsDomains).encode('utf-8') msglen = len(msg) @@ -15122,7 +15122,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.path, self.server.domain, self.server.defaultTimeline, - self.server.themeName, + self.server.theme_name, self.server.text_mode_banner, accessKeys).encode('utf-8') msglen = len(msg) @@ -15141,7 +15141,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.translate, self.server.base_dir, self.path, self.server.domain, - self.server.themeName) + self.server.theme_name) if msg: msg = msg.encode('utf-8') msglen = len(msg) @@ -15730,7 +15730,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.domain, self.server.port, cookie, - self.server.themeName): + self.server.theme_name): self.server.GETbusy = False return @@ -16673,7 +16673,7 @@ class PubServer(BaseHTTPRequestHandler): fields['message'], filename, attachmentMediaType, fields['imageDescription'], - self.server.themeName) + self.server.theme_name) if messageJson: messageJson = messageJson.encode('utf-8') messageJsonLen = len(messageJson) @@ -17942,7 +17942,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.debug, accessKeys, self.server.defaultTimeline, - self.server.themeName, + self.server.theme_name, self.server.allow_local_network_access, self.server.system_language) self.server.POSTbusy = False @@ -18812,10 +18812,10 @@ def runDaemon(content_license_url: str, httpd.cw_lists = loadCWLists(base_dir, True) # set the avatar for the news account - httpd.themeName = getConfigParam(base_dir, 'theme') - if not httpd.themeName: - httpd.themeName = 'default' - if isNewsThemeName(base_dir, httpd.themeName): + httpd.theme_name = getConfigParam(base_dir, 'theme') + if not httpd.theme_name: + httpd.theme_name = 'default' + if isNewsThemeName(base_dir, httpd.theme_name): news_instance = True httpd.news_instance = news_instance @@ -18828,7 +18828,7 @@ def runDaemon(content_license_url: str, httpd.defaultTimeline = 'tlfeatures' setNewsAvatar(base_dir, - httpd.themeName, + httpd.theme_name, http_prefix, domain, httpd.domainFull) @@ -18942,7 +18942,7 @@ def runDaemon(content_license_url: str, httpd.allow_local_network_access, httpd.peertubeInstances, verify_all_signatures, - httpd.themeName, + httpd.theme_name, httpd.system_language, httpd.max_like_count, httpd.signing_priv_key_pem, diff --git a/epicyon.py b/epicyon.py index 53014959e..389daa8e0 100644 --- a/epicyon.py +++ b/epicyon.py @@ -992,10 +992,10 @@ if not os.path.isdir(base_dir + '/cache/announce'): os.mkdir(base_dir + '/cache/announce') # set the theme in config.json -themeName = getConfigParam(base_dir, 'theme') -if not themeName: +theme_name = getConfigParam(base_dir, 'theme') +if not theme_name: setConfigParam(base_dir, 'theme', 'default') - themeName = 'default' + theme_name = 'default' if not args.mediainstance: media_instance = getConfigParam(base_dir, 'media_instance') @@ -3180,9 +3180,9 @@ if twitterDomain: if '.' in twitterDomain: args.twitter_replacement_domain = twitterDomain -if setTheme(base_dir, themeName, domain, +if setTheme(base_dir, theme_name, domain, args.allow_local_network_access, args.language): - print('Theme set to ' + themeName) + print('Theme set to ' + theme_name) # whether new registrations are open or closed if args.registration: diff --git a/inbox.py b/inbox.py index c11c7d0b7..9b2bed440 100644 --- a/inbox.py +++ b/inbox.py @@ -289,7 +289,7 @@ def _inboxStorePostToHtmlCache(recentPostsCache: {}, max_recent_posts: int, show_published_date_only: bool, peertubeInstances: [], allow_local_network_access: bool, - themeName: str, system_language: str, + theme_name: str, system_language: str, max_like_count: int, signing_priv_key_pem: str, cw_lists: {}, @@ -316,7 +316,7 @@ def _inboxStorePostToHtmlCache(recentPostsCache: {}, max_recent_posts: int, yt_replace_domain, twitter_replacement_domain, show_published_date_only, peertubeInstances, allow_local_network_access, - themeName, system_language, max_like_count, + theme_name, system_language, max_like_count, notDM, True, True, False, True, False, cw_lists, lists_enabled) @@ -1005,7 +1005,7 @@ def _receiveLike(recentPostsCache: {}, twitter_replacement_domain: str, peertubeInstances: [], allow_local_network_access: bool, - themeName: str, system_language: str, + theme_name: str, system_language: str, max_like_count: int, cw_lists: {}, lists_enabled: str) -> bool: """Receives a Like activity within the POST section of HTTPServer @@ -1105,7 +1105,7 @@ def _receiveLike(recentPostsCache: {}, show_published_date_only, peertubeInstances, allow_local_network_access, - themeName, system_language, + theme_name, system_language, max_like_count, notDM, showIndividualPostIcons, manuallyApproveFollowers, @@ -1127,7 +1127,7 @@ def _receiveUndoLike(recentPostsCache: {}, twitter_replacement_domain: str, peertubeInstances: [], allow_local_network_access: bool, - themeName: str, system_language: str, + theme_name: str, system_language: str, max_like_count: int, cw_lists: {}, lists_enabled: str) -> bool: """Receives an undo like activity within the POST section of HTTPServer @@ -1216,7 +1216,7 @@ def _receiveUndoLike(recentPostsCache: {}, show_published_date_only, peertubeInstances, allow_local_network_access, - themeName, system_language, + theme_name, system_language, max_like_count, notDM, showIndividualPostIcons, manuallyApproveFollowers, @@ -1239,7 +1239,7 @@ def _receiveReaction(recentPostsCache: {}, twitter_replacement_domain: str, peertubeInstances: [], allow_local_network_access: bool, - themeName: str, system_language: str, + theme_name: str, system_language: str, max_like_count: int, cw_lists: {}, lists_enabled: str) -> bool: """Receives an emoji reaction within the POST section of HTTPServer @@ -1364,7 +1364,7 @@ def _receiveReaction(recentPostsCache: {}, show_published_date_only, peertubeInstances, allow_local_network_access, - themeName, system_language, + theme_name, system_language, max_like_count, notDM, showIndividualPostIcons, manuallyApproveFollowers, @@ -1386,7 +1386,7 @@ def _receiveUndoReaction(recentPostsCache: {}, twitter_replacement_domain: str, peertubeInstances: [], allow_local_network_access: bool, - themeName: str, system_language: str, + theme_name: str, system_language: str, max_like_count: int, cw_lists: {}, lists_enabled: str) -> bool: """Receives an undo emoji reaction within the POST section of HTTPServer @@ -1491,7 +1491,7 @@ def _receiveUndoReaction(recentPostsCache: {}, show_published_date_only, peertubeInstances, allow_local_network_access, - themeName, system_language, + theme_name, system_language, max_like_count, notDM, showIndividualPostIcons, manuallyApproveFollowers, @@ -1512,7 +1512,7 @@ def _receiveBookmark(recentPostsCache: {}, twitter_replacement_domain: str, peertubeInstances: [], allow_local_network_access: bool, - themeName: str, system_language: str, + theme_name: str, system_language: str, max_like_count: int, cw_lists: {}, lists_enabled: {}) -> bool: """Receives a bookmark activity within the POST section of HTTPServer @@ -1601,7 +1601,7 @@ def _receiveBookmark(recentPostsCache: {}, show_published_date_only, peertubeInstances, allow_local_network_access, - themeName, system_language, + theme_name, system_language, max_like_count, notDM, showIndividualPostIcons, manuallyApproveFollowers, @@ -1622,7 +1622,7 @@ def _receiveUndoBookmark(recentPostsCache: {}, twitter_replacement_domain: str, peertubeInstances: [], allow_local_network_access: bool, - themeName: str, system_language: str, + theme_name: str, system_language: str, max_like_count: int, cw_lists: {}, lists_enabled: str) -> bool: """Receives an undo bookmark activity within the POST section of HTTPServer @@ -1712,7 +1712,7 @@ def _receiveUndoBookmark(recentPostsCache: {}, show_published_date_only, peertubeInstances, allow_local_network_access, - themeName, system_language, + theme_name, system_language, max_like_count, notDM, showIndividualPostIcons, manuallyApproveFollowers, @@ -1805,7 +1805,7 @@ def _receiveAnnounce(recentPostsCache: {}, yt_replace_domain: str, twitter_replacement_domain: str, allow_local_network_access: bool, - themeName: str, system_language: str, + theme_name: str, system_language: str, signing_priv_key_pem: str, max_recent_posts: int, allow_deletion: bool, @@ -1919,7 +1919,7 @@ def _receiveAnnounce(recentPostsCache: {}, show_published_date_only, peertubeInstances, allow_local_network_access, - themeName, system_language, + theme_name, system_language, max_like_count, notDM, showIndividualPostIcons, manuallyApproveFollowers, @@ -1990,7 +1990,7 @@ def _receiveAnnounce(recentPostsCache: {}, nickname, domain, domainFull, post_json_object, person_cache, translate, lookupActor, - themeName) + theme_name) try: with open(postFilename + '.tts', 'w+') as ttsFile: ttsFile.write('\n') @@ -2987,7 +2987,7 @@ def _receiveQuestionVote(base_dir: str, nickname: str, domain: str, twitter_replacement_domain: str, peertubeInstances: [], allow_local_network_access: bool, - themeName: str, system_language: str, + theme_name: str, system_language: str, max_like_count: int, cw_lists: {}, lists_enabled: bool) -> None: """Updates the votes on a Question/poll @@ -3032,7 +3032,7 @@ def _receiveQuestionVote(base_dir: str, nickname: str, domain: str, show_published_date_only, peertubeInstances, allow_local_network_access, - themeName, system_language, + theme_name, system_language, max_like_count, notDM, showIndividualPostIcons, manuallyApproveFollowers, @@ -3196,7 +3196,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int, allow_local_network_access: bool, peertubeInstances: [], lastBounceMessage: [], - themeName: str, system_language: str, + theme_name: str, system_language: str, max_like_count: int, signing_priv_key_pem: str, default_reply_interval_hrs: int, @@ -3230,7 +3230,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int, twitter_replacement_domain, peertubeInstances, allow_local_network_access, - themeName, system_language, + theme_name, system_language, max_like_count, cw_lists, lists_enabled): if debug: print('DEBUG: Like accepted from ' + actor) @@ -3252,7 +3252,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int, twitter_replacement_domain, peertubeInstances, allow_local_network_access, - themeName, system_language, + theme_name, system_language, max_like_count, cw_lists, lists_enabled): if debug: print('DEBUG: Undo like accepted from ' + actor) @@ -3275,7 +3275,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int, twitter_replacement_domain, peertubeInstances, allow_local_network_access, - themeName, system_language, + theme_name, system_language, max_like_count, cw_lists, lists_enabled): if debug: print('DEBUG: Reaction accepted from ' + actor) @@ -3297,7 +3297,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int, twitter_replacement_domain, peertubeInstances, allow_local_network_access, - themeName, system_language, + theme_name, system_language, max_like_count, cw_lists, lists_enabled): if debug: print('DEBUG: Undo reaction accepted from ' + actor) @@ -3319,7 +3319,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int, twitter_replacement_domain, peertubeInstances, allow_local_network_access, - themeName, system_language, + theme_name, system_language, max_like_count, cw_lists, lists_enabled): if debug: print('DEBUG: Bookmark accepted from ' + actor) @@ -3341,7 +3341,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int, twitter_replacement_domain, peertubeInstances, allow_local_network_access, - themeName, system_language, + theme_name, system_language, max_like_count, cw_lists, lists_enabled): if debug: print('DEBUG: Undo bookmark accepted from ' + actor) @@ -3363,7 +3363,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int, yt_replace_domain, twitter_replacement_domain, allow_local_network_access, - themeName, system_language, + theme_name, system_language, signing_priv_key_pem, max_recent_posts, allow_deletion, @@ -3463,7 +3463,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int, twitter_replacement_domain, peertubeInstances, allow_local_network_access, - themeName, system_language, + theme_name, system_language, max_like_count, cw_lists, lists_enabled) @@ -3547,7 +3547,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int, updateSpeaker(base_dir, http_prefix, nickname, domain, domainFull, post_json_object, person_cache, - translate, None, themeName) + translate, None, theme_name) if not unit_test: if debug: print('Saving inbox post as html to cache') @@ -3568,7 +3568,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int, show_published_date_only, peertubeInstances, allow_local_network_access, - themeName, system_language, + theme_name, system_language, max_like_count, signing_priv_key_pem, cw_lists, lists_enabled) @@ -4081,7 +4081,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int, allow_local_network_access: bool, peertubeInstances: [], verify_all_signatures: bool, - themeName: str, system_language: str, + theme_name: str, system_language: str, max_like_count: int, signing_priv_key_pem: str, default_reply_interval_hrs: int, cw_lists: {}) -> None: @@ -4511,7 +4511,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int, allow_local_network_access, peertubeInstances, lastBounceMessage, - themeName, system_language, + theme_name, system_language, max_like_count, signing_priv_key_pem, default_reply_interval_hrs, diff --git a/schedule.py b/schedule.py index 07b4ed6ea..f6490e396 100644 --- a/schedule.py +++ b/schedule.py @@ -124,7 +124,7 @@ def _updatePostSchedule(base_dir: str, handle: str, httpd, httpd.low_bandwidth, httpd.signing_priv_key_pem, httpd.peertubeInstances, - httpd.themeName, + httpd.theme_name, httpd.max_like_count, httpd.max_recent_posts, httpd.cw_lists, diff --git a/speaker.py b/speaker.py index c4fb90aa3..be6b7120d 100644 --- a/speaker.py +++ b/speaker.py @@ -265,7 +265,7 @@ def _speakerEndpointJson(displayName: str, summary: str, followRequestsExist: bool, followRequestsList: [], likedBy: str, published: str, postCal: bool, - postShare: bool, themeName: str, + postShare: bool, theme_name: str, isDirect: bool, replyToYou: bool) -> {}: """Returns a json endpoint for the TTS speaker """ @@ -281,7 +281,7 @@ def _speakerEndpointJson(displayName: str, summary: str, "direct": isDirect, "replyToYou": replyToYou, "notify": { - "theme": themeName, + "theme": theme_name, "dm": postDM, "reply": postReply, "followRequests": followRequestsExist, @@ -406,7 +406,7 @@ def _postToSpeakerJson(base_dir: str, http_prefix: str, nickname: str, domain: str, domainFull: str, post_json_object: {}, person_cache: {}, translate: {}, announcingActor: str, - themeName: str) -> {}: + theme_name: str) -> {}: """Converts an ActivityPub post into some Json containing speech synthesis parameters. NOTE: There currently appears to be no standardized json @@ -530,7 +530,7 @@ def _postToSpeakerJson(base_dir: str, http_prefix: str, followRequestsExist, followRequestsList, likedBy, published, - postCal, postShare, themeName, + postCal, postShare, theme_name, isDirect, replyToYou) @@ -538,7 +538,7 @@ def updateSpeaker(base_dir: str, http_prefix: str, nickname: str, domain: str, domainFull: str, post_json_object: {}, person_cache: {}, translate: {}, announcingActor: str, - themeName: str) -> None: + theme_name: str) -> None: """ Generates a json file which can be used for TTS announcement of incoming inbox posts """ @@ -547,6 +547,6 @@ def updateSpeaker(base_dir: str, http_prefix: str, nickname, domain, domainFull, post_json_object, person_cache, translate, announcingActor, - themeName) + theme_name) speakerFilename = acctDir(base_dir, nickname, domain) + '/speaker.json' saveJson(speakerJson, speakerFilename) diff --git a/theme.py b/theme.py index 1d06dea84..47f8cec30 100644 --- a/theme.py +++ b/theme.py @@ -110,10 +110,10 @@ def _getThemeFiles() -> []: 'welcome.css', 'graph.css') -def isNewsThemeName(base_dir: str, themeName: str) -> bool: +def isNewsThemeName(base_dir: str, theme_name: str) -> bool: """Returns true if the given theme is a news instance """ - themeDir = base_dir + '/theme/' + themeName + themeDir = base_dir + '/theme/' + theme_name if os.path.isfile(themeDir + '/is_news_instance'): return True return False @@ -127,23 +127,23 @@ def getThemesList(base_dir: str) -> []: """ themes = [] for subdir, dirs, files in os.walk(base_dir + '/theme'): - for themeName in dirs: - if '~' not in themeName and \ - themeName != 'icons' and themeName != 'fonts': - themes.append(themeName.title()) + for theme_name in dirs: + if '~' not in theme_name and \ + theme_name != 'icons' and theme_name != 'fonts': + themes.append(theme_name.title()) break themes.sort() print('Themes available: ' + str(themes)) return themes -def _copyThemeHelpFiles(base_dir: str, themeName: str, +def _copyThemeHelpFiles(base_dir: str, theme_name: str, system_language: str) -> None: """Copies any theme specific help files from the welcome subdirectory """ if not system_language: system_language = 'en' - themeDir = base_dir + '/theme/' + themeName + '/welcome' + themeDir = base_dir + '/theme/' + theme_name + '/welcome' if not os.path.isdir(themeDir): themeDir = base_dir + '/defaultwelcome' for subdir, dirs, files in os.walk(themeDir): @@ -492,17 +492,17 @@ def _setCustomFont(base_dir: str): cssfile.write(css) -def setThemeFromDesigner(base_dir: str, themeName: str, domain: str, +def setThemeFromDesigner(base_dir: str, theme_name: str, domain: str, themeParams: {}, allow_local_network_access: bool, system_language: str): customThemeFilename = base_dir + '/accounts/theme.json' saveJson(themeParams, customThemeFilename) - setTheme(base_dir, themeName, domain, + setTheme(base_dir, theme_name, domain, allow_local_network_access, system_language) -def resetThemeDesignerSettings(base_dir: str, themeName: str, domain: str, +def resetThemeDesignerSettings(base_dir: str, theme_name: str, domain: str, allow_local_network_access: bool, system_language: str) -> None: """Resets the theme designer settings @@ -515,7 +515,7 @@ def resetThemeDesignerSettings(base_dir: str, themeName: str, domain: str, print('EX: unable to remove theme designer settings on reset') -def _readVariablesFile(base_dir: str, themeName: str, +def _readVariablesFile(base_dir: str, theme_name: str, variablesFile: str, allow_local_network_access: bool) -> None: """Reads variables from a file in the theme directory @@ -538,7 +538,7 @@ def _readVariablesFile(base_dir: str, themeName: str, "options": "jpg", "search": "jpg" } - _setThemeFromDict(base_dir, themeName, themeParams, bgParams, + _setThemeFromDict(base_dir, theme_name, themeParams, bgParams, allow_local_network_access) @@ -566,13 +566,13 @@ def _setThemeDefault(base_dir: str, allow_local_network_access: bool): allow_local_network_access) -def _setThemeFonts(base_dir: str, themeName: str) -> None: +def _setThemeFonts(base_dir: str, theme_name: str) -> None: """Adds custom theme fonts """ - themeNameLower = themeName.lower() + theme_name_lower = theme_name.lower() fontsDir = base_dir + '/fonts' themeFontsDir = \ - base_dir + '/theme/' + themeNameLower + '/fonts' + base_dir + '/theme/' + theme_name_lower + '/fonts' if not os.path.isdir(themeFontsDir): return for subdir, dirs, files in os.walk(themeFontsDir): @@ -661,20 +661,20 @@ def _setThemeImages(base_dir: str, name: str) -> None: """Changes the profile background image and banner to the defaults """ - themeNameLower = name.lower() + theme_name_lower = name.lower() profileImageFilename = \ - base_dir + '/theme/' + themeNameLower + '/image.png' + base_dir + '/theme/' + theme_name_lower + '/image.png' bannerFilename = \ - base_dir + '/theme/' + themeNameLower + '/banner.png' + base_dir + '/theme/' + theme_name_lower + '/banner.png' searchBannerFilename = \ - base_dir + '/theme/' + themeNameLower + '/search_banner.png' + base_dir + '/theme/' + theme_name_lower + '/search_banner.png' leftColImageFilename = \ - base_dir + '/theme/' + themeNameLower + '/left_col_image.png' + base_dir + '/theme/' + theme_name_lower + '/left_col_image.png' rightColImageFilename = \ - base_dir + '/theme/' + themeNameLower + '/right_col_image.png' + base_dir + '/theme/' + theme_name_lower + '/right_col_image.png' - _setTextModeTheme(base_dir, themeNameLower) + _setTextModeTheme(base_dir, theme_name_lower) backgroundNames = ('login', 'shares', 'delete', 'follow', 'options', 'block', 'search', 'calendar', @@ -689,13 +689,13 @@ def _setThemeImages(base_dir: str, name: str) -> None: for backgroundType in backgroundNames: for ext in extensions: - if themeNameLower == 'default': + if theme_name_lower == 'default': backgroundImageFilename = \ base_dir + '/theme/default/' + \ backgroundType + '_background.' + ext else: backgroundImageFilename = \ - base_dir + '/theme/' + themeNameLower + '/' + \ + base_dir + '/theme/' + theme_name_lower + '/' + \ backgroundType + '_background' + '.' + ext if os.path.isfile(backgroundImageFilename): @@ -831,18 +831,17 @@ def setTheme(base_dir: str, name: str, domain: str, _removeTheme(base_dir) themes = getThemesList(base_dir) - for themeName in themes: - themeNameLower = themeName.lower() - if name == themeNameLower: + for theme_name in themes: + theme_name_lower = theme_name.lower() + if name == theme_name_lower: + allow_access = allow_local_network_access try: - globals()['setTheme' + themeName](base_dir, - allow_local_network_access) + globals()['setTheme' + theme_name](base_dir, allow_access) except BaseException: - print('EX: setTheme unable to set theme ' + themeName) - pass + print('EX: setTheme unable to set theme ' + theme_name) if prevThemeName: - if prevThemeName.lower() != themeNameLower: + if prevThemeName.lower() != theme_name_lower: # change the banner and profile image # to the default for the theme _setThemeImages(base_dir, name) @@ -885,10 +884,10 @@ def setTheme(base_dir: str, name: str, domain: str, def updateDefaultThemesList(base_dir: str) -> None: """Recreates the list of default themes """ - themeNames = getThemesList(base_dir) + theme_names = getThemesList(base_dir) defaultThemesFilename = base_dir + '/defaultthemes.txt' with open(defaultThemesFilename, 'w+') as defaultThemesFile: - for name in themeNames: + for name in theme_names: defaultThemesFile.write(name + '\n') diff --git a/webapp_confirm.py b/webapp_confirm.py index 64198da83..fee321ba6 100644 --- a/webapp_confirm.py +++ b/webapp_confirm.py @@ -35,7 +35,7 @@ def htmlConfirmDelete(cssCache: {}, show_published_date_only: bool, peertubeInstances: [], allow_local_network_access: bool, - themeName: str, system_language: str, + theme_name: str, system_language: str, max_like_count: int, signing_priv_key_pem: str, cw_lists: {}, lists_enabled: str) -> str: """Shows a screen asking to confirm the deletion of a post @@ -77,7 +77,7 @@ def htmlConfirmDelete(cssCache: {}, twitter_replacement_domain, show_published_date_only, peertubeInstances, allow_local_network_access, - themeName, system_language, max_like_count, + theme_name, system_language, max_like_count, False, False, False, False, False, False, cw_lists, lists_enabled) deletePostStr += '