From 76d293317c97a81cbfe056b835e04b05c0d54852 Mon Sep 17 00:00:00 2001 From: Anthony Wang Date: Thu, 19 Jan 2023 01:55:44 +0000 Subject: Implement S2S processing for unfollows --- README.md | 2 +- server.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1d90006..cadf76e 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Enjoy your new "extremely hardcore" ActivityPub server!!! 🎉😎🚀🙃🥳 Since Fuwuqi's code is super duper easy to read and extend, the following features are left as an exercise to the reader: - Multi-user support (hint: dynamically generate `.well-known/webfinger` instead of serving a static file) -- S2S server-side processing for likes and announces +- S2S processing for likes and announces - Deleting posts - JSON-LD (hint: don't do it, your brain will thank you) - Lots of pain diff --git a/server.py b/server.py index a0f2395..3fe33ab 100644 --- a/server.py +++ b/server.py @@ -98,6 +98,10 @@ class fuwuqi(SimpleHTTPRequestHandler): if activity['type'] == 'Accept' and activity['actor'] == activity['object']['object']: # Follow request accepted collection_append(username, 'following', activity['actor']) + elif activity['type'] == 'Undo' and activity['object']['type'] == 'Follow' and \ + activity['actor'] == activity['object']['actor']: + # Unfollow request + collection_remove(username, 'followers', activity['actor']) elif self.path.endswith('outbox'): # C2S collection_append(username, 'outbox', activity) -- cgit v1.2.3-70-g09d2