forked from indymedia/epicyon
Download posts for announce activities as they arrive
parent
675e8a88d5
commit
d11d8082e9
7
inbox.py
7
inbox.py
|
@ -43,6 +43,7 @@ from filters import isFiltered
|
||||||
from announce import updateAnnounceCollection
|
from announce import updateAnnounceCollection
|
||||||
from httpsig import messageContentDigest
|
from httpsig import messageContentDigest
|
||||||
from blocking import isBlockedDomain
|
from blocking import isBlockedDomain
|
||||||
|
from posts import downloadAnnounce
|
||||||
|
|
||||||
def validInbox(baseDir: str,nickname: str,domain: str) -> bool:
|
def validInbox(baseDir: str,nickname: str,domain: str) -> bool:
|
||||||
"""Checks whether files were correctly saved to the inbox
|
"""Checks whether files were correctly saved to the inbox
|
||||||
|
@ -922,6 +923,10 @@ def receiveAnnounce(session,handle: str,baseDir: str, \
|
||||||
"""
|
"""
|
||||||
if messageJson['type']!='Announce':
|
if messageJson['type']!='Announce':
|
||||||
return False
|
return False
|
||||||
|
if '@' not in handle:
|
||||||
|
if debug:
|
||||||
|
print('DEBUG: bad handle '+handle)
|
||||||
|
return False
|
||||||
if not messageJson.get('actor'):
|
if not messageJson.get('actor'):
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: '+messageJson['type']+' has no actor')
|
print('DEBUG: '+messageJson['type']+' has no actor')
|
||||||
|
@ -969,6 +974,8 @@ def receiveAnnounce(session,handle: str,baseDir: str, \
|
||||||
print(messageJson['object'])
|
print(messageJson['object'])
|
||||||
return True
|
return True
|
||||||
updateAnnounceCollection(postFilename,messageJson['actor'],debug)
|
updateAnnounceCollection(postFilename,messageJson['actor'],debug)
|
||||||
|
nickname=handle.split('@')[0]
|
||||||
|
downloadAnnounce(session,baseDir,httpPrefix,nickname,domain,messageJson,__version__)
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: announced/repeated post found in inbox')
|
print('DEBUG: announced/repeated post found in inbox')
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in New Issue