From 42ad51e94aa3c7b5728dc6de769beab78a84098d Mon Sep 17 00:00:00 2001 From: kaniini Date: Tue, 30 Oct 2018 03:17:25 +0000 Subject: [PATCH] add some docs --- Pipfile | 13 ---- Pipfile.lock | 157 ----------------------------------------------- README.md | 70 ++++++++------------- requirements.txt | 1 - 4 files changed, 24 insertions(+), 217 deletions(-) delete mode 100644 Pipfile delete mode 100644 Pipfile.lock diff --git a/Pipfile b/Pipfile deleted file mode 100644 index 0165411..0000000 --- a/Pipfile +++ /dev/null @@ -1,13 +0,0 @@ -[[source]] -url = "https://pypi.org/simple" -verify_ssl = true -name = "pypi" - -[packages] -aiohttp = "*" -pycrypto = "*" -simplejson = "*" -pyyaml = "*" -blinker = "*" - -[dev-packages] diff --git a/Pipfile.lock b/Pipfile.lock deleted file mode 100644 index 0e3751f..0000000 --- a/Pipfile.lock +++ /dev/null @@ -1,157 +0,0 @@ -{ - "_meta": { - "hash": { - "sha256": "6d533fa235714f114f1731beca5ce3a18fe7abcff58a3341d1fdf2651447b9a7" - }, - "pipfile-spec": 6, - "requires": {}, - "sources": [ - { - "name": "pypi", - "url": "https://pypi.org/simple", - "verify_ssl": true - } - ] - }, - "default": { - "aiohttp": { - "hashes": [ - "sha256:1a112a1fdf3802b7f2b182e22e51d71e4a8fa7387d0d38e79a268921b869e384", - "sha256:33aa7c937ebaf063a860cbb0c263a771b33333a84965c6148eeafe64fb4e29ca", - "sha256:550b4a0788500f6d00f41b7fdd9fcce6d78f99706a7b2f6f81d4d331c7ca468e", - "sha256:601e8e83123b4d423a9dfddf7d6943f4f520651a78ffcd50c99d065136c7ff7b", - "sha256:620f19ba7628b70b177f5c2e6a55a6fd6e7c8591cde38c3f8f52551733d31b66", - "sha256:70d56c784da1239c89d39fefa166fd429306dada641178389be4184a9c04e501", - "sha256:7de2c9e445a5d257935011268202338538abef1aaff341a4733eca56419ca6f6", - "sha256:96bb80b659cc2bafa160f3f0c346ce7fc10de1ffec4908d7f9690797f155f658", - "sha256:ae7501cc6a6c37b8d4774bf2218c37be47fe42019a2570e8510fc2044e59d573", - "sha256:c833aa6f4c9ac3e3eb843e3d999bae51339ad33a937303f43ce78064e61cb4b6", - "sha256:dd81d85a342edf3d2a388e2f24d9facebc9c04550043888f970ee2f228c93059", - "sha256:f20deec7a3fbaec7b5eb7ad99878427ad2ee4cc16a46732b705e8121cbb3cc12", - "sha256:f52e7287eb9286a1e91e4c67c207c2573147fbaddc68f70efb5aeee5d1992f2e", - "sha256:fe7b2972ff7e779e812f974aa5695edc328ecf559ceeea887ac46f06f090ad4c", - "sha256:ff1447c84a02b9cd5dd3a9332d1fb181a4386c3625765bb5caf1cfbc210ab3f9" - ], - "index": "pypi", - "version": "==3.3.2" - }, - "async-timeout": { - "hashes": [ - "sha256:474d4bc64cee20603e225eb1ece15e248962958b45a3648a9f5cc29e827a610c", - "sha256:b3c0ddc416736619bd4a95ca31de8da6920c3b9a140c64dbef2b2fa7bf521287" - ], - "markers": "python_version >= '3.5.3'", - "version": "==3.0.0" - }, - "attrs": { - "hashes": [ - "sha256:4b90b09eeeb9b88c35bc642cbac057e45a5fd85367b985bd2809c62b7b939265", - "sha256:e0d0eb91441a3b53dab4d9b743eafc1ac44476296a2053b6ca3af0b139faf87b" - ], - "version": "==18.1.0" - }, - "blinker": { - "hashes": [ - "sha256:471aee25f3992bd325afa3772f1063dbdbbca947a041b8b89466dc00d606f8b6" - ], - "index": "pypi", - "version": "==1.4" - }, - "chardet": { - "hashes": [ - "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae", - "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691" - ], - "version": "==3.0.4" - }, - "idna": { - "hashes": [ - "sha256:156a6814fb5ac1fc6850fb002e0852d56c0c8d2531923a51032d1b70760e186e", - "sha256:684a38a6f903c1d71d6d5fac066b58d7768af4de2b832e426ec79c30daa94a16" - ], - "version": "==2.7" - }, - "idna-ssl": { - "hashes": [ - "sha256:a933e3bb13da54383f9e8f35dc4f9cb9eb9b3b78c6b36f311254d6d0d92c6c7c" - ], - "version": "==1.1.0" - }, - "multidict": { - "hashes": [ - "sha256:1a1d76374a1e7fe93acef96b354a03c1d7f83e7512e225a527d283da0d7ba5e0", - "sha256:1d6e191965505652f194bc4c40270a842922685918a4f45e6936a6b15cc5816d", - "sha256:295961a6a88f1199e19968e15d9b42f3a191c89ec13034dbc212bf9c394c3c82", - "sha256:2be5af084de6c3b8e20d6421cb0346378a9c867dcf7c86030d6b0b550f9888e4", - "sha256:2eb99617c7a0e9f2b90b64bc1fb742611718618572747d6f3d6532b7b78755ab", - "sha256:4ba654c6b5ad1ae4a4d792abeb695b29ce981bb0f157a41d0fd227b385f2bef0", - "sha256:5ba766433c30d703f6b2c17eb0b6826c6f898e5f58d89373e235f07764952314", - "sha256:a59d58ee85b11f337b54933e8d758b2356fcdcc493248e004c9c5e5d11eedbe4", - "sha256:a6e35d28900cf87bcc11e6ca9e474db0099b78f0be0a41d95bef02d49101b5b2", - "sha256:b4df7ca9c01018a51e43937eaa41f2f5dce17a6382fda0086403bcb1f5c2cf8e", - "sha256:bbd5a6bffd3ba8bfe75b16b5e28af15265538e8be011b0b9fddc7d86a453fd4a", - "sha256:d870f399fcd58a1889e93008762a3b9a27cf7ea512818fc6e689f59495648355", - "sha256:e9404e2e19e901121c3c5c6cffd5a8ae0d1d67919c970e3b3262231175713068" - ], - "markers": "python_version >= '3.4.1'", - "version": "==4.3.1" - }, - "pycrypto": { - "hashes": [ - "sha256:f2ce1e989b272cfcb677616763e0a2e7ec659effa67a88aa92b3a65528f60a3c" - ], - "index": "pypi", - "version": "==2.6.1" - }, - "pyyaml": { - "hashes": [ - "sha256:3d7da3009c0f3e783b2c873687652d83b1bbfd5c88e9813fb7e5b03c0dd3108b", - "sha256:3ef3092145e9b70e3ddd2c7ad59bdd0252a94dfe3949721633e41344de00a6bf", - "sha256:40c71b8e076d0550b2e6380bada1f1cd1017b882f7e16f09a65be98e017f211a", - "sha256:558dd60b890ba8fd982e05941927a3911dc409a63dcb8b634feaa0cda69330d3", - "sha256:a7c28b45d9f99102fa092bb213aa12e0aaf9a6a1f5e395d36166639c1f96c3a1", - "sha256:aa7dd4a6a427aed7df6fb7f08a580d68d9b118d90310374716ae90b710280af1", - "sha256:bc558586e6045763782014934bfaf39d48b8ae85a2713117d16c39864085c613", - "sha256:d46d7982b62e0729ad0175a9bc7e10a566fc07b224d2c79fafb5e032727eaa04", - "sha256:d5eef459e30b09f5a098b9cea68bebfeb268697f78d647bd255a085371ac7f3f", - "sha256:e01d3203230e1786cd91ccfdc8f8454c8069c91bee3962ad93b87a4b2860f537", - "sha256:e170a9e6fcfd19021dd29845af83bb79236068bf5fd4df3327c1be18182b2531" - ], - "index": "pypi", - "version": "==3.13" - }, - "simplejson": { - "hashes": [ - "sha256:067a7177ddfa32e1483ba5169ebea1bc2ea27f224853211ca669325648ca5642", - "sha256:2fc546e6af49fb45b93bbe878dea4c48edc34083729c0abd09981fe55bdf7f91", - "sha256:354fa32b02885e6dae925f1b5bbf842c333c1e11ea5453ddd67309dc31fdb40a", - "sha256:37e685986cf6f8144607f90340cff72d36acf654f3653a6c47b84c5c38d00df7", - "sha256:3af610ee72efbe644e19d5eaad575c73fb83026192114e5f6719f4901097fce2", - "sha256:3b919fc9cf508f13b929a9b274c40786036b31ad28657819b3b9ba44ba651f50", - "sha256:3dd289368bbd064974d9a5961101f080e939cbe051e6689a193c99fb6e9ac89b", - "sha256:6c3258ffff58712818a233b9737fe4be943d306c40cf63d14ddc82ba563f483a", - "sha256:75e3f0b12c28945c08f54350d91e624f8dd580ab74fd4f1bbea54bc6b0165610", - "sha256:b1f329139ba647a9548aa05fb95d046b4a677643070dc2afc05fa2e975d09ca5", - "sha256:ee9625fc8ee164902dfbb0ff932b26df112da9f871c32f0f9c1bcf20c350fe2a", - "sha256:fb2530b53c28f0d4d84990e945c2ebb470edb469d63e389bf02ff409012fe7c5" - ], - "index": "pypi", - "version": "==3.16.0" - }, - "yarl": { - "hashes": [ - "sha256:2556b779125621b311844a072e0ed367e8409a18fa12cbd68eb1258d187820f9", - "sha256:4aec0769f1799a9d4496827292c02a7b1f75c0bab56ab2b60dd94ebb57cbd5ee", - "sha256:55369d95afaacf2fa6b49c84d18b51f1704a6560c432a0f9a1aeb23f7b971308", - "sha256:6c098b85442c8fe3303e708bbb775afd0f6b29f77612e8892627bcab4b939357", - "sha256:9182cd6f93412d32e009020a44d6d170d2093646464a88aeec2aef50592f8c78", - "sha256:c8cbc21bbfa1dd7d5386d48cc814fe3d35b80f60299cdde9279046f399c3b0d8", - "sha256:db6f70a4b09cde813a4807843abaaa60f3b15fb4a2a06f9ae9c311472662daa1", - "sha256:f17495e6fe3d377e3faac68121caef6f974fcb9e046bc075bcff40d8e5cc69a4", - "sha256:f85900b9cca0c67767bb61b2b9bd53208aaa7373dae633dbe25d179b4bf38aa7" - ], - "version": "==1.2.6" - } - }, - "develop": {} -} diff --git a/README.md b/README.md index dc48591..492df0b 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ -# viera +# ActivityRelay -A useful IRC and ActivityPub bot which links identities and relays messages. +A generic LitePub message relay. ## Copyleft -`viera` is copyrighted, but free software, licensed under the terms of the GNU Affero -General Public License version 3 (AGPLv3) license. You can find a copy of it in this -package as the `LICENSE` file. +ActivityRelay is copyrighted, but free software, licensed under the terms of the GNU +Affero General Public License version 3 (AGPLv3) license. You can find a copy of it +in this package as the `LICENSE` file. ## Setup @@ -15,23 +15,16 @@ package as the `LICENSE` file. You need at least Python 3.5 (3.5.2 or newer recommended) to make use of this software. It simply will not run on older Python versions. -`viera` uses the new `pipenv` python environment manager, you should install it before -trying to make use of this software: +Install the dependencies as you normally would (`pip3 install -r requirements.txt`). - $ pip3 install pipenv +Copy `relay.yaml.example` to `relay.yaml` and edit it as appropriate: -Next, create the virtual environment for `viera` to use: + $ cp relay.yaml.example relay.yaml + $ $EDITOR relay.yaml - $ pipenv install +Finally, you can launch the relay: -Next, copy `viera.yaml.example` to `viera.yaml` and edit it as appropriate: - - $ cp viera.yaml.example viera.yaml - $ $EDITOR viera.yaml - -Finally, you can launch viera: - - $ pipenv run python3 -m viera + $ python3 -m relay It is suggested to run this under some sort of supervisor, such as runit, daemontools, s6 or systemd. Configuration of the supervisor is not covered here, as it is different @@ -44,37 +37,22 @@ of your webserver is not discussed here, but any guide explaining how to configu modern non-PHP web application should cover it. -## Getting started +## Getting Started -It is required to register a services account for the bot. This is different depending -on the IRC network in use. +Normally, you would direct your LitePub instance software to follow the LitePub actor +found on the relay. In Pleroma this would be something like: -It is also required to use SASL to authenticate to the IRC network. This is supported on -most IRC networks. + $ MIX_ENV=prod mix relay_follow https://your.relay.hostname/actor -`viera` works with ActivityPub identities as the primary source of trust. This means that -you are required to link an ActivityPub identity to your IRC identity in order to -authenticate to the bot. To do that, make sure you are logged into your NickServ or similar -account and message the bot on IRC: - - /msg yourbot auth - -The bot will respond with an authentication token that you must supply via the fediverse, -in most cases you can just copy and paste the exact message it provides. +Mastodon uses an entirely different relay protocol but supports LitePub relay protocol +as well when the Mastodon relay handshake is used. In these cases, Mastodon relay +clients should follow `http://your.relay.hostname/inbox` as they would with Mastodon's +own relay software. -### Following accounts to relay to IRC - -Once you have authenticated to an AP identity which is listed in the `privileged` group in -the config file, you may configure the bot to follow accounts, by using the `follow` command: - - /msg yourbot follow https://pleroma.site/users/kaniini - -This will cause your bot to request an ActivityPub connection between itself and the user you -followed. In most cases this will be set up immediately, but in some cases, there may be a delay, -such as when accounts are restricted. - -If you want the bot to stop following an account, you can use the `unfollow` command: - - /msg yourbot unfollow https://pleroma.site/users/kaniini +## Performance +Performance is very good, with all data being stored in memory and serialized to a +JSON-LD object graph. Worker coroutines are spawned in the background to distribute +the messages in a scatter-gather pattern. Performance is comparable to, if not +superior to, the Mastodon relay software, with improved memory efficiency. diff --git a/requirements.txt b/requirements.txt index c146cc4..340f048 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,6 @@ aiohttp==3.3.2 async-timeout==3.0.0 attrs==18.1.0 -blinker==1.4 chardet==3.0.4 idna==2.7 idna-ssl==1.1.0