mirror of https://gitlab.com/bashrc2/epicyon
Display announcements
parent
b40c84656e
commit
fd8b2e67ac
|
@ -199,7 +199,7 @@ def htmlProfilePosts(baseDir: str,httpPrefix: str, \
|
||||||
authorized, \
|
authorized, \
|
||||||
ocapAlways)
|
ocapAlways)
|
||||||
for item in outboxFeed['orderedItems']:
|
for item in outboxFeed['orderedItems']:
|
||||||
if item['type']=='Create':
|
if item['type']=='Create' or item['type']=='Announce':
|
||||||
profileStr+= \
|
profileStr+= \
|
||||||
individualPostAsHtml(baseDir,session,wfRequest,personCache, \
|
individualPostAsHtml(baseDir,session,wfRequest,personCache, \
|
||||||
nickname,domain,port,item,None,True,False)
|
nickname,domain,port,item,None,True,False)
|
||||||
|
@ -419,13 +419,37 @@ def individualPostAsHtml(baseDir: str, \
|
||||||
postJsonObject: {}, \
|
postJsonObject: {}, \
|
||||||
avatarUrl: str, showAvatarDropdown: bool,
|
avatarUrl: str, showAvatarDropdown: bool,
|
||||||
showIcons=False) -> str:
|
showIcons=False) -> str:
|
||||||
|
""" Shows a single post as html
|
||||||
|
"""
|
||||||
|
titleStr=''
|
||||||
|
if postJsonObject['type']=='Announce':
|
||||||
|
if postJsonObject.get('object'):
|
||||||
|
if isinstance(postJsonObject['object'], str):
|
||||||
|
# get the announced post
|
||||||
|
asHeader = {'Accept': 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'}
|
||||||
|
announcedJson = getJson(session,postJsonObject['object'],asHeader,None)
|
||||||
|
if announcedJson:
|
||||||
|
if not postJsonObject.get('type'):
|
||||||
|
return ''
|
||||||
|
if postJsonObject['type']!='Create':
|
||||||
|
return ''
|
||||||
|
actorNickname=getNicknameFromActor(postJsonObject['actor'])
|
||||||
|
actorDomain,actorPort=getDomainFromActor(postJsonObject['actor'])
|
||||||
|
titleStr+='@'+actorNickname+'@'+actorDomain+' announced:\n'
|
||||||
|
postJsonObject=announcedJson
|
||||||
|
else:
|
||||||
|
return ''
|
||||||
|
else:
|
||||||
|
return ''
|
||||||
|
if not isinstance(postJsonObject['object'], dict):
|
||||||
|
return ''
|
||||||
avatarPosition=''
|
avatarPosition=''
|
||||||
containerClass='container'
|
containerClass='container'
|
||||||
containerClassIcons='containericons'
|
containerClassIcons='containericons'
|
||||||
timeClass='time-right'
|
timeClass='time-right'
|
||||||
actorNickname=getNicknameFromActor(postJsonObject['actor'])
|
actorNickname=getNicknameFromActor(postJsonObject['actor'])
|
||||||
actorDomain,actorPort=getDomainFromActor(postJsonObject['actor'])
|
actorDomain,actorPort=getDomainFromActor(postJsonObject['actor'])
|
||||||
titleStr='@'+actorNickname+'@'+actorDomain
|
titleStr+='@'+actorNickname+'@'+actorDomain
|
||||||
if postJsonObject['object']['inReplyTo']:
|
if postJsonObject['object']['inReplyTo']:
|
||||||
containerClassIcons='containericons darker'
|
containerClassIcons='containericons darker'
|
||||||
containerClass='container darker'
|
containerClass='container darker'
|
||||||
|
@ -564,7 +588,7 @@ def htmlTimeline(session,baseDir: str,wfRequest: {},personCache: {}, \
|
||||||
followApprovals+ \
|
followApprovals+ \
|
||||||
'</div>'
|
'</div>'
|
||||||
for item in timelineJson['orderedItems']:
|
for item in timelineJson['orderedItems']:
|
||||||
if item['type']=='Create':
|
if item['type']=='Create' or item['type']=='Announce':
|
||||||
tlStr+=individualPostAsHtml(baseDir,session,wfRequest,personCache, \
|
tlStr+=individualPostAsHtml(baseDir,session,wfRequest,personCache, \
|
||||||
nickname,domain,port,item,None,True,showIndividualPostIcons)
|
nickname,domain,port,item,None,True,showIndividualPostIcons)
|
||||||
tlStr+=htmlFooter()
|
tlStr+=htmlFooter()
|
||||||
|
@ -773,7 +797,6 @@ def htmlProfileAfterSearch(baseDir: str,path: str,httpPrefix: str, \
|
||||||
if not backUrl.endswith('/inbox'):
|
if not backUrl.endswith('/inbox'):
|
||||||
backUrl+='/inbox'
|
backUrl+='/inbox'
|
||||||
|
|
||||||
print('************************ <form method="POST" action="'+backUrl+'/followconfirm">')
|
|
||||||
profileStr= \
|
profileStr= \
|
||||||
' <div class="hero-image">' \
|
' <div class="hero-image">' \
|
||||||
' <div class="hero-text">' \
|
' <div class="hero-text">' \
|
||||||
|
@ -798,7 +821,7 @@ def htmlProfileAfterSearch(baseDir: str,path: str,httpPrefix: str, \
|
||||||
for item in parseUserFeed(session,outboxUrl,asHeader):
|
for item in parseUserFeed(session,outboxUrl,asHeader):
|
||||||
if not item.get('type'):
|
if not item.get('type'):
|
||||||
continue
|
continue
|
||||||
if item['type']!='Create':
|
if item['type']!='Create' and item['type']!='Announce':
|
||||||
continue
|
continue
|
||||||
if not item.get('object'):
|
if not item.get('object'):
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue