Extract liked actor

master
Bob Mottram 2019-08-07 12:05:13 +01:00
parent 0eba942667
commit 5781afad2c
1 changed files with 7 additions and 6 deletions

View File

@ -758,7 +758,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.session= \ self.server.session= \
createSession(self.server.domain,self.server.port,self.server.useTor) createSession(self.server.domain,self.server.port,self.server.useTor)
likeActor=self.server.httpPrefix+'://'+self.server.domainFull+'/users/'+self.postToNickname likeActor=self.server.httpPrefix+'://'+self.server.domainFull+'/users/'+self.postToNickname
actorLiked=self.path.split('/statuses/')[0] actorLiked=likeUrl.split('/statuses/')[0]
likeJson= { likeJson= {
'type': 'Like', 'type': 'Like',
'actor': likeActor, 'actor': likeActor,
@ -772,7 +772,7 @@ class PubServer(BaseHTTPRequestHandler):
return return
# undo a like from the web interface icon # undo a like from the web interface icon
if authorized and '?unlike=' in self.path: if authorized and '?unlike=' in self.path and '/statuses/' in self.path:
likeUrl=self.path.split('?unlike=')[1] likeUrl=self.path.split('?unlike=')[1]
actor=self.path.split('?unlike=')[0] actor=self.path.split('?unlike=')[0]
self.postToNickname=getNicknameFromActor(actor) self.postToNickname=getNicknameFromActor(actor)
@ -780,6 +780,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.session= \ self.server.session= \
createSession(self.server.domain,self.server.port,self.server.useTor) createSession(self.server.domain,self.server.port,self.server.useTor)
undoActor=self.server.httpPrefix+'://'+self.server.domainFull+'/users/'+self.postToNickname undoActor=self.server.httpPrefix+'://'+self.server.domainFull+'/users/'+self.postToNickname
actorLiked=likeUrl.split('/statuses/')[0]
undoLikeJson= { undoLikeJson= {
'type': 'Undo', 'type': 'Undo',
'actor': undoActor, 'actor': undoActor,
@ -787,11 +788,11 @@ class PubServer(BaseHTTPRequestHandler):
'type': 'Like', 'type': 'Like',
'actor': undoActor, 'actor': undoActor,
'object': likeUrl, 'object': likeUrl,
'to': [undoActor+'/followers'], 'cc': [undoActor+'/followers'],
'cc': [] 'to': [actorLiked]
}, },
'to': [undoActor+'/followers'], 'cc': [undoActor+'/followers'],
'cc': [] 'to': [actorLiked]
} }
self._postToOutbox(undoLikeJson) self._postToOutbox(undoLikeJson)
self.server.GETbusy=False self.server.GETbusy=False