diff --git a/daemon.py b/daemon.py index f6b4129a..b00e1256 100644 --- a/daemon.py +++ b/daemon.py @@ -1547,13 +1547,14 @@ class PubServer(BaseHTTPRequestHandler): likeActor= \ self.server.httpPrefix+'://'+ \ self.server.domainFull+'/users/'+self.postToNickname - self.server.actorLiked=self.path.split('?actor=')[1] - if '?' in self.server.actorLiked: - self.server.actorLiked=self.server.actorLiked.split('?')[0] + actorLiked=self.path.split('?actor=')[1] + if '?' in actorLiked: + actorLiked=actorLiked.split('?')[0] likeJson= { "@context": "https://www.w3.org/ns/activitystreams", 'type': 'Like', 'actor': likeActor, + 'to': [actorLiked], 'object': likeUrl } self._postToOutboxThread(likeJson) @@ -1593,19 +1594,21 @@ class PubServer(BaseHTTPRequestHandler): undoActor= \ self.server.httpPrefix+'://'+ \ self.server.domainFull+'/users/'+self.postToNickname + actorLiked=self.path.split('?actor=')[1] + if '?' in actorLiked: + actorLiked=actorLiked.split('?')[0] undoLikeJson= { "@context": "https://www.w3.org/ns/activitystreams", 'type': 'Undo', 'actor': undoActor, + 'to': [actorLiked], 'object': { 'type': 'Like', 'actor': undoActor, + 'to': [actorLiked], 'object': likeUrl } } - self.server.actorLiked=self.path.split('?actor=')[1] - if '?' in self.server.actorLiked: - self.server.actorLiked=self.server.actorLiked.split('?')[0] self._postToOutboxThread(undoLikeJson) self.server.GETbusy=False self._redirect_headers(actor+'/'+timelineStr+ \ diff --git a/like.py b/like.py index 72ab1d54..32e44769 100644 --- a/like.py +++ b/like.py @@ -549,16 +549,6 @@ def outboxLike(baseDir: str,httpPrefix: str, \ print('DEBUG: c2s like request arrived in outbox') messageId=messageJson['object'].replace('/activity','') - if '/statuses/' not in messageId: - if debug: - print('DEBUG: c2s like object is not a status') - return - if '/users/' not in messageId and \ - '/channel/' not in messageId and \ - '/profile/' not in messageId: - if debug: - print('DEBUG: c2s like object has no nickname') - return if ':' in domain: domain=domain.split(':')[0] postFilename=locatePost(baseDir,nickname,domain,messageId) @@ -607,16 +597,6 @@ def outboxUndoLike(baseDir: str,httpPrefix: str, \ print('DEBUG: c2s undo like request arrived in outbox') messageId=messageJson['object']['object'].replace('/activity','') - if '/statuses/' not in messageId: - if debug: - print('DEBUG: c2s undo like object is not a status') - return - if '/users/' not in messageId and \ - '/channel/' not in messageId and \ - '/profile/' not in messageId: - if debug: - print('DEBUG: c2s undo like object has no nickname') - return if ':' in domain: domain=domain.split(':')[0] postFilename=locatePost(baseDir,nickname,domain,messageId)