Icons web path

merge-requests/8/head
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
if fields.get('themeDropdown'):
setTheme(baseDir,
fields['themeDropdown'],
domain,
self.themeName = fields['themeDropdown']
setTheme(baseDir, self.themeName, domain,
allowLocalNetworkAccess)
self.server.showPublishAsIcon = \
getConfigParam(self.server.baseDir,
@ -4197,6 +4196,7 @@ class PubServer(BaseHTTPRequestHandler):
'.etag')
currTheme = getTheme(baseDir)
if currTheme:
self.themeName = currTheme
setTheme(baseDir, currTheme, domain,
self.server.allowLocalNetworkAccess)
self.server.showPublishAsIcon = \
@ -5060,7 +5060,10 @@ class PubServer(BaseHTTPRequestHandler):
if path.endswith('.png'):
mediaStr = path.split('/icons/')[1]
if '/' not in mediaStr:
if not self.themeName:
theme = 'default'
else:
theme = self.themeName
iconFilename = mediaStr
else:
theme = mediaStr.split('/')[0]
@ -13113,6 +13116,11 @@ def runDaemon(maxNewswirePosts: int,
else:
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')
httpd.thrSharesExpire = \
threadWithTrace(target=runSharesExpire,

View File

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