diff --git a/daemon.py b/daemon.py index 2ef5b341b..577b6d9ad 100644 --- a/daemon.py +++ b/daemon.py @@ -105,6 +105,7 @@ from blog import htmlBlogView from blog import htmlBlogPage from blog import htmlBlogPost from blog import htmlEditBlog +from webinterface import htmlFollowingList from webinterface import getBlogAddress from webinterface import setBlogAddress from webinterface import htmlCalendarDeleteConfirm @@ -1647,19 +1648,7 @@ class PubServer(BaseHTTPRequestHandler): if not os.path.isfile(followingFilename): self._404() return - msg = '' - with open(followingFilename, 'r') as followingFile: - msg = followingFile.read() - followingList = msg.split('\n') - followingList.sort() - if followingList: - followingListHtml = '' - for followingAddress in followingList: - if followingAddress: - followingListHtml += \ - '

' + followingAddress + '

' - followingListHtml += '' - msg = followingListHtml + msg = htmlFollowingList(self.server.baseDir, followingFilename) self._login_headers('text/html', len(msg), callingDomain) self._write(msg.encode('utf-8')) return diff --git a/webinterface.py b/webinterface.py index 34ad41829..696df510e 100644 --- a/webinterface.py +++ b/webinterface.py @@ -292,6 +292,30 @@ def getPersonAvatarUrl(baseDir: str, personUrl: str, personCache: {}) -> str: 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 += \ + '

' + followingAddress + '

' + followingListHtml += htmlFooter() + msg = followingListHtml + return msg + return '' + + def htmlSearchEmoji(translate: {}, baseDir: str, httpPrefix: str, searchStr: str) -> str: """Search results for emoji