mirror of https://gitlab.com/bashrc2/epicyon
testing
parent
d2394b3a69
commit
ffde81d909
|
@ -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)
|
||||
|
|
27
inbox.py
27
inbox.py
|
@ -198,15 +198,21 @@ def savePostToInboxQueue(baseDir: str,httpPrefix: str,nickname: str, domain: str
|
|||
if postJsonObject.get('id'):
|
||||
originalPostId=postJsonObject['id'].replace('/activity','')
|
||||
|
||||
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")
|
||||
|
||||
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
|
||||
|
||||
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, \
|
||||
|
|
7
like.py
7
like.py
|
@ -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,7 +197,8 @@ def likePost(session,baseDir: str,federationList: [], \
|
|||
"""
|
||||
likeDomain=likeDomain
|
||||
if likePort!=80 and likePort!=443:
|
||||
likeDomain=likeDomain+':'+str(likePort)
|
||||
if ':' not in likeDomain:
|
||||
likeDomain=likeDomain+':'+str(likePort)
|
||||
|
||||
objectUrl = \
|
||||
httpPrefix + '://'+likeDomain+'/users/'+likeNickname+ \
|
||||
|
|
Loading…
Reference in New Issue