Server bug fixes

This commit is contained in:
Anthony Wang 2023-01-18 19:52:31 +00:00
parent 9f26679907
commit baedc9903c
Signed by: a
GPG key ID: 42A5B952E6DD8D38

View file

@ -89,10 +89,10 @@ class fuwuqi(SimpleHTTPRequestHandler):
# Make sure activity doer matches HTTP signature
actor = keyid.removesuffix('#main-key')
if ('actor' in activity and activity['actor'] != actor) or
('attributedTo' in activity and activity['attributedTo'] != actor) or
('actor' in activity['object'] and activity['object']['actor'] != actor) or
('attributedTo' in activity['object'] and activity['object']['attributedTo'] != actor)
if ('actor' in activity and activity['actor'] != actor) or \
('attributedTo' in activity and activity['attributedTo'] != actor) or \
('actor' in activity['object'] and activity['object']['actor'] != actor) or \
('attributedTo' in activity['object'] and activity['object']['attributedTo'] != actor):
self.send_response(401)
return
@ -104,7 +104,7 @@ class fuwuqi(SimpleHTTPRequestHandler):
collection_append(f'users/{username}.outbox', activity)
# Clients responsible for addressing activity
for to in activity['to']:
if 'followers' in to or to 'https://www.w3.org/ns/activitystreams#Public':
if 'followers' in to or to == 'https://www.w3.org/ns/activitystreams#Public':
with open(f'users/{username}.followers') as f:
for follower in load(f)['orderedItems']:
send(follower, self.headers, body)