Additional announce block check

main
Bob Mottram 2020-01-18 10:39:51 +00:00
parent aff29e1f70
commit 2a01d5b566
1 changed files with 4 additions and 1 deletions

View File

@ -2678,12 +2678,15 @@ def downloadAnnounce(session,baseDir: str,httpPrefix: str, \
if postJsonObject: if postJsonObject:
return postJsonObject return postJsonObject
else: else:
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']: if '/channel/' in postJsonObject['actor']:
asHeader={'Accept': 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'} 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'])
if isBlocked(baseDir,nickname,domain,actorNickname,actorDomain):
print('Announce download blocked actor: '+actorNickname+'@'+actorDomain)
return None
print('Downloading Announce content for '+postJsonObject['object'])
announcedJson= \ announcedJson= \
getJson(session,postJsonObject['object'],asHeader, \ getJson(session,postJsonObject['object'],asHeader, \
None,projectVersion,httpPrefix,domain) None,projectVersion,httpPrefix,domain)