diff options
author | Julio Capote <jcapote@gmail.com> | 2023-01-08 19:49:44 +0000 |
---|---|---|
committer | Julio Capote <jcapote@gmail.com> | 2023-01-08 19:49:44 +0000 |
commit | a40654132655fc3f5e57f31cb8eda36a28ec6d1d (patch) | |
tree | a7710b1fb7e18910370636fd6cd004514c477da6 /README.md | |
parent | 82c35e6fbc77f2e1f17dcfbf772b226bc195fae7 (diff) | |
download | communique-a40654132655fc3f5e57f31cb8eda36a28ec6d1d.tar.gz |
readme
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 40 |
1 files changed, 20 insertions, 20 deletions
@@ -10,25 +10,25 @@ With communique it's easy to expose an RSS/atom feed as an ActivityPub actor, wh Given a configuration file like this: - domain = "https://example.com" + domain = "https://example.com" - [[handlers]] - name = "sample" - exec = "sample-cgi-handler.sh" - interval = "5s" - dedupWindow = "30s" + [[handlers]] + name = "sample" + exec = "sample-cgi-handler.sh" + interval = "5s" + dedupWindow = "30s" And a `sample-cgi-handler.sh` like: - #!/bin/bash - echo "Content-type: application/atom+xml" - echo "" - echo '<feed xmlns="http://www.w3.org/2005/Atom"> - <entry> - <content>example content</content> - </entry> - </feed>' - exit 0 + #!/bin/bash + echo "Content-type: application/atom+xml" + echo "" + echo '<feed xmlns="http://www.w3.org/2005/Atom"> + <entry> + <content>example content</content> + </entry> + </feed>' + exit 0 Communique will execute `sample-cgi-handler.sh` every 5 seconds, deduplicating the extracted `<content/> for a period of 30 seconds. Any unique items that are found are persisted to our actors inbox and delivered to all actors that follow our actor. @@ -38,23 +38,23 @@ Run the following steps to see the example above in action. 1. Clone the repository - git clone https://git.capotej.com/capotej/communique + git clone https://git.capotej.com/capotej/communique 2. Go to the directory - cd communique + cd communique 3. Compile and run it (feel free to click Deny on any firewall warnings) - go run main.go + go run main.go 4. In another terminal, you can now see the actor page - curl -H 'Accept: application/json' http://localhost:8080/actors/sample | python3 -m json.tool + curl -H 'Accept: application/json' http://localhost:8080/actors/sample | python3 -m json.tool 5. And their outbox - curl -H 'Accept: application/json' http://localhost:8080/actors/sample/outbox | python3 -m json.tool + curl -H 'Accept: application/json' http://localhost:8080/actors/sample/outbox | python3 -m json.tool If this were running on a real domain, like "https://example.com", we would now be able to follow this actor at `@sample@example.com` from any ActivityPub service and see its posts on our timeline. |