From ce708fa7faec2abe5bdf0f528e0c53851563c52a Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 16 Aug 2019 10:35:06 +0100 Subject: [PATCH] Show actor --- daemon.py | 2 +- inbox.py | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/daemon.py b/daemon.py index 2d27c0575..028b34517 100644 --- a/daemon.py +++ b/daemon.py @@ -134,7 +134,7 @@ def readFollowList(filename: str): return followlist class PubServer(BaseHTTPRequestHandler): - protocol_version = 'HTTP/1.1' + protocol_version = 'HTTP/1.0' def _login_headers(self,fileFormat: str,length: int) -> None: self.send_response(200) diff --git a/inbox.py b/inbox.py index e50f8ea58..c92651d2d 100644 --- a/inbox.py +++ b/inbox.py @@ -176,7 +176,9 @@ def savePostToInboxQueue(baseDir: str,httpPrefix: str,nickname: str, domain: str # isn't written to file postNickname=None postDomain=None + actor=None if postJsonObject.get('actor'): + actor=postJsonObject['actor'] postNickname=getNicknameFromActor(postJsonObject['actor']) postDomain,postPort=getDomainFromActor(postJsonObject['actor']) if isBlocked(baseDir,nickname,domain,postNickname,postDomain): @@ -191,12 +193,13 @@ def savePostToInboxQueue(baseDir: str,httpPrefix: str,nickname: str, domain: str if isinstance(postJsonObject['object']['content'], str): if isFiltered(baseDir,nickname,domain,postJsonObject['object']['content']): return None - + originalPostId=None if postJsonObject.get('id'): - postId=postJsonObject['id'].replace('/activity','') - else: - statusNumber,published = getStatusNumber() - postId=httpPrefix+'://'+originalDomain+'/users/'+nickname+'/statuses/'+statusNumber + originalPostId=postJsonObject['id'].replace('/activity','') + + statusNumber,published = getStatusNumber() + postId=httpPrefix+'://'+originalDomain+'/users/'+nickname+'/statuses/'+statusNumber + postJsonObject['id']=postId currTime=datetime.datetime.utcnow() published=currTime.strftime("%Y-%m-%dT%H:%M:%SZ") @@ -216,7 +219,9 @@ def savePostToInboxQueue(baseDir: str,httpPrefix: str,nickname: str, domain: str sharedInboxItem=True newQueueItem = { + 'originalId': originalPostId, 'id': postId, + 'actor': actor, 'nickname': nickname, 'domain': domain, 'postNickname': postNickname, @@ -1093,7 +1098,7 @@ def runInboxQueue(projectVersion: str, \ if accountMaxPostsPerDay>0 or domainMaxPostsPerDay>0: pprint(quotas) - print('Obtaining public key for '+queueJson['id']) + print('Obtaining public key for actor '+queueJson['actor']) # Try a few times to obtain the public key pubKey=None