master
Bob Mottram 2019-08-16 16:04:40 +01:00
parent d2394b3a69
commit ffde81d909
3 changed files with 26 additions and 10 deletions

View File

@ -134,7 +134,7 @@ def readFollowList(filename: str):
return followlist
class PubServer(BaseHTTPRequestHandler):
protocol_version = 'HTTP/1.0'
protocol_version = 'HTTP/1.1'
def _login_headers(self,fileFormat: str,length: int) -> None:
self.send_response(200)

View File

@ -198,15 +198,21 @@ def savePostToInboxQueue(baseDir: str,httpPrefix: str,nickname: str, domain: str
if postJsonObject.get('id'):
originalPostId=postJsonObject['id'].replace('/activity','')
currTime=datetime.datetime.utcnow()
postId=None
if postJsonObject.get('id'):
#if '/statuses/' not in postJsonObject['id']:
postId=postJsonObject['id'].replace('/activity','')
published=currTime.strftime("%Y-%m-%dT%H:%M:%SZ")
if not postId:
statusNumber,published = getStatusNumber()
if actor:
postId=actor+'/statuses/'+statusNumber
else:
postId=httpPrefix+'://'+originalDomain+'/users/'+nickname+'/statuses/'+statusNumber
# NOTE: don't change postJsonObject['id'] before signature check
currTime=datetime.datetime.utcnow()
published=currTime.strftime("%Y-%m-%dT%H:%M:%SZ")
# NOTE: don't change postJsonObject['id'] before signature check
inboxQueueDir=createInboxQueueDir(nickname,domain,baseDir)
@ -1160,6 +1166,11 @@ def runInboxQueue(projectVersion: str, \
if debug:
print('DEBUG: Signature check success')
# set the id to the same as the post filename
# This makes the filename and the id consistent
#if queueJson['post'].get('id'):
# queueJson['post']['id']=queueJson['id']
if receiveUndo(session, \
baseDir,httpPrefix,port, \
sendThreads,postLog, \

View File

@ -167,6 +167,10 @@ def like(session,baseDir: str,federationList: [],nickname: str,domain: str,port:
if likedPostNickname:
postFilename=locatePost(baseDir,nickname,domain,objectUrl)
if not postFilename:
print('DEBUG: like baseDir: '+baseDir)
print('DEBUG: like nickname: '+nickname)
print('DEBUG: like domain: '+domain)
print('DEBUG: like objectUrl: '+objectUrl)
return None
updateLikesCollection(postFilename,objectUrl,newLikeJson['actor'],debug)
@ -193,6 +197,7 @@ def likePost(session,baseDir: str,federationList: [], \
"""
likeDomain=likeDomain
if likePort!=80 and likePort!=443:
if ':' not in likeDomain:
likeDomain=likeDomain+':'+str(likePort)
objectUrl = \