From 09fcc4be632208ba3f7e9d6779fa2e9778604309 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 28 Jun 2020 22:54:49 +0100 Subject: [PATCH] Apply theme to following list --- daemon.py | 15 ++------------- webinterface.py | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/daemon.py b/daemon.py index 2ef5b341..577b6d9a 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 34ad4182..696df510 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