Add static files

This commit is contained in:
Anthony Wang 2023-01-18 01:19:53 +00:00
parent c2b532982c
commit 80e5041182
No known key found for this signature in database
GPG key ID: 42A5B952E6DD8D38
5 changed files with 75 additions and 1 deletions

10
.well-known/webfinger Normal file
View file

@ -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"
}
]
}

View file

@ -1,3 +1,35 @@
# fuwuqi
A useless C2S ActivityPub server
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/

10
main.py Normal file
View file

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

22
users/test.jsonld Normal file
View file

@ -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"
}
}

BIN
users/test.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB