forked from indymedia/epicyon
Remove unused flag
parent
13f53414b4
commit
438b778dd3
|
@ -355,7 +355,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
messageJson,self.server.debug)
|
messageJson,self.server.debug)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _updateInboxQueue(self,nickname: str,messageJson: {},postFromWebInterface: bool) -> int:
|
def _updateInboxQueue(self,nickname: str,messageJson: {}) -> int:
|
||||||
"""Update the inbox queue
|
"""Update the inbox queue
|
||||||
"""
|
"""
|
||||||
# Check if the queue is full
|
# Check if the queue is full
|
||||||
|
@ -376,7 +376,6 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.headers['host'],
|
self.headers['host'],
|
||||||
self.headers['signature'],
|
self.headers['signature'],
|
||||||
'/'+self.path.split('/')[-1],
|
'/'+self.path.split('/')[-1],
|
||||||
postFromWebInterface,
|
|
||||||
self.server.debug)
|
self.server.debug)
|
||||||
if queueFilename:
|
if queueFilename:
|
||||||
# add json to the queue
|
# add json to the queue
|
||||||
|
@ -2200,7 +2199,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
else:
|
else:
|
||||||
self.postToNickname=pathUsersSection.split('/')[0]
|
self.postToNickname=pathUsersSection.split('/')[0]
|
||||||
if self.postToNickname:
|
if self.postToNickname:
|
||||||
queueStatus=self._updateInboxQueue(self.postToNickname,messageJson,False)
|
queueStatus=self._updateInboxQueue(self.postToNickname,messageJson)
|
||||||
if queueStatus==0:
|
if queueStatus==0:
|
||||||
self.send_response(200)
|
self.send_response(200)
|
||||||
self.end_headers()
|
self.end_headers()
|
||||||
|
@ -2218,7 +2217,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
else:
|
else:
|
||||||
if self.path == '/sharedInbox' or self.path == '/inbox':
|
if self.path == '/sharedInbox' or self.path == '/inbox':
|
||||||
print('DEBUG: POST to shared inbox')
|
print('DEBUG: POST to shared inbox')
|
||||||
queueStatus=_updateInboxQueue('inbox',messageJson,False)
|
queueStatus=_updateInboxQueue('inbox',messageJson)
|
||||||
if queueStatus==0:
|
if queueStatus==0:
|
||||||
self.send_response(200)
|
self.send_response(200)
|
||||||
self.end_headers()
|
self.end_headers()
|
||||||
|
|
54
inbox.py
54
inbox.py
|
@ -158,7 +158,7 @@ def validPublishedDate(published) -> bool:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def savePostToInboxQueue(baseDir: str,httpPrefix: str,nickname: str, domain: str,postJsonObject: {},host: str,headers: str,postPath: str,postFromWebInterface: bool,debug: bool) -> str:
|
def savePostToInboxQueue(baseDir: str,httpPrefix: str,nickname: str, domain: str,postJsonObject: {},host: str,headers: str,postPath: str,debug: bool) -> str:
|
||||||
"""Saves the give json to the inbox queue for the person
|
"""Saves the give json to the inbox queue for the person
|
||||||
keyId specifies the actor sending the post
|
keyId specifies the actor sending the post
|
||||||
"""
|
"""
|
||||||
|
@ -222,8 +222,7 @@ def savePostToInboxQueue(baseDir: str,httpPrefix: str,nickname: str, domain: str
|
||||||
'path': postPath,
|
'path': postPath,
|
||||||
'post': postJsonObject,
|
'post': postJsonObject,
|
||||||
'filename': filename,
|
'filename': filename,
|
||||||
'destination': destination,
|
'destination': destination
|
||||||
'postFromWebInterface': postFromWebInterface
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if debug:
|
if debug:
|
||||||
|
@ -1054,8 +1053,6 @@ def runInboxQueue(baseDir: str,httpPrefix: str,sendThreads: [],postLog: [], \
|
||||||
pubKey=None
|
pubKey=None
|
||||||
keyId=None
|
keyId=None
|
||||||
for tries in range(8):
|
for tries in range(8):
|
||||||
if queueJson['postFromWebInterface']:
|
|
||||||
break
|
|
||||||
keyId=None
|
keyId=None
|
||||||
signatureParams=queueJson['headers'].split(',')
|
signatureParams=queueJson['headers'].split(',')
|
||||||
for signatureItem in signatureParams:
|
for signatureItem in signatureParams:
|
||||||
|
@ -1079,31 +1076,30 @@ def runInboxQueue(baseDir: str,httpPrefix: str,sendThreads: [],postLog: [], \
|
||||||
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 queueJson['postFromWebInterface']:
|
if not pubKey:
|
||||||
if not pubKey:
|
|
||||||
if debug:
|
|
||||||
print('DEBUG: public key could not be obtained from '+keyId)
|
|
||||||
os.remove(queueFilename)
|
|
||||||
queue.pop(0)
|
|
||||||
continue
|
|
||||||
|
|
||||||
# check the signature
|
|
||||||
verifyHeaders={
|
|
||||||
'host': queueJson['host'],
|
|
||||||
'signature': queueJson['headers']
|
|
||||||
}
|
|
||||||
if not verifyPostHeaders(httpPrefix, \
|
|
||||||
pubKey, verifyHeaders, \
|
|
||||||
queueJson['path'], False, \
|
|
||||||
json.dumps(queueJson['post'])):
|
|
||||||
if debug:
|
|
||||||
print('DEBUG: Header signature check failed')
|
|
||||||
os.remove(queueFilename)
|
|
||||||
queue.pop(0)
|
|
||||||
continue
|
|
||||||
|
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: Signature check success')
|
print('DEBUG: public key could not be obtained from '+keyId)
|
||||||
|
os.remove(queueFilename)
|
||||||
|
queue.pop(0)
|
||||||
|
continue
|
||||||
|
|
||||||
|
# check the signature
|
||||||
|
verifyHeaders={
|
||||||
|
'host': queueJson['host'],
|
||||||
|
'signature': queueJson['headers']
|
||||||
|
}
|
||||||
|
if not verifyPostHeaders(httpPrefix, \
|
||||||
|
pubKey, verifyHeaders, \
|
||||||
|
queueJson['path'], False, \
|
||||||
|
json.dumps(queueJson['post'])):
|
||||||
|
if debug:
|
||||||
|
print('DEBUG: Header signature check failed')
|
||||||
|
os.remove(queueFilename)
|
||||||
|
queue.pop(0)
|
||||||
|
continue
|
||||||
|
|
||||||
|
if debug:
|
||||||
|
print('DEBUG: Signature check success')
|
||||||
|
|
||||||
if receiveUndo(session, \
|
if receiveUndo(session, \
|
||||||
baseDir,httpPrefix,port, \
|
baseDir,httpPrefix,port, \
|
||||||
|
|
Loading…
Reference in New Issue