' \
@@ -621,10 +641,13 @@ def htmlTermsOfService(baseDir: str,httpPrefix: str,domainFull: str) -> str:
TOSText = file.read()
TOSForm=''
- with open(baseDir+'/epicyon-profile.css', 'r') as cssFile:
+ cssFilename=baseDir+'/epicyon-profile.css'
+ if os.path.isfile(baseDir+'/epicyon.css'):
+ cssFilename=baseDir+'/epicyon.css'
+ with open(cssFilename, 'r') as cssFile:
termsCSS = cssFile.read()
- TOSForm=htmlHeader(termsCSS)
+ TOSForm=htmlHeader(cssFilename,termsCSS)
TOSForm+='
'+TOSText+'
'
if adminNickname:
adminActor=httpPrefix+'://'+domainFull+'/users/'+adminNickname
@@ -648,10 +671,13 @@ def htmlAbout(baseDir: str,httpPrefix: str,domainFull: str) -> str:
aboutText = file.read()
aboutForm=''
- with open(baseDir+'/epicyon-profile.css', 'r') as cssFile:
+ cssFilename=baseDir+'/epicyon-profile.css'
+ if os.path.isfile(baseDir+'/epicyon.css'):
+ cssFilename=baseDir+'/epicyon.css'
+ with open(cssFilename, 'r') as cssFile:
termsCSS = cssFile.read()
- aboutForm=htmlHeader(termsCSS)
+ aboutForm=htmlHeader(cssFilename,termsCSS)
aboutForm+='
'+aboutText+'
'
if adminNickname:
adminActor=httpPrefix+'://'+domainFull+'/users/'+adminNickname
@@ -663,9 +689,12 @@ def htmlHashtagBlocked(baseDir: str) -> str:
"""Show the screen for a blocked hashtag
"""
blockedHashtagForm=''
- with open(baseDir+'/epicyon-suspended.css', 'r') as cssFile:
+ cssFilename=baseDir+'/epicyon-suspended.css'
+ if os.path.isfile(baseDir+'/suspended.css'):
+ cssFilename=baseDir+'/suspended.css'
+ with open(cssFilename, 'r') as cssFile:
blockedHashtagCSS=cssFile.read()
- blockedHashtagForm=htmlHeader(blockedHashtagCSS)
+ blockedHashtagForm=htmlHeader(cssFilename,blockedHashtagCSS)
blockedHashtagForm+='
'
blockedHashtagForm+=' Hashtag Blocked
'
blockedHashtagForm+=' See Terms of Service
'
@@ -677,9 +706,12 @@ def htmlSuspended(baseDir: str) -> str:
"""Show the screen for suspended accounts
"""
suspendedForm=''
- with open(baseDir+'/epicyon-suspended.css', 'r') as cssFile:
+ cssFilename=baseDir+'/epicyon-suspended.css'
+ if os.path.isfile(baseDir+'/suspended.css'):
+ cssFilename=baseDir+'/suspended.css'
+ with open(cssFilename, 'r') as cssFile:
suspendedCSS=cssFile.read()
- suspendedForm=htmlHeader(suspendedCSS)
+ suspendedForm=htmlHeader(cssFilename,suspendedCSS)
suspendedForm+=''
suspendedForm+=' Account Suspended
'
suspendedForm+=' See Terms of Service
'
@@ -722,7 +754,10 @@ def htmlNewPost(translate: {},baseDir: str, \
with open(baseDir+'/accounts/newpost.txt', 'r') as file:
newPostText = ''+file.read()+'
'
- with open(baseDir+'/epicyon-profile.css', 'r') as cssFile:
+ cssFilename=baseDir+'/epicyon-profile.css'
+ if os.path.isfile(baseDir+'/epicyon.css'):
+ cssFilename=baseDir+'/epicyon.css'
+ with open(cssFilename, 'r') as cssFile:
newPostCSS = cssFile.read()
if '?' in path:
@@ -765,7 +800,7 @@ def htmlNewPost(translate: {},baseDir: str, \
' ' \
''
- newPostForm=htmlHeader(newPostCSS)
+ newPostForm=htmlHeader(cssFilename,newPostCSS)
# only show the share option if this is not a reply
shareOptionOnDropdown=''
@@ -855,19 +890,21 @@ def htmlNewPost(translate: {},baseDir: str, \
newPostForm+=htmlFooter()
return newPostForm
-def htmlHeader(css=None,refreshSec=0,lang='en') -> str:
+def htmlHeader(cssFilename: str,css=None,refreshSec=0,lang='en') -> str:
if refreshSec==0:
meta=' \n'
else:
meta=' \n'
- if not css:
+ if not css:
+ if '/' in cssFilename:
+ cssFilename=cssFilename.split('/')[-1]
htmlStr= \
'\n' \
'\n'+ \
meta+ \
' \n' \
' \n'
@@ -1112,7 +1149,10 @@ def htmlProfile(translate: {},projectVersion: str, \
profileStr+=followApprovalsSection
- with open(baseDir+'/epicyon-profile.css', 'r') as cssFile:
+ cssFilename=baseDir+'/epicyon-profile.css'
+ if os.path.isfile(baseDir+'/epicyon.css'):
+ cssFilename=baseDir+'/epicyon.css'
+ with open(cssFilename, 'r') as cssFile:
profileStyle = cssFile.read().replace('image.png',actor+'/image.png')
if selected=='posts':
@@ -1151,7 +1191,7 @@ def htmlProfile(translate: {},projectVersion: str, \
if selected=='shares':
profileStr+= \
htmlProfileShares(translate,nickname,domainFull,extraJson)
- profileStr=htmlHeader(profileStyle)+profileStr+htmlFooter()
+ profileStr=htmlHeader(cssFilename,profileStyle)+profileStr+htmlFooter()
return profileStr
def individualFollowAsHtml(translate: {}, \
@@ -1825,7 +1865,10 @@ def htmlTimeline(translate: {},pageNumber: int, \
manuallyApproveFollowers: bool) -> str:
"""Show the timeline as html
"""
- with open(baseDir+'/epicyon-profile.css', 'r') as cssFile:
+ cssFilename=baseDir+'/epicyon-profile.css'
+ if os.path.isfile(baseDir+'/epicyon.css'):
+ cssFilename=baseDir+'/epicyon.css'
+ with open(cssFilename, 'r') as cssFile:
profileStyle = \
cssFile.read().replace('banner.png', \
'/users/'+nickname+'/banner.png')
@@ -1864,10 +1907,10 @@ def htmlTimeline(translate: {},pageNumber: int, \
if moderator:
moderationButtonStr=''
- tlStr=htmlHeader(profileStyle)
+ tlStr=htmlHeader(cssFilename,profileStyle)
#if (boxName=='inbox' or boxName=='dm') and pageNumber==1:
# refresh if on the first page of the inbox and dm timeline
- #tlStr=htmlHeader(profileStyle,240)
+ #tlStr=htmlHeader(cssFilename,profileStyle,240)
if boxName!='dm':
if not manuallyApproveFollowers:
@@ -2033,7 +2076,8 @@ def htmlIndividualPost(translate: {}, \
nickname,domain,port,item,None,True,False, \
httpPrefix,projectVersion, \
False,authorized,False,False)
- return htmlHeader()+postStr+htmlFooter()
+ cssFilename=baseDir+'/epicyon-profile.css'
+ return htmlHeader(cssFilename)+postStr+htmlFooter()
def htmlPostReplies(translate: {},baseDir: str, \
session,wfRequest: {},personCache: {}, \
@@ -2051,7 +2095,8 @@ def htmlPostReplies(translate: {},baseDir: str, \
httpPrefix,projectVersion, \
False,False,False,False)
- return htmlHeader()+repliesStr+htmlFooter()
+ cssFilename=baseDir+'/epicyon-profile.css'
+ return htmlHeader(cssFilename)+repliesStr+htmlFooter()
def htmlRemoveSharedItem(translate: {},baseDir: str,actor: str,shareName: str) -> str:
"""Shows a screen asking to confirm the removal of a shared item
@@ -2077,9 +2122,12 @@ def htmlRemoveSharedItem(translate: {},baseDir: str,actor: str,shareName: str) -
if not os.path.isfile(baseDir+'/accounts/shares-background.png'):
copyfile(baseDir+'/img/shares-background.png',baseDir+'/accounts/shares-background.png')
- with open(baseDir+'/epicyon-follow.css', 'r') as cssFile:
+ cssFilename=baseDir+'/epicyon-follow.css'
+ if os.path.isfile(baseDir+'/follow.css'):
+ cssFilename=baseDir+'/follow.css'
+ with open(cssFilename, 'r') as cssFile:
profileStyle = cssFile.read()
- sharesStr=htmlHeader(profileStyle)
+ sharesStr=htmlHeader(cssFilename,profileStyle)
sharesStr+=''
sharesStr+='
'
sharesStr+='
'
@@ -2124,9 +2172,12 @@ def htmlDeletePost(translate,pageNumber: int, \
baseDir+'/accounts/delete-background.png')
deletePostStr=None
- with open(baseDir+'/epicyon-profile.css', 'r') as cssFile:
+ cssFilename=baseDir+'/epicyon-profile.css'
+ if os.path.isfile(baseDir+'/epicyon.css'):
+ cssFilename=baseDir+'/epicyon.css'
+ with open(cssFilename, 'r') as cssFile:
profileStyle = cssFile.read()
- deletePostStr=htmlHeader(profileStyle)
+ deletePostStr=htmlHeader(cssFilename,profileStyle)
deletePostStr+=''
deletePostStr+= \
individualPostAsHtml(translate,pageNumber, \
@@ -2160,9 +2211,12 @@ def htmlFollowConfirm(translate: {},baseDir: str, \
if not os.path.isfile(baseDir+'/accounts/follow-background.png'):
copyfile(baseDir+'/img/follow-background.png',baseDir+'/accounts/follow-background.png')
- with open(baseDir+'/epicyon-follow.css', 'r') as cssFile:
+ cssFilename=baseDir+'/epicyon-follow.css'
+ if os.path.isfile(baseDir+'/follow.css'):
+ cssFilename=baseDir+'/follow.css'
+ with open(cssFilename, 'r') as cssFile:
profileStyle = cssFile.read()
- followStr=htmlHeader(profileStyle)
+ followStr=htmlHeader(cssFilename,profileStyle)
followStr+=''
followStr+='
'
followStr+='
'
@@ -2193,9 +2247,12 @@ def htmlUnfollowConfirm(translate: {},baseDir: str, \
if not os.path.isfile(baseDir+'/accounts/follow-background.png'):
copyfile(baseDir+'/img/follow-background.png',baseDir+'/accounts/follow-background.png')
- with open(baseDir+'/epicyon-follow.css', 'r') as cssFile:
+ cssFilename=baseDir+'/epicyon-follow.css'
+ if os.path.isfile(baseDir+'/follow.css'):
+ cssFilename=baseDir+'/follow.css'
+ with open(cssFilename, 'r') as cssFile:
profileStyle = cssFile.read()
- followStr=htmlHeader(profileStyle)
+ followStr=htmlHeader(cssFilename,profileStyle)
followStr+=''
followStr+='
'
followStr+='
'
@@ -2251,9 +2308,12 @@ def htmlPersonOptions(translate: {},baseDir: str, \
optionsLinkStr=''
if optionsLink:
optionsLinkStr=' '
- with open(baseDir+'/epicyon-follow.css', 'r') as cssFile:
+ cssFilename=baseDir+'/epicyon-follow.css'
+ if os.path.isfile(baseDir+'/follow.css'):
+ cssFilename=baseDir+'/follow.css'
+ with open(cssFilename, 'r') as cssFile:
profileStyle = cssFile.read()
- optionsStr=htmlHeader(profileStyle)
+ optionsStr=htmlHeader(cssFilename,profileStyle)
optionsStr+=''
optionsStr+='
'
optionsStr+='
'
@@ -2292,7 +2352,7 @@ def htmlPersonOptions(translate: {},baseDir: str, \
#
# with open(baseDir+'/epicyon-follow.css', 'r') as cssFile:
# profileStyle = cssFile.read()
-# blockStr=htmlHeader(profileStyle)
+# blockStr=htmlHeader(cssFilename,profileStyle)
# blockStr+=''
# blockStr+='
'
# blockStr+='
'
@@ -2323,9 +2383,12 @@ def htmlUnblockConfirm(translate: {},baseDir: str, \
if not os.path.isfile(baseDir+'/accounts/block-background.png'):
copyfile(baseDir+'/img/block-background.png',baseDir+'/accounts/block-background.png')
- with open(baseDir+'/epicyon-follow.css', 'r') as cssFile:
+ cssFilename=baseDir+'/epicyon-follow.css'
+ if os.path.isfile(baseDir+'/follow.css'):
+ cssFilename=baseDir+'/follow.css'
+ with open(cssFilename, 'r') as cssFile:
profileStyle = cssFile.read()
- blockStr=htmlHeader(profileStyle)
+ blockStr=htmlHeader(cssFilename,profileStyle)
blockStr+=''
blockStr+='
'
blockStr+='
'
@@ -2359,9 +2422,12 @@ def htmlSearchEmojiTextEntry(translate: {}, \
if not os.path.isfile(baseDir+'/accounts/search-background.png'):
copyfile(baseDir+'/img/search-background.png',baseDir+'/accounts/search-background.png')
- with open(baseDir+'/epicyon-follow.css', 'r') as cssFile:
+ cssFilename=baseDir+'/epicyon-follow.css'
+ if os.path.isfile(baseDir+'/follow.css'):
+ cssFilename=baseDir+'/follow.css'
+ with open(cssFilename, 'r') as cssFile:
profileStyle = cssFile.read()
- emojiStr=htmlHeader(profileStyle)
+ emojiStr=htmlHeader(cssFilename,profileStyle)
emojiStr+=''
emojiStr+='
'
emojiStr+='
'
@@ -2390,9 +2456,12 @@ def htmlSearch(translate: {}, \
if not os.path.isfile(baseDir+'/accounts/search-background.png'):
copyfile(baseDir+'/img/search-background.png',baseDir+'/accounts/search-background.png')
- with open(baseDir+'/epicyon-follow.css', 'r') as cssFile:
+ cssFilename=baseDir+'/epicyon-follow.css'
+ if os.path.isfile(baseDir+'/follow.css'):
+ cssFilename=baseDir+'/follow.css'
+ with open(cssFilename, 'r') as cssFile:
profileStyle = cssFile.read()
- followStr=htmlHeader(profileStyle)
+ followStr=htmlHeader(cssFilename,profileStyle)
followStr+=''
followStr+='
'
followStr+='
'
@@ -2452,7 +2521,10 @@ def htmlProfileAfterSearch(translate: {}, \
searchDomainFull=searchDomain+':'+str(searchPort)
profileStr=''
- with open(baseDir+'/epicyon-profile.css', 'r') as cssFile:
+ cssFilename=baseDir+'/epicyon-profile.css'
+ if os.path.isfile(baseDir+'/epicyon.css'):
+ cssFilename=baseDir+'/epicyon.css'
+ with open(cssFilename, 'r') as cssFile:
wf = webfingerHandle(session,searchNickname+'@'+searchDomainFull,httpPrefix,wfRequest, \
domain,projectVersion)
if not wf:
@@ -2543,4 +2615,4 @@ def htmlProfileAfterSearch(translate: {}, \
if i>=20:
break
- return htmlHeader(profileStyle)+profileStr+htmlFooter()
+ return htmlHeader(cssFilename,profileStyle)+profileStr+htmlFooter()