forked from indymedia/epicyon
Optional separate directories for themed icons
parent
e33d306970
commit
2740d760c9
110
webinterface.py
110
webinterface.py
|
@ -98,6 +98,16 @@ def htmlSearchEmoji(translate: {},baseDir: str,searchStr: str) -> str:
|
||||||
emojiForm+=htmlFooter()
|
emojiForm+=htmlFooter()
|
||||||
return emojiForm
|
return emojiForm
|
||||||
|
|
||||||
|
def getIconsDir(baseDir: str) -> str:
|
||||||
|
"""Returns the directory where icons exist
|
||||||
|
"""
|
||||||
|
iconsDir='icons'
|
||||||
|
theme=getConfigParam(baseDir,'theme')
|
||||||
|
if theme:
|
||||||
|
if os.path.isdir(baseDir+'img/icons/'+theme):
|
||||||
|
iconsDir='icons/'+theme
|
||||||
|
return iconsDir
|
||||||
|
|
||||||
def htmlSearchSharedItems(translate: {}, \
|
def htmlSearchSharedItems(translate: {}, \
|
||||||
baseDir: str,searchStr: str, \
|
baseDir: str,searchStr: str, \
|
||||||
pageNumber: int, \
|
pageNumber: int, \
|
||||||
|
@ -106,6 +116,7 @@ def htmlSearchSharedItems(translate: {}, \
|
||||||
domainFull: str,actor: str) -> str:
|
domainFull: str,actor: str) -> str:
|
||||||
"""Search results for shared items
|
"""Search results for shared items
|
||||||
"""
|
"""
|
||||||
|
iconsDir=getIconsDir(baseDir)
|
||||||
currPage=1
|
currPage=1
|
||||||
ctr=0
|
ctr=0
|
||||||
sharedItemsForm=''
|
sharedItemsForm=''
|
||||||
|
@ -168,7 +179,7 @@ def htmlSearchSharedItems(translate: {}, \
|
||||||
' <input type="hidden" name="actor" value="'+actor+'">' \
|
' <input type="hidden" name="actor" value="'+actor+'">' \
|
||||||
' <input type="hidden" name="searchtext" value="'+searchStrLower+'"><br>' \
|
' <input type="hidden" name="searchtext" value="'+searchStrLower+'"><br>' \
|
||||||
' <center><a href="'+actor+'" type="submit" name="submitSearch">' \
|
' <center><a href="'+actor+'" type="submit" name="submitSearch">' \
|
||||||
' <img class="pageicon" src="/icons/pageup.png" title="'+translate['Page up']+'" alt="'+translate['Page up']+'"/></a>' \
|
' <img class="pageicon" src="/'+iconsDir+'/pageup.png" title="'+translate['Page up']+'" alt="'+translate['Page up']+'"/></a>' \
|
||||||
' </center>' \
|
' </center>' \
|
||||||
'</form>'
|
'</form>'
|
||||||
resultsExist=True
|
resultsExist=True
|
||||||
|
@ -182,7 +193,7 @@ def htmlSearchSharedItems(translate: {}, \
|
||||||
' <input type="hidden" name="actor" value="'+actor+'">' \
|
' <input type="hidden" name="actor" value="'+actor+'">' \
|
||||||
' <input type="hidden" name="searchtext" value="'+searchStrLower+'"><br>' \
|
' <input type="hidden" name="searchtext" value="'+searchStrLower+'"><br>' \
|
||||||
' <center><a href="'+actor+'" type="submit" name="submitSearch">' \
|
' <center><a href="'+actor+'" type="submit" name="submitSearch">' \
|
||||||
' <img class="pageicon" src="/icons/pagedown.png" title="'+translate['Page down']+'" alt="'+translate['Page down']+'"/></a>' \
|
' <img class="pageicon" src="/'+iconsDir+'/pagedown.png" title="'+translate['Page down']+'" alt="'+translate['Page down']+'"/></a>' \
|
||||||
' </center>' \
|
' </center>' \
|
||||||
'</form>'
|
'</form>'
|
||||||
break
|
break
|
||||||
|
@ -238,6 +249,7 @@ def htmlHashtagSearch(translate: {}, \
|
||||||
httpPrefix: str,projectVersion: str) -> str:
|
httpPrefix: str,projectVersion: str) -> str:
|
||||||
"""Show a page containing search results for a hashtag
|
"""Show a page containing search results for a hashtag
|
||||||
"""
|
"""
|
||||||
|
iconsDir=getIconsDir(baseDir)
|
||||||
if hashtag.startswith('#'):
|
if hashtag.startswith('#'):
|
||||||
hashtag=hashtag[1:]
|
hashtag=hashtag[1:]
|
||||||
hashtagIndexFile=baseDir+'/tags/'+hashtag+'.txt'
|
hashtagIndexFile=baseDir+'/tags/'+hashtag+'.txt'
|
||||||
|
@ -264,7 +276,7 @@ def htmlHashtagSearch(translate: {}, \
|
||||||
hashtagSearchForm+='<center><h1>#'+hashtag+'</h1></center>'
|
hashtagSearchForm+='<center><h1>#'+hashtag+'</h1></center>'
|
||||||
if startIndex!=len(lines)-1:
|
if startIndex!=len(lines)-1:
|
||||||
# previous page link
|
# previous page link
|
||||||
hashtagSearchForm+='<center><a href="/tags/'+hashtag+'?page='+str(pageNumber-1)+'"><img class="pageicon" src="/icons/pageup.png" title="'+translate['Page up']+'" alt="'+translate['Page up']+'"></a></center>'
|
hashtagSearchForm+='<center><a href="/tags/'+hashtag+'?page='+str(pageNumber-1)+'"><img class="pageicon" src="/'+iconsDir+'/pageup.png" title="'+translate['Page up']+'" alt="'+translate['Page up']+'"></a></center>'
|
||||||
index=startIndex
|
index=startIndex
|
||||||
while index>=endIndex:
|
while index>=endIndex:
|
||||||
postId=lines[index].strip('\n')
|
postId=lines[index].strip('\n')
|
||||||
|
@ -286,7 +298,7 @@ def htmlHashtagSearch(translate: {}, \
|
||||||
index-=1
|
index-=1
|
||||||
continue
|
continue
|
||||||
hashtagSearchForm+= \
|
hashtagSearchForm+= \
|
||||||
individualPostAsHtml(translate,None, \
|
individualPostAsHtml(iconsDir,translate,None, \
|
||||||
baseDir,session,wfRequest,personCache, \
|
baseDir,session,wfRequest,personCache, \
|
||||||
nickname,domain,port,postJsonObject, \
|
nickname,domain,port,postJsonObject, \
|
||||||
None,True,False, \
|
None,True,False, \
|
||||||
|
@ -296,7 +308,7 @@ def htmlHashtagSearch(translate: {}, \
|
||||||
|
|
||||||
if endIndex>0:
|
if endIndex>0:
|
||||||
# next page link
|
# next page link
|
||||||
hashtagSearchForm+='<center><a href="/tags/'+hashtag+'?page='+str(pageNumber+1)+'"><img class="pageicon" src="/icons/pagedown.png" title="'+translate['Page down']+'" alt="'+translate['Page down']+'"></a></center>'
|
hashtagSearchForm+='<center><a href="/tags/'+hashtag+'?page='+str(pageNumber+1)+'"><img class="pageicon" src="/'+iconsDir+'/pagedown.png" title="'+translate['Page down']+'" alt="'+translate['Page down']+'"></a></center>'
|
||||||
hashtagSearchForm+=htmlFooter()
|
hashtagSearchForm+=htmlFooter()
|
||||||
return hashtagSearchForm
|
return hashtagSearchForm
|
||||||
|
|
||||||
|
@ -725,6 +737,7 @@ def htmlNewPost(translate: {},baseDir: str, \
|
||||||
reportUrl: str,pageNumber: int) -> str:
|
reportUrl: str,pageNumber: int) -> str:
|
||||||
"""New post screen
|
"""New post screen
|
||||||
"""
|
"""
|
||||||
|
iconsDir=getIconsDir(baseDir)
|
||||||
replyStr=''
|
replyStr=''
|
||||||
if not path.endswith('/newshare'):
|
if not path.endswith('/newshare'):
|
||||||
if not path.endswith('/newreport'):
|
if not path.endswith('/newreport'):
|
||||||
|
@ -805,7 +818,7 @@ def htmlNewPost(translate: {},baseDir: str, \
|
||||||
# only show the share option if this is not a reply
|
# only show the share option if this is not a reply
|
||||||
shareOptionOnDropdown=''
|
shareOptionOnDropdown=''
|
||||||
if not replyStr:
|
if not replyStr:
|
||||||
shareOptionOnDropdown='<a href="'+pathBase+'/newshare"><img src="/icons/scope_share.png"/><b>Share</b><br>'+translate['Describe a shared item']+'</a>'
|
shareOptionOnDropdown='<a href="'+pathBase+'/newshare"><img src="/'+iconsDir+'/scope_share.png"/><b>Share</b><br>'+translate['Describe a shared item']+'</a>'
|
||||||
|
|
||||||
mentionsStr=''
|
mentionsStr=''
|
||||||
for m in mentions:
|
for m in mentions:
|
||||||
|
@ -848,11 +861,11 @@ def htmlNewPost(translate: {},baseDir: str, \
|
||||||
if not reportUrl:
|
if not reportUrl:
|
||||||
dropDownContent= \
|
dropDownContent= \
|
||||||
' <div id="myDropdown" class="dropdown-content">' \
|
' <div id="myDropdown" class="dropdown-content">' \
|
||||||
' <a href="'+pathBase+dropdownNewPostSuffix+'"><img src="/icons/scope_public.png"/><b>'+translate['Public']+'</b><br>'+translate['Visible to anyone']+'</a>' \
|
' <a href="'+pathBase+dropdownNewPostSuffix+'"><img src="/'+iconsDir+'/scope_public.png"/><b>'+translate['Public']+'</b><br>'+translate['Visible to anyone']+'</a>' \
|
||||||
' <a href="'+pathBase+dropdownUnlistedSuffix+'"><img src="/icons/scope_unlisted.png"/><b>'+translate['Unlisted']+'</b><br>'+translate['Not on public timeline']+'</a>' \
|
' <a href="'+pathBase+dropdownUnlistedSuffix+'"><img src="/'+iconsDir+'/scope_unlisted.png"/><b>'+translate['Unlisted']+'</b><br>'+translate['Not on public timeline']+'</a>' \
|
||||||
' <a href="'+pathBase+dropdownFollowersSuffix+'"><img src="/icons/scope_followers.png"/><b>'+translate['Followers']+'</b><br>'+translate['Only to followers']+'</a>' \
|
' <a href="'+pathBase+dropdownFollowersSuffix+'"><img src="/'+iconsDir+'/scope_followers.png"/><b>'+translate['Followers']+'</b><br>'+translate['Only to followers']+'</a>' \
|
||||||
' <a href="'+pathBase+dropdownDMSuffix+'"><img src="/icons/scope_dm.png"/><b>'+translate['DM']+'</b><br>'+translate['Only to mentioned people']+'</a>' \
|
' <a href="'+pathBase+dropdownDMSuffix+'"><img src="/'+iconsDir+'/scope_dm.png"/><b>'+translate['DM']+'</b><br>'+translate['Only to mentioned people']+'</a>' \
|
||||||
' <a href="'+pathBase+dropdownReportSuffix+'"><img src="/icons/scope_report.png"/><b>'+translate['Report']+'</b><br>'+translate['Send to moderators']+'</a>'+ \
|
' <a href="'+pathBase+dropdownReportSuffix+'"><img src="/'+iconsDir+'/scope_report.png"/><b>'+translate['Report']+'</b><br>'+translate['Send to moderators']+'</a>'+ \
|
||||||
shareOptionOnDropdown+ \
|
shareOptionOnDropdown+ \
|
||||||
' </div>'
|
' </div>'
|
||||||
else:
|
else:
|
||||||
|
@ -864,7 +877,7 @@ def htmlNewPost(translate: {},baseDir: str, \
|
||||||
' <label for="nickname"><b>'+newPostText+'</b></label>' \
|
' <label for="nickname"><b>'+newPostText+'</b></label>' \
|
||||||
' <div class="container">' \
|
' <div class="container">' \
|
||||||
' <div class="dropbtn" onclick="dropdown()">' \
|
' <div class="dropbtn" onclick="dropdown()">' \
|
||||||
' <img src="/icons/'+scopeIcon+'"/><b class="scope-desc">'+scopeDescription+'</b>'+ \
|
' <img src="/'+iconsDir+'/'+scopeIcon+'"/><b class="scope-desc">'+scopeDescription+'</b>'+ \
|
||||||
dropDownContent+ \
|
dropDownContent+ \
|
||||||
' </div>' \
|
' </div>' \
|
||||||
' <input type="submit" name="submitPost" value="'+translate['Submit']+'">' \
|
' <input type="submit" name="submitPost" value="'+translate['Submit']+'">' \
|
||||||
|
@ -932,6 +945,7 @@ def htmlProfilePosts(translate: {}, \
|
||||||
"""Shows posts on the profile screen
|
"""Shows posts on the profile screen
|
||||||
These should only be public posts
|
These should only be public posts
|
||||||
"""
|
"""
|
||||||
|
iconsDir=getIconsDir(baseDir)
|
||||||
profileStr=''
|
profileStr=''
|
||||||
maxItems=4
|
maxItems=4
|
||||||
profileStr+='<script>'+contentWarningScript()+'</script>'
|
profileStr+='<script>'+contentWarningScript()+'</script>'
|
||||||
|
@ -951,7 +965,7 @@ def htmlProfilePosts(translate: {}, \
|
||||||
break
|
break
|
||||||
for item in outboxFeed['orderedItems']:
|
for item in outboxFeed['orderedItems']:
|
||||||
if item['type']=='Create':
|
if item['type']=='Create':
|
||||||
postStr=individualPostAsHtml(translate,None, \
|
postStr=individualPostAsHtml(iconsDir,translate,None, \
|
||||||
baseDir,session,wfRequest,personCache, \
|
baseDir,session,wfRequest,personCache, \
|
||||||
nickname,domain,port,item,None,True,False, \
|
nickname,domain,port,item,None,True,False, \
|
||||||
httpPrefix,projectVersion, \
|
httpPrefix,projectVersion, \
|
||||||
|
@ -977,11 +991,12 @@ def htmlProfileFollowing(translate: {},baseDir: str,httpPrefix: str, \
|
||||||
"""
|
"""
|
||||||
profileStr=''
|
profileStr=''
|
||||||
|
|
||||||
|
iconsDir=getIconsDir(baseDir)
|
||||||
if authorized and pageNumber:
|
if authorized and pageNumber:
|
||||||
if authorized and pageNumber>1:
|
if authorized and pageNumber>1:
|
||||||
# page up arrow
|
# page up arrow
|
||||||
profileStr+= \
|
profileStr+= \
|
||||||
'<center><a href="'+actor+'/'+feedName+'?page='+str(pageNumber-1)+'"><img class="pageicon" src="/icons/pageup.png" title="'+translate['Page up']+'" alt="'+translate['Page up']+'"></a></center>'
|
'<center><a href="'+actor+'/'+feedName+'?page='+str(pageNumber-1)+'"><img class="pageicon" src="/'+iconsDir+'/pageup.png" title="'+translate['Page up']+'" alt="'+translate['Page up']+'"></a></center>'
|
||||||
|
|
||||||
for item in followingJson['orderedItems']:
|
for item in followingJson['orderedItems']:
|
||||||
profileStr+= \
|
profileStr+= \
|
||||||
|
@ -994,7 +1009,7 @@ def htmlProfileFollowing(translate: {},baseDir: str,httpPrefix: str, \
|
||||||
if len(followingJson['orderedItems'])>=maxItemsPerPage:
|
if len(followingJson['orderedItems'])>=maxItemsPerPage:
|
||||||
# page down arrow
|
# page down arrow
|
||||||
profileStr+= \
|
profileStr+= \
|
||||||
'<center><a href="'+actor+'/'+feedName+'?page='+str(pageNumber+1)+'"><img class="pageicon" src="/icons/pagedown.png" title="'+translate['Page down']+'" alt="'+translate['Page down']+'"></a></center>'
|
'<center><a href="'+actor+'/'+feedName+'?page='+str(pageNumber+1)+'"><img class="pageicon" src="/'+iconsDir+'/pagedown.png" title="'+translate['Page down']+'" alt="'+translate['Page down']+'"></a></center>'
|
||||||
return profileStr
|
return profileStr
|
||||||
|
|
||||||
def htmlProfileRoles(translate: {},nickname: str,domain: str,rolesJson: {}) -> str:
|
def htmlProfileRoles(translate: {},nickname: str,domain: str,rolesJson: {}) -> str:
|
||||||
|
@ -1457,7 +1472,7 @@ def rejectAnnounce(announceFilename: str):
|
||||||
rejectAnnounceFile.write('\n')
|
rejectAnnounceFile.write('\n')
|
||||||
rejectAnnounceFile.close()
|
rejectAnnounceFile.close()
|
||||||
|
|
||||||
def individualPostAsHtml(translate: {}, \
|
def individualPostAsHtml(iconsDir: str,translate: {}, \
|
||||||
pageNumber: int,baseDir: str, \
|
pageNumber: int,baseDir: str, \
|
||||||
session,wfRequest: {},personCache: {}, \
|
session,wfRequest: {},personCache: {}, \
|
||||||
nickname: str,domain: str,port: int, \
|
nickname: str,domain: str,port: int, \
|
||||||
|
@ -1594,7 +1609,7 @@ def individualPostAsHtml(translate: {}, \
|
||||||
|
|
||||||
# Show a DM icon for DMs in the inbox timeline
|
# Show a DM icon for DMs in the inbox timeline
|
||||||
if showDMicon:
|
if showDMicon:
|
||||||
titleStr=titleStr+' <img src="/icons/dm.png" class="DMicon"/>'
|
titleStr=titleStr+' <img src="/'+iconsDir+'/dm.png" class="DMicon"/>'
|
||||||
|
|
||||||
if showRepeatIcon:
|
if showRepeatIcon:
|
||||||
if isAnnounced:
|
if isAnnounced:
|
||||||
|
@ -1604,13 +1619,13 @@ def individualPostAsHtml(translate: {}, \
|
||||||
announceDomain,announcePort=getDomainFromActor(postJsonObject['object']['attributedTo'])
|
announceDomain,announcePort=getDomainFromActor(postJsonObject['object']['attributedTo'])
|
||||||
announceDisplayName=getDisplayName(postJsonObject['object']['attributedTo'],personCache)
|
announceDisplayName=getDisplayName(postJsonObject['object']['attributedTo'],personCache)
|
||||||
if announceDisplayName:
|
if announceDisplayName:
|
||||||
titleStr+=' <img src="/icons/repeat_inactive.png" class="announceOrReply"/> <a href="'+postJsonObject['object']['id']+'">'+announceDisplayName+'</a>'
|
titleStr+=' <img src="/'+iconsDir+'/repeat_inactive.png" class="announceOrReply"/> <a href="'+postJsonObject['object']['id']+'">'+announceDisplayName+'</a>'
|
||||||
else:
|
else:
|
||||||
titleStr+=' <img src="/icons/repeat_inactive.png" class="announceOrReply"/> <a href="'+postJsonObject['object']['id']+'">@'+announceNickname+'@'+announceDomain+'</a>'
|
titleStr+=' <img src="/'+iconsDir+'/repeat_inactive.png" class="announceOrReply"/> <a href="'+postJsonObject['object']['id']+'">@'+announceNickname+'@'+announceDomain+'</a>'
|
||||||
else:
|
else:
|
||||||
titleStr+=' <img src="/icons/repeat_inactive.png" class="announceOrReply"/> <a href="'+postJsonObject['object']['id']+'">@unattributed</a>'
|
titleStr+=' <img src="/'+iconsDir+'/repeat_inactive.png" class="announceOrReply"/> <a href="'+postJsonObject['object']['id']+'">@unattributed</a>'
|
||||||
else:
|
else:
|
||||||
titleStr+=' <img src="/icons/repeat_inactive.png" class="announceOrReply"/> <a href="'+postJsonObject['object']['id']+'">@unattributed</a>'
|
titleStr+=' <img src="/'+iconsDir+'/repeat_inactive.png" class="announceOrReply"/> <a href="'+postJsonObject['object']['id']+'">@unattributed</a>'
|
||||||
else:
|
else:
|
||||||
if postJsonObject['object'].get('inReplyTo'):
|
if postJsonObject['object'].get('inReplyTo'):
|
||||||
containerClassIcons='containericons darker'
|
containerClassIcons='containericons darker'
|
||||||
|
@ -1623,17 +1638,17 @@ def individualPostAsHtml(translate: {}, \
|
||||||
if replyNickname and replyDomain:
|
if replyNickname and replyDomain:
|
||||||
replyDisplayName=getDisplayName(postJsonObject['object']['inReplyTo'],personCache)
|
replyDisplayName=getDisplayName(postJsonObject['object']['inReplyTo'],personCache)
|
||||||
if replyDisplayName:
|
if replyDisplayName:
|
||||||
titleStr+=' <img src="/icons/reply.png" class="announceOrReply"/> <a href="'+postJsonObject['object']['inReplyTo']+'">'+replyDisplayName+'</a>'
|
titleStr+=' <img src="/'+iconsDir+'/reply.png" class="announceOrReply"/> <a href="'+postJsonObject['object']['inReplyTo']+'">'+replyDisplayName+'</a>'
|
||||||
else:
|
else:
|
||||||
titleStr+=' <img src="/icons/reply.png" class="announceOrReply"/> <a href="'+postJsonObject['object']['inReplyTo']+'">@'+replyNickname+'@'+replyDomain+'</a>'
|
titleStr+=' <img src="/'+iconsDir+'/reply.png" class="announceOrReply"/> <a href="'+postJsonObject['object']['inReplyTo']+'">@'+replyNickname+'@'+replyDomain+'</a>'
|
||||||
else:
|
else:
|
||||||
titleStr+=' <img src="/icons/reply.png" class="announceOrReply"/> <a href="'+postJsonObject['object']['inReplyTo']+'">@unknown</a>'
|
titleStr+=' <img src="/'+iconsDir+'/reply.png" class="announceOrReply"/> <a href="'+postJsonObject['object']['inReplyTo']+'">@unknown</a>'
|
||||||
else:
|
else:
|
||||||
postDomain=postJsonObject['object']['inReplyTo'].replace('https://','').replace('http://','').replace('dat://','')
|
postDomain=postJsonObject['object']['inReplyTo'].replace('https://','').replace('http://','').replace('dat://','')
|
||||||
if '/' in postDomain:
|
if '/' in postDomain:
|
||||||
postDomain=postDomain.split('/',1)[0]
|
postDomain=postDomain.split('/',1)[0]
|
||||||
if postDomain:
|
if postDomain:
|
||||||
titleStr+=' <img src="/icons/reply.png" class="announceOrReply"/> <a href="'+postJsonObject['object']['inReplyTo']+'">'+postDomain+'</a>'
|
titleStr+=' <img src="/'+iconsDir+'/reply.png" class="announceOrReply"/> <a href="'+postJsonObject['object']['inReplyTo']+'">'+postDomain+'</a>'
|
||||||
attachmentStr=''
|
attachmentStr=''
|
||||||
if postJsonObject['object'].get('attachment'):
|
if postJsonObject['object'].get('attachment'):
|
||||||
if isinstance(postJsonObject['object']['attachment'], list):
|
if isinstance(postJsonObject['object']['attachment'], list):
|
||||||
|
@ -1756,7 +1771,7 @@ def individualPostAsHtml(translate: {}, \
|
||||||
announceTitle=translate['Undo the repeat']
|
announceTitle=translate['Undo the repeat']
|
||||||
announceStr= \
|
announceStr= \
|
||||||
'<a href="/users/'+nickname+'?'+announceLink+'='+postJsonObject['object']['id']+pageNumberParam+'" title="'+announceTitle+'">' \
|
'<a href="/users/'+nickname+'?'+announceLink+'='+postJsonObject['object']['id']+pageNumberParam+'" title="'+announceTitle+'">' \
|
||||||
'<img src="/icons/'+announceIcon+'"/></a>'
|
'<img src="/'+iconsDir+'/'+announceIcon+'"/></a>'
|
||||||
|
|
||||||
likeStr=''
|
likeStr=''
|
||||||
if not isModerationPost:
|
if not isModerationPost:
|
||||||
|
@ -1770,7 +1785,7 @@ def individualPostAsHtml(translate: {}, \
|
||||||
likeTitle=translate['Undo the like']
|
likeTitle=translate['Undo the like']
|
||||||
likeStr= \
|
likeStr= \
|
||||||
'<a href="/users/'+nickname+'?'+likeLink+'='+postJsonObject['object']['id']+pageNumberParam+'" title="'+likeTitle+'">' \
|
'<a href="/users/'+nickname+'?'+likeLink+'='+postJsonObject['object']['id']+pageNumberParam+'" title="'+likeTitle+'">' \
|
||||||
'<img src="/icons/'+likeIcon+'"/></a>'
|
'<img src="/'+iconsDir+'/'+likeIcon+'"/></a>'
|
||||||
|
|
||||||
deleteStr=''
|
deleteStr=''
|
||||||
if allowDeletion or \
|
if allowDeletion or \
|
||||||
|
@ -1779,7 +1794,7 @@ def individualPostAsHtml(translate: {}, \
|
||||||
if '/users/'+nickname+'/' in postJsonObject['object']['id']:
|
if '/users/'+nickname+'/' in postJsonObject['object']['id']:
|
||||||
deleteStr= \
|
deleteStr= \
|
||||||
'<a href="/users/'+nickname+'?delete='+postJsonObject['object']['id']+pageNumberParam+'" title="'+translate['Delete this post']+'">' \
|
'<a href="/users/'+nickname+'?delete='+postJsonObject['object']['id']+pageNumberParam+'" title="'+translate['Delete this post']+'">' \
|
||||||
'<img src="/icons/delete.png"/></a>'
|
'<img src="/'+iconsDir+'/delete.png"/></a>'
|
||||||
|
|
||||||
# change the background color for DMs in inbox timeline
|
# change the background color for DMs in inbox timeline
|
||||||
if showDMicon:
|
if showDMicon:
|
||||||
|
@ -1808,7 +1823,7 @@ def individualPostAsHtml(translate: {}, \
|
||||||
footerStr+='<a href="/users/'+nickname+'?replyfollowers='+replyToLink+'" title="'+translate['Reply to this post']+'">'
|
footerStr+='<a href="/users/'+nickname+'?replyfollowers='+replyToLink+'" title="'+translate['Reply to this post']+'">'
|
||||||
else:
|
else:
|
||||||
footerStr+='<a href="/users/'+nickname+'?replydm='+replyToLink+'" title="'+translate['Reply to this post']+'">'
|
footerStr+='<a href="/users/'+nickname+'?replydm='+replyToLink+'" title="'+translate['Reply to this post']+'">'
|
||||||
footerStr+='<img src="/icons/reply.png"/></a>'
|
footerStr+='<img src="/'+iconsDir+'/reply.png"/></a>'
|
||||||
footerStr+=announceStr+likeStr+deleteStr
|
footerStr+=announceStr+likeStr+deleteStr
|
||||||
footerStr+='<span class="'+timeClass+'">'+publishedStr+'</span>'
|
footerStr+='<span class="'+timeClass+'">'+publishedStr+'</span>'
|
||||||
footerStr+='</div>'
|
footerStr+='</div>'
|
||||||
|
@ -1866,6 +1881,7 @@ def htmlTimeline(translate: {},pageNumber: int, \
|
||||||
manuallyApproveFollowers: bool) -> str:
|
manuallyApproveFollowers: bool) -> str:
|
||||||
"""Show the timeline as html
|
"""Show the timeline as html
|
||||||
"""
|
"""
|
||||||
|
iconsDir=getIconsDir(baseDir)
|
||||||
cssFilename=baseDir+'/epicyon-profile.css'
|
cssFilename=baseDir+'/epicyon-profile.css'
|
||||||
if os.path.isfile(baseDir+'/epicyon.css'):
|
if os.path.isfile(baseDir+'/epicyon.css'):
|
||||||
cssFilename=baseDir+'/epicyon.css'
|
cssFilename=baseDir+'/epicyon.css'
|
||||||
|
@ -1901,7 +1917,7 @@ def htmlTimeline(translate: {},pageNumber: int, \
|
||||||
for line in f:
|
for line in f:
|
||||||
if len(line)>0:
|
if len(line)>0:
|
||||||
# show follow approvals icon
|
# show follow approvals icon
|
||||||
followApprovals='<a href="'+actor+'/followers"><img class="right" alt="'+translate['Approve follow requests']+'" title="'+translate['Approve follow requests']+'" src="/icons/person.png"/></a>'
|
followApprovals='<a href="'+actor+'/followers"><img class="right" alt="'+translate['Approve follow requests']+'" title="'+translate['Approve follow requests']+'" src="/'+iconsDir+'/person.png"/></a>'
|
||||||
break
|
break
|
||||||
|
|
||||||
moderationButtonStr=''
|
moderationButtonStr=''
|
||||||
|
@ -1915,11 +1931,11 @@ def htmlTimeline(translate: {},pageNumber: int, \
|
||||||
|
|
||||||
if boxName!='dm':
|
if boxName!='dm':
|
||||||
if not manuallyApproveFollowers:
|
if not manuallyApproveFollowers:
|
||||||
newPostButtonStr='<a href="'+actor+'/newpost"><img src="/icons/newpost.png" title="'+translate['Create a new post']+'" alt="'+translate['Create a new post']+'" class="right"/></a>'
|
newPostButtonStr='<a href="'+actor+'/newpost"><img src="/'+iconsDir+'/newpost.png" title="'+translate['Create a new post']+'" alt="'+translate['Create a new post']+'" class="right"/></a>'
|
||||||
else:
|
else:
|
||||||
newPostButtonStr='<a href="'+actor+'/newfollowers"><img src="/icons/newpost.png" title="'+translate['Create a new post']+'" alt="'+translate['Create a new post']+'" class="right"/></a>'
|
newPostButtonStr='<a href="'+actor+'/newfollowers"><img src="/'+iconsDir+'/newpost.png" title="'+translate['Create a new post']+'" alt="'+translate['Create a new post']+'" class="right"/></a>'
|
||||||
else:
|
else:
|
||||||
newPostButtonStr='<a href="'+actor+'/newdm"><img src="/icons/newpost.png" title="'+translate['Create a new DM']+'" alt="'+translate['Create a new DM']+'" class="right"/></a>'
|
newPostButtonStr='<a href="'+actor+'/newdm"><img src="/'+iconsDir+'/newpost.png" title="'+translate['Create a new DM']+'" alt="'+translate['Create a new DM']+'" class="right"/></a>'
|
||||||
|
|
||||||
# banner and row of buttons
|
# banner and row of buttons
|
||||||
tlStr+= \
|
tlStr+= \
|
||||||
|
@ -1931,8 +1947,8 @@ def htmlTimeline(translate: {},pageNumber: int, \
|
||||||
' <a href="'+actor+'/dm"><button class="'+dmButton+'"><span>'+translate['DM']+'</span></button></a>' \
|
' <a href="'+actor+'/dm"><button class="'+dmButton+'"><span>'+translate['DM']+'</span></button></a>' \
|
||||||
' <a href="'+actor+'/outbox"><button class="'+sentButton+'"><span>'+translate['Outbox']+'</span></button></a>'+ \
|
' <a href="'+actor+'/outbox"><button class="'+sentButton+'"><span>'+translate['Outbox']+'</span></button></a>'+ \
|
||||||
moderationButtonStr+newPostButtonStr+ \
|
moderationButtonStr+newPostButtonStr+ \
|
||||||
' <a href="'+actor+'/search"><img src="/icons/search.png" title="'+translate['Search and follow']+'" alt="'+translate['Search and follow']+'" class="right"/></a>'+ \
|
' <a href="'+actor+'/search"><img src="/'+iconsDir+'/search.png" title="'+translate['Search and follow']+'" alt="'+translate['Search and follow']+'" class="right"/></a>'+ \
|
||||||
' <a href="'+actor+'/'+boxName+'"><img src="/icons/refresh.png" title="'+translate['Refresh']+'" alt="'+translate['Refresh']+'" class="right"/></a>'+ \
|
' <a href="'+actor+'/'+boxName+'"><img src="/'+iconsDir+'/refresh.png" title="'+translate['Refresh']+'" alt="'+translate['Refresh']+'" class="right"/></a>'+ \
|
||||||
followApprovals+ \
|
followApprovals+ \
|
||||||
'</div>'
|
'</div>'
|
||||||
|
|
||||||
|
@ -1955,7 +1971,7 @@ def htmlTimeline(translate: {},pageNumber: int, \
|
||||||
|
|
||||||
# page up arrow
|
# page up arrow
|
||||||
if pageNumber>1:
|
if pageNumber>1:
|
||||||
tlStr+='<center><a href="'+actor+'/'+boxName+'?page='+str(pageNumber-1)+'"><img class="pageicon" src="/icons/pageup.png" title="'+translate['Page up']+'" alt="'+translate['Page up']+'"></a></center>'
|
tlStr+='<center><a href="'+actor+'/'+boxName+'?page='+str(pageNumber-1)+'"><img class="pageicon" src="/'+iconsDir+'/pageup.png" title="'+translate['Page up']+'" alt="'+translate['Page up']+'"></a></center>'
|
||||||
|
|
||||||
# show the posts
|
# show the posts
|
||||||
itemCtr=0
|
itemCtr=0
|
||||||
|
@ -1964,7 +1980,7 @@ def htmlTimeline(translate: {},pageNumber: int, \
|
||||||
itemCtr+=1
|
itemCtr+=1
|
||||||
avatarUrl=getPersonAvatarUrl(baseDir,item['actor'],personCache)
|
avatarUrl=getPersonAvatarUrl(baseDir,item['actor'],personCache)
|
||||||
tlStr+= \
|
tlStr+= \
|
||||||
individualPostAsHtml(translate,pageNumber, \
|
individualPostAsHtml(iconsDir,translate,pageNumber, \
|
||||||
baseDir,session,wfRequest,personCache, \
|
baseDir,session,wfRequest,personCache, \
|
||||||
nickname,domain,port,item,avatarUrl,True, \
|
nickname,domain,port,item,avatarUrl,True, \
|
||||||
allowDeletion, \
|
allowDeletion, \
|
||||||
|
@ -1975,7 +1991,7 @@ def htmlTimeline(translate: {},pageNumber: int, \
|
||||||
|
|
||||||
# page down arrow
|
# page down arrow
|
||||||
if itemCtr>=itemsPerPage:
|
if itemCtr>=itemsPerPage:
|
||||||
tlStr+='<center><a href="'+actor+'/'+boxName+'?page='+str(pageNumber+1)+'"><img class="pageicon" src="/icons/pagedown.png" title="'+translate['Page down']+'" alt="'+translate['Page down']+'"></a></center>'
|
tlStr+='<center><a href="'+actor+'/'+boxName+'?page='+str(pageNumber+1)+'"><img class="pageicon" src="/'+iconsDir+'/pagedown.png" title="'+translate['Page down']+'" alt="'+translate['Page down']+'"></a></center>'
|
||||||
tlStr+=htmlFooter()
|
tlStr+=htmlFooter()
|
||||||
return tlStr
|
return tlStr
|
||||||
|
|
||||||
|
@ -2038,9 +2054,11 @@ def htmlIndividualPost(translate: {}, \
|
||||||
postJsonObject: {},httpPrefix: str,projectVersion: str) -> str:
|
postJsonObject: {},httpPrefix: str,projectVersion: str) -> str:
|
||||||
"""Show an individual post as html
|
"""Show an individual post as html
|
||||||
"""
|
"""
|
||||||
|
iconsDir=getIconsDir(baseDir)
|
||||||
postStr='<script>'+contentWarningScript()+'</script>'
|
postStr='<script>'+contentWarningScript()+'</script>'
|
||||||
postStr+= \
|
postStr+= \
|
||||||
individualPostAsHtml(translate,None,baseDir,session,wfRequest,personCache, \
|
individualPostAsHtml(iconsDir,translate,None, \
|
||||||
|
baseDir,session,wfRequest,personCache, \
|
||||||
nickname,domain,port,postJsonObject,None,True,False, \
|
nickname,domain,port,postJsonObject,None,True,False, \
|
||||||
httpPrefix,projectVersion,False,authorized,False,False)
|
httpPrefix,projectVersion,False,authorized,False,False)
|
||||||
messageId=postJsonObject['id'].replace('/activity','')
|
messageId=postJsonObject['id'].replace('/activity','')
|
||||||
|
@ -2053,7 +2071,7 @@ def htmlIndividualPost(translate: {}, \
|
||||||
with open(postFilename, 'r') as fp:
|
with open(postFilename, 'r') as fp:
|
||||||
postJsonObject=commentjson.load(fp)
|
postJsonObject=commentjson.load(fp)
|
||||||
postStr= \
|
postStr= \
|
||||||
individualPostAsHtml(translate,None, \
|
individualPostAsHtml(iconsDir,translate,None, \
|
||||||
baseDir,session,wfRequest,personCache, \
|
baseDir,session,wfRequest,personCache, \
|
||||||
nickname,domain,port,postJsonObject, \
|
nickname,domain,port,postJsonObject, \
|
||||||
None,True,False, \
|
None,True,False, \
|
||||||
|
@ -2072,7 +2090,7 @@ def htmlIndividualPost(translate: {}, \
|
||||||
# add items to the html output
|
# add items to the html output
|
||||||
for item in repliesJson['orderedItems']:
|
for item in repliesJson['orderedItems']:
|
||||||
postStr+= \
|
postStr+= \
|
||||||
individualPostAsHtml(translate,None, \
|
individualPostAsHtml(iconsDir,translate,None, \
|
||||||
baseDir,session,wfRequest,personCache, \
|
baseDir,session,wfRequest,personCache, \
|
||||||
nickname,domain,port,item,None,True,False, \
|
nickname,domain,port,item,None,True,False, \
|
||||||
httpPrefix,projectVersion, \
|
httpPrefix,projectVersion, \
|
||||||
|
@ -2086,11 +2104,12 @@ def htmlPostReplies(translate: {},baseDir: str, \
|
||||||
httpPrefix: str,projectVersion: str) -> str:
|
httpPrefix: str,projectVersion: str) -> str:
|
||||||
"""Show the replies to an individual post as html
|
"""Show the replies to an individual post as html
|
||||||
"""
|
"""
|
||||||
|
iconsDir=getIconsDir(baseDir)
|
||||||
repliesStr=''
|
repliesStr=''
|
||||||
if repliesJson.get('orderedItems'):
|
if repliesJson.get('orderedItems'):
|
||||||
for item in repliesJson['orderedItems']:
|
for item in repliesJson['orderedItems']:
|
||||||
repliesStr+= \
|
repliesStr+= \
|
||||||
individualPostAsHtml(translate,None, \
|
individualPostAsHtml(iconsDir,translate,None, \
|
||||||
baseDir,session,wfRequest,personCache, \
|
baseDir,session,wfRequest,personCache, \
|
||||||
nickname,domain,port,item,None,True,False, \
|
nickname,domain,port,item,None,True,False, \
|
||||||
httpPrefix,projectVersion, \
|
httpPrefix,projectVersion, \
|
||||||
|
@ -2156,7 +2175,7 @@ def htmlDeletePost(translate,pageNumber: int, \
|
||||||
"""
|
"""
|
||||||
if '/statuses/' not in messageId:
|
if '/statuses/' not in messageId:
|
||||||
return None
|
return None
|
||||||
|
iconsDir=getIconsDir(baseDir)
|
||||||
actor=messageId.split('/statuses/')[0]
|
actor=messageId.split('/statuses/')[0]
|
||||||
nickname=getNicknameFromActor(actor)
|
nickname=getNicknameFromActor(actor)
|
||||||
domain,port=getDomainFromActor(actor)
|
domain,port=getDomainFromActor(actor)
|
||||||
|
@ -2181,7 +2200,7 @@ def htmlDeletePost(translate,pageNumber: int, \
|
||||||
deletePostStr=htmlHeader(cssFilename,profileStyle)
|
deletePostStr=htmlHeader(cssFilename,profileStyle)
|
||||||
deletePostStr+='<script>'+contentWarningScript()+'</script>'
|
deletePostStr+='<script>'+contentWarningScript()+'</script>'
|
||||||
deletePostStr+= \
|
deletePostStr+= \
|
||||||
individualPostAsHtml(translate,pageNumber, \
|
individualPostAsHtml(iconsDir,translate,pageNumber, \
|
||||||
baseDir,session,wfRequest,personCache, \
|
baseDir,session,wfRequest,personCache, \
|
||||||
nickname,domain,port,postJsonObject, \
|
nickname,domain,port,postJsonObject, \
|
||||||
None,True,False, \
|
None,True,False, \
|
||||||
|
@ -2595,6 +2614,7 @@ def htmlProfileAfterSearch(translate: {}, \
|
||||||
|
|
||||||
profileStr+='<script>'+contentWarningScript()+'</script>'
|
profileStr+='<script>'+contentWarningScript()+'</script>'
|
||||||
|
|
||||||
|
iconsDir=getIconsDir(baseDir)
|
||||||
result = []
|
result = []
|
||||||
i = 0
|
i = 0
|
||||||
for item in parseUserFeed(session,outboxUrl,asHeader, \
|
for item in parseUserFeed(session,outboxUrl,asHeader, \
|
||||||
|
@ -2606,7 +2626,7 @@ def htmlProfileAfterSearch(translate: {}, \
|
||||||
if not item.get('object'):
|
if not item.get('object'):
|
||||||
continue
|
continue
|
||||||
profileStr+= \
|
profileStr+= \
|
||||||
individualPostAsHtml(translate,None,baseDir, \
|
individualPostAsHtml(iconsDir,translate,None,baseDir, \
|
||||||
session,wfRequest,personCache, \
|
session,wfRequest,personCache, \
|
||||||
nickname,domain,port, \
|
nickname,domain,port, \
|
||||||
item,avatarUrl,False,False, \
|
item,avatarUrl,False,False, \
|
||||||
|
|
Loading…
Reference in New Issue