mirror of https://gitlab.com/bashrc2/epicyon
More support for zap style ActivityPub
parent
eb2ec00e2c
commit
4a8d8b34a8
2
posts.py
2
posts.py
|
@ -2402,6 +2402,8 @@ def downloadAnnounce(session,baseDir: str,httpPrefix: str,nickname: str,domain:
|
||||||
else:
|
else:
|
||||||
print('Downloading Announce content for '+postJsonObject['object'])
|
print('Downloading Announce content for '+postJsonObject['object'])
|
||||||
asHeader={'Accept': 'application/activity+json; profile="https://www.w3.org/ns/activitystreams"'}
|
asHeader={'Accept': 'application/activity+json; profile="https://www.w3.org/ns/activitystreams"'}
|
||||||
|
if '/channel/' in postJsonObject['actor']:
|
||||||
|
asHeader={'Accept': 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'}
|
||||||
actorNickname=getNicknameFromActor(postJsonObject['actor'])
|
actorNickname=getNicknameFromActor(postJsonObject['actor'])
|
||||||
actorDomain,actorPort=getDomainFromActor(postJsonObject['actor'])
|
actorDomain,actorPort=getDomainFromActor(postJsonObject['actor'])
|
||||||
announcedJson=getJson(session,postJsonObject['object'],asHeader,None,projectVersion,httpPrefix,domain)
|
announcedJson=getJson(session,postJsonObject['object'],asHeader,None,projectVersion,httpPrefix,domain)
|
||||||
|
|
|
@ -82,6 +82,8 @@ def updateAvatarImageCache(session,baseDir: str,httpPrefix: str,actor: str,avata
|
||||||
print('Failed to download avatar image: '+str(avatarUrl))
|
print('Failed to download avatar image: '+str(avatarUrl))
|
||||||
print(e)
|
print(e)
|
||||||
sessionHeaders = {'Accept': 'application/activity+json; profile="https://www.w3.org/ns/activitystreams"'}
|
sessionHeaders = {'Accept': 'application/activity+json; profile="https://www.w3.org/ns/activitystreams"'}
|
||||||
|
if '/channel/' in actor:
|
||||||
|
sessionHeaders = {'Accept': 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'}
|
||||||
personJson = getJson(session,actor,sessionHeaders,None,__version__,httpPrefix,None)
|
personJson = getJson(session,actor,sessionHeaders,None,__version__,httpPrefix,None)
|
||||||
if personJson:
|
if personJson:
|
||||||
if not personJson.get('id'):
|
if not personJson.get('id'):
|
||||||
|
@ -1924,9 +1926,12 @@ def individualPostAsHtml(iconsDir: str,translate: {}, \
|
||||||
attachmentCtr+=1
|
attachmentCtr+=1
|
||||||
attachmentStr+='</div>'
|
attachmentStr+='</div>'
|
||||||
|
|
||||||
#if not avatarUrl:
|
if not avatarUrl:
|
||||||
avatarUrl=getPersonAvatarUrl(baseDir,postJsonObject['actor'],personCache)
|
avatarUrl=getPersonAvatarUrl(baseDir,postJsonObject['actor'],personCache)
|
||||||
avatarUrl=updateAvatarImageCache(session,baseDir,httpPrefix,postJsonObject['actor'],avatarUrl,personCache)
|
avatarUrl=updateAvatarImageCache(session,baseDir,httpPrefix,postJsonObject['actor'],avatarUrl,personCache)
|
||||||
|
else:
|
||||||
|
updateAvatarImageCache(session,baseDir,httpPrefix,postJsonObject['actor'],avatarUrl,personCache)
|
||||||
|
|
||||||
if not avatarUrl:
|
if not avatarUrl:
|
||||||
avatarUrl=postJsonObject['actor']+'/avatar.png'
|
avatarUrl=postJsonObject['actor']+'/avatar.png'
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue