master
Bob Mottram 2019-08-05 11:14:23 +01:00
parent 438b778dd3
commit f49a85e4fb
1 changed files with 18 additions and 13 deletions

View File

@ -1062,7 +1062,8 @@ def runInboxQueue(baseDir: str,httpPrefix: str,sendThreads: [],postLog: [], \
break break
if not keyId: if not keyId:
if debug: if debug:
print('DEBUG: No keyId in signature: '+queueJson['headers']['signature']) print('DEBUG: No keyId in signature: '+ \
queueJson['headers']['signature'])
os.remove(queueFilename) os.remove(queueFilename)
queue.pop(0) queue.pop(0)
continue continue
@ -1073,7 +1074,8 @@ def runInboxQueue(baseDir: str,httpPrefix: str,sendThreads: [],postLog: [], \
break break
if debug: if debug:
print('DEBUG: Retry '+str(tries+1)+' obtaining public key for '+keyId) print('DEBUG: Retry '+str(tries+1)+ \
' obtaining public key for '+keyId)
time.sleep(5) time.sleep(5)
if not pubKey: if not pubKey:
@ -1089,8 +1091,8 @@ def runInboxQueue(baseDir: str,httpPrefix: str,sendThreads: [],postLog: [], \
'signature': queueJson['headers'] 'signature': queueJson['headers']
} }
if not verifyPostHeaders(httpPrefix, \ if not verifyPostHeaders(httpPrefix, \
pubKey, verifyHeaders, \ pubKey,verifyHeaders, \
queueJson['path'], False, \ queueJson['path'],False, \
json.dumps(queueJson['post'])): json.dumps(queueJson['post'])):
if debug: if debug:
print('DEBUG: Header signature check failed') print('DEBUG: Header signature check failed')
@ -1105,7 +1107,7 @@ def runInboxQueue(baseDir: str,httpPrefix: str,sendThreads: [],postLog: [], \
baseDir,httpPrefix,port, \ baseDir,httpPrefix,port, \
sendThreads,postLog, \ sendThreads,postLog, \
cachedWebfingers, cachedWebfingers,
personCache, personCache, \
queueJson['post'], \ queueJson['post'], \
federationList, \ federationList, \
debug, \ debug, \
@ -1120,7 +1122,7 @@ def runInboxQueue(baseDir: str,httpPrefix: str,sendThreads: [],postLog: [], \
baseDir,httpPrefix,port, \ baseDir,httpPrefix,port, \
sendThreads,postLog, \ sendThreads,postLog, \
cachedWebfingers, cachedWebfingers,
personCache, personCache, \
queueJson['post'], \ queueJson['post'], \
federationList, \ federationList, \
debug, \ debug, \
@ -1134,8 +1136,8 @@ def runInboxQueue(baseDir: str,httpPrefix: str,sendThreads: [],postLog: [], \
if receiveAcceptReject(session, \ if receiveAcceptReject(session, \
baseDir,httpPrefix,domain,port, \ baseDir,httpPrefix,domain,port, \
sendThreads,postLog, \ sendThreads,postLog, \
cachedWebfingers, cachedWebfingers, \
personCache, personCache, \
queueJson['post'], \ queueJson['post'], \
federationList, \ federationList, \
debug): debug):
@ -1149,8 +1151,8 @@ def runInboxQueue(baseDir: str,httpPrefix: str,sendThreads: [],postLog: [], \
baseDir,httpPrefix, \ baseDir,httpPrefix, \
domain,port, \ domain,port, \
sendThreads,postLog, \ sendThreads,postLog, \
cachedWebfingers, cachedWebfingers, \
personCache, personCache, \
queueJson['post'], \ queueJson['post'], \
federationList, \ federationList, \
debug): debug):
@ -1162,7 +1164,8 @@ def runInboxQueue(baseDir: str,httpPrefix: str,sendThreads: [],postLog: [], \
# get recipients list # get recipients list
recipientsDict,recipientsDictFollowers= \ recipientsDict,recipientsDictFollowers= \
inboxPostRecipients(baseDir,queueJson['post'],httpPrefix,domain,port,debug) inboxPostRecipients(baseDir,queueJson['post'], \
httpPrefix,domain,port,debug)
if len(recipientsDict.items())==0 and \ if len(recipientsDict.items())==0 and \
len(recipientsDictFollowers.items())==0: len(recipientsDictFollowers.items())==0:
if debug: if debug:
@ -1178,7 +1181,8 @@ def runInboxQueue(baseDir: str,httpPrefix: str,sendThreads: [],postLog: [], \
if noOfFollowItems>0: if noOfFollowItems>0:
if noOfFollowItems<5: if noOfFollowItems<5:
if debug: if debug:
print('DEBUG: moving '+str(noOfFollowItems)+' inbox posts addressed to followers') print('DEBUG: moving '+str(noOfFollowItems)+ \
' inbox posts addressed to followers')
for handle,postItem in recipientsDictFollowers.items(): for handle,postItem in recipientsDictFollowers.items():
recipientsDict[handle]=postItem recipientsDict[handle]=postItem
recipientsDictFollowers={} recipientsDictFollowers={}
@ -1209,7 +1213,8 @@ def runInboxQueue(baseDir: str,httpPrefix: str,sendThreads: [],postLog: [], \
# See posts.py/createBoxBase # See posts.py/createBoxBase
if len(recipientsDictFollowers)>0: if len(recipientsDictFollowers)>0:
with open(queueJson['destination'].replace(inboxHandle,inboxHandle), 'w') as fp: with open(queueJson['destination'].replace(inboxHandle,inboxHandle), 'w') as fp:
commentjson.dump(queueJson['post'], fp, indent=4, sort_keys=False) commentjson.dump(queueJson['post'],fp,indent=4, \
sort_keys=False)
# for posts addressed to specific accounts # for posts addressed to specific accounts
for handle,capsId in recipientsDict.items(): for handle,capsId in recipientsDict.items():