diff --git a/.well-known/webfinger b/.well-known/webfinger new file mode 100644 index 0000000..64e34b2 --- /dev/null +++ b/.well-known/webfinger @@ -0,0 +1,10 @@ +{ + "subject": "acct:test@0.exozy.me", + "links": [ + { + "rel": "self", + "type": "application/activity+json", + "href": "https://0.exozy.me/users/test.jsonld" + } + ] +} diff --git a/README.md b/README.md index 69626c3..06c228d 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,35 @@ # fuwuqi -A useless C2S ActivityPub server \ No newline at end of file +Fuwuqi (fúwùqì or 服务器 means "server" in Chinese) is a useless C2S ActivityPub server for "extremely hardcore" ActivityPub enthusiasts. Craft your own exquisite WebFinger response! Customize your actor object exactly like you want! Hack and extend the 100-line Python server code! + +If that sounds like a world of pain, close this webpage now... OK, got that out of the way. Time for some fun! + +## Configuration + +First, clone this repo on your server. + +Now, generate an RSA keypair on your client device: +```bash +openssl genrsa -out private.pem 2048 +openssl rsa -in private.pem -outform PEM -pubout -out public.pem +``` + +Rename `users/test.jsonld` to your username and pop it open in your favorite text editor. You should change `0.exozy.me` to match your server's domain name, `test` to your username, and the `publicKeyPem` field to the public key you just generated. + +Onward! Now open `.well-known/webfinger` in your editor, and modify it similarly. + +That wasn't so bad, was it? (sobbing sounds) + +## Usage + +Alright, time for the real deal. Start up `python main.py` on your server. If you want to customize the port or whatever, just change the source code. + +Now on your client device, open up your favorite C2S ActivityPub client... oh wait... there aren't any! Welp, you'll just have to settle for reading the [AP spec](https://www.w3.org/TR/activitypub/) and `curl`ing some homemade JSON. That's rough, buddy. + +Like and subscribe and enjoy your new "extremely hardcore" ActivityPub server!!! 🎉😎🚀🙃🥳 + +## Resources + +- https://www.w3.org/TR/activitypub/ +- https://blog.joinmastodon.org/2018/06/how-to-implement-a-basic-activitypub-server/ +- https://blog.joinmastodon.org/2018/07/how-to-make-friends-and-verify-requests/ diff --git a/main.py b/main.py new file mode 100644 index 0000000..5ef7f9b --- /dev/null +++ b/main.py @@ -0,0 +1,10 @@ +from http.server import SimpleHTTPRequestHandler, HTTPServer + +class fuwuqi(SimpleHTTPRequestHandler): + def do_POST(self): + self.send_response(200) + self.send_header('Content-type', 'text/html') + self.end_headers() + self.wfile.write('hi!'.encode('utf-8')) + +HTTPServer(('localhost', 4200), fuwuqi).serve_forever() diff --git a/users/test.jsonld b/users/test.jsonld new file mode 100644 index 0000000..3ad47cb --- /dev/null +++ b/users/test.jsonld @@ -0,0 +1,22 @@ +{ + "@context": [ + "https://www.w3.org/ns/activitystreams", + "https://w3id.org/security/v1" + ], + "id": "https://0.exozy.me/users/test.jsonld", + "type": "Person", + "preferredUsername": "test", + "name": "Billiam Wender", + "inbox": "https://0.exozy.me/users/test.inbox", + "outbox": "https://0.exozy.me/users/test.outbox", + "icon": { + "type": "Image", + "mediaType": "image/png", + "url": "https://0.exozy.me/users/test.png" + }, + "publicKey": { + "id": "https://0.exozy.me/users/test.jsonld#main-key", + "owner": "https://0.exozy.me/users/test.jsonld", + "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnPn6SRQ1JTwqFMFJq7Bg\nxMW/4V/HYSjHPbtKL/3jwXOTmOLUz4wr4Ib1IwiKpsguz0uyX1Ljbe3qQzqaCZu5\nhdoGo+uJsanz6yAoLYwETfIFIjqQr3FoIGQxYJDELkhSO8htbOKKoRiVKsjD5x4Q\ncEkZkLAaef8WVh08sEqE3fC4uLmOlSavycbMLmah9UdhljFcaVSQ7qox9HFvKF2e\ni4BmN2WdMGZ8JN20nc0OxoZpBpMArRqF0krjIkhA5/9CvIZEULPQChYL6AcmLS0j\n/yTxE82eFMBBvyeg8ICMRzcbCoN+hVnv3cb/7+BwNdoQjZqt0RG/hhbpc8RKt+YO\n9QIDAQAB\n-----END PUBLIC KEY-----\n" + } +} diff --git a/users/test.png b/users/test.png new file mode 100644 index 0000000..44eee1c Binary files /dev/null and b/users/test.png differ