Apply theme to following list

main
Bob Mottram 2020-06-28 22:54:49 +01:00
parent 26029f1b1a
commit 09fcc4be63
2 changed files with 26 additions and 13 deletions

View File

@ -105,6 +105,7 @@ from blog import htmlBlogView
from blog import htmlBlogPage from blog import htmlBlogPage
from blog import htmlBlogPost from blog import htmlBlogPost
from blog import htmlEditBlog from blog import htmlEditBlog
from webinterface import htmlFollowingList
from webinterface import getBlogAddress from webinterface import getBlogAddress
from webinterface import setBlogAddress from webinterface import setBlogAddress
from webinterface import htmlCalendarDeleteConfirm from webinterface import htmlCalendarDeleteConfirm
@ -1647,19 +1648,7 @@ class PubServer(BaseHTTPRequestHandler):
if not os.path.isfile(followingFilename): if not os.path.isfile(followingFilename):
self._404() self._404()
return return
msg = '' msg = htmlFollowingList(self.server.baseDir, followingFilename)
with open(followingFilename, 'r') as followingFile:
msg = followingFile.read()
followingList = msg.split('\n')
followingList.sort()
if followingList:
followingListHtml = '<html><body>'
for followingAddress in followingList:
if followingAddress:
followingListHtml += \
'<h3>' + followingAddress + '</h3>'
followingListHtml += '</body></html>'
msg = followingListHtml
self._login_headers('text/html', len(msg), callingDomain) self._login_headers('text/html', len(msg), callingDomain)
self._write(msg.encode('utf-8')) self._write(msg.encode('utf-8'))
return return

View File

@ -292,6 +292,30 @@ def getPersonAvatarUrl(baseDir: str, personUrl: str, personCache: {}) -> str:
return None return None
def htmlFollowingList(baseDir: str, followingFilename: str) -> str:
"""Returns a list of handles being followed
"""
with open(followingFilename, 'r') as followingFile:
msg = followingFile.read()
followingList = msg.split('\n')
followingList.sort()
if followingList:
cssFilename = baseDir + '/epicyon-profile.css'
if os.path.isfile(baseDir + '/epicyon.css'):
cssFilename = baseDir + '/epicyon.css'
with open(cssFilename, 'r') as cssFile:
profileCSS = cssFile.read()
followingListHtml = htmlHeader(cssFilename, profileCSS)
for followingAddress in followingList:
if followingAddress:
followingListHtml += \
'<h3>' + followingAddress + '</h3>'
followingListHtml += htmlFooter()
msg = followingListHtml
return msg
return ''
def htmlSearchEmoji(translate: {}, baseDir: str, httpPrefix: str, def htmlSearchEmoji(translate: {}, baseDir: str, httpPrefix: str,
searchStr: str) -> str: searchStr: str) -> str:
"""Search results for emoji """Search results for emoji