Remove some checks from the Like object urls so that non-mastodon posts can be liked

main
Bob Mottram 2019-11-15 10:14:12 +00:00
parent fd61e985cf
commit cc704314a9
2 changed files with 9 additions and 26 deletions

View File

@ -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+ \

20
like.py
View File

@ -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)