From 367c3e929223c6e89a24f0c07bf2884fdac02299 Mon Sep 17 00:00:00 2001 From: s3lph Date: Fri, 18 Nov 2022 00:59:53 +0100 Subject: [PATCH] Add readme --- LICENSE | 16 +++++++++++++ README.md | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 LICENSE create mode 100644 README.md diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..26997df --- /dev/null +++ b/LICENSE @@ -0,0 +1,16 @@ +Copyright 2022 s3lph + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..9b6be72 --- /dev/null +++ b/README.md @@ -0,0 +1,68 @@ +# ActivityPub Pelican Plugin + +Warning: This is an experimental plugin, which most likely does not do +what you'd expect it to do. Please read +https://s3lph.me/activitypub-static-site.html for details. + +## Configuration + +Add the following to your pelicanconf.py: + +```python + +# Enable the plugin +PLUGINS = ['activitypub'] + +# Configure the author's profiles: + +ACTIVITYPUB_AUTHORS = { + # This user will be known as @alice@{{ SITEURL }} in the Fediverse + 'alice': { + 'name': 'Alice', + 'movedTo': 'https://fedi.example/users/alice', + 'alsoKnownAs': ['https://fedi.example/users/alice'], + 'summary': 'Hi, I\'m Alice! Please follow me at @alice@fedi.example.', + 'attachment': [ + { + 'type': 'PropertyValue', + 'name': 'Mastodon', + 'value': '@alice@fedi.example' + } + ], + 'icon': { + 'type': 'Image', + 'mediaType': 'image/png', + 'url': SITEURL + 'authors/alice.png' + } + } +} +``` + +Apart from the ActivityPub resources, this plugin will also generate the following resources: + +- `.well-known/host-meta` +- `.well-known/nodeinfo` +- `.well-known/webfinger` + +If your Pelican site has multiple autors, you need to redirect `/.well-known/webfinger?resource=acct:alice@example.org` to `/.well-known/_webfinger/alice`. This can e.g. be achieved with Apache `.htaccess`: + +``` +RewriteEngine on +RewriteRule ^/.well-known/webfinger?resource=acct:([^@]+)@example.org$ /.well-known/_webfinger/$1 [L] +``` + +Apart from that, the following Content-Types have to be overwritten (again in Apache config): +``` + + Header set Content-Type "application/activity+json; charset=utf-8" + + + Header set Content-Type "application/xrd+xml; charset=utf-8" + + + Header set Content-Type "application/json; charset=utf-8" + + + Header set Content-Type "application/json; charset=utf-8" + +``` \ No newline at end of file