Icons web path

main
Bob Mottram 2020-12-09 12:29:56 +00:00
parent 562e154aa9
commit a08f3d2cd7
2 changed files with 20 additions and 11 deletions

View File

@ -3823,9 +3823,8 @@ class PubServer(BaseHTTPRequestHandler):
# change theme # change theme
if fields.get('themeDropdown'): if fields.get('themeDropdown'):
setTheme(baseDir, self.themeName = fields['themeDropdown']
fields['themeDropdown'], setTheme(baseDir, self.themeName, domain,
domain,
allowLocalNetworkAccess) allowLocalNetworkAccess)
self.server.showPublishAsIcon = \ self.server.showPublishAsIcon = \
getConfigParam(self.server.baseDir, getConfigParam(self.server.baseDir,
@ -4197,6 +4196,7 @@ class PubServer(BaseHTTPRequestHandler):
'.etag') '.etag')
currTheme = getTheme(baseDir) currTheme = getTheme(baseDir)
if currTheme: if currTheme:
self.themeName = currTheme
setTheme(baseDir, currTheme, domain, setTheme(baseDir, currTheme, domain,
self.server.allowLocalNetworkAccess) self.server.allowLocalNetworkAccess)
self.server.showPublishAsIcon = \ self.server.showPublishAsIcon = \
@ -5060,8 +5060,11 @@ class PubServer(BaseHTTPRequestHandler):
if path.endswith('.png'): if path.endswith('.png'):
mediaStr = path.split('/icons/')[1] mediaStr = path.split('/icons/')[1]
if '/' not in mediaStr: if '/' not in mediaStr:
theme = 'default' if not self.themeName:
iconFilename = mediaStr theme = 'default'
else:
theme = self.themeName
iconFilename = mediaStr
else: else:
theme = mediaStr.split('/')[0] theme = mediaStr.split('/')[0]
iconFilename = mediaStr.split('/')[1] iconFilename = mediaStr.split('/')[1]
@ -13113,6 +13116,11 @@ def runDaemon(maxNewswirePosts: int,
else: else:
httpd.thrPostsQueue.start() httpd.thrPostsQueue.start()
# get the current theme
httpd.themeName = getConfigParam(baseDir, 'theme')
if not httpd.themeName:
httpd.themeName = 'default'
print('Creating expire thread for shared items') print('Creating expire thread for shared items')
httpd.thrSharesExpire = \ httpd.thrSharesExpire = \
threadWithTrace(target=runSharesExpire, threadWithTrace(target=runSharesExpire,

View File

@ -393,12 +393,13 @@ def getPersonAvatarUrl(baseDir: str, personUrl: str, personCache: {},
def getIconsWebPath(baseDir: str) -> str: def getIconsWebPath(baseDir: str) -> str:
"""Returns the web path where icons exist """Returns the web path where icons exist
""" """
iconsPath = 'icons' return 'icons'
theme = getConfigParam(baseDir, 'theme') # iconsPath = 'icons'
if theme: # theme = getConfigParam(baseDir, 'theme')
if os.path.isdir(baseDir + '/theme/' + theme + '/icons'): # if theme:
iconsPath = 'icons/' + theme # if os.path.isdir(baseDir + '/theme/' + theme + '/icons'):
return iconsPath # iconsPath = 'icons/' + theme
# return iconsPath
def scheduledPostsExist(baseDir: str, nickname: str, domain: str) -> bool: def scheduledPostsExist(baseDir: str, nickname: str, domain: str) -> bool: