epicyon/webapp.py

57 lines
1.9 KiB
Python
Raw Normal View History

2020-11-09 15:22:59 +00:00
__filename__ = "webapp.py"
2020-04-05 09:17:19 +00:00
__author__ = "Bob Mottram"
__license__ = "AGPL3+"
__version__ = "1.1.0"
__maintainer__ = "Bob Mottram"
__email__ = "bob@freedombone.net"
__status__ = "Production"
2019-07-24 22:38:42 +00:00
import os
2020-11-12 17:05:38 +00:00
from webapp_utils import htmlHeaderWithExternalStyle
2020-11-09 19:41:01 +00:00
from webapp_utils import htmlFooter
2019-08-18 13:30:40 +00:00
2020-04-05 09:17:19 +00:00
2020-10-29 12:48:58 +00:00
def htmlFollowingList(cssCache: {}, baseDir: str,
followingFilename: str) -> str:
2020-06-28 21:54:49 +00:00
"""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'
2020-10-29 12:48:58 +00:00
2020-11-12 17:05:38 +00:00
followingListHtml = htmlHeaderWithExternalStyle(cssFilename)
for followingAddress in followingList:
if followingAddress:
followingListHtml += \
'<h3>@' + followingAddress + '</h3>'
followingListHtml += htmlFooter()
msg = followingListHtml
2020-06-28 21:54:49 +00:00
return msg
return ''
2020-10-29 12:48:58 +00:00
def htmlHashtagBlocked(cssCache: {}, baseDir: str, translate: {}) -> str:
2019-08-14 10:32:15 +00:00
"""Show the screen for a blocked hashtag
"""
2020-04-05 09:17:19 +00:00
blockedHashtagForm = ''
cssFilename = baseDir + '/epicyon-suspended.css'
if os.path.isfile(baseDir + '/suspended.css'):
cssFilename = baseDir + '/suspended.css'
2020-10-29 12:48:58 +00:00
2020-11-12 17:05:38 +00:00
blockedHashtagForm = htmlHeaderWithExternalStyle(cssFilename)
blockedHashtagForm += '<div><center>\n'
blockedHashtagForm += \
' <p class="screentitle">' + \
translate['Hashtag Blocked'] + '</p>\n'
blockedHashtagForm += \
' <p>See <a href="/terms">' + \
translate['Terms of Service'] + '</a></p>\n'
blockedHashtagForm += '</center></div>\n'
blockedHashtagForm += htmlFooter()
2019-08-14 10:32:15 +00:00
return blockedHashtagForm