Comparison

mod_pubsub_post/README.markdown @ 3151:a36710acd9c8

mod_pubsub_post: Rename README so it gets picked up by the site generator
author Kim Alvefur <zash@zash.se>
date Wed, 27 Jun 2018 17:17:17 +0200
parent 3100:mod_pubsub_post/README.md@0422fb55cc37
child 3152:882f7d5c3ce8
comparison
equal deleted inserted replaced
3150:14b6ad2b773f 3151:a36710acd9c8
1 # Introduction
2
3 Lets you easily publish data to PubSub using a HTTP POST request. The
4 payload can be Atom feeds, arbitrary XML, or arbitrary JSON. The type
5 should be indicated via the `Content-Type` header.
6
7 ``` {.bash}
8 curl http://localhost:5280/pubsub_post/princely_musings \
9 -H "Content-Type: application/json" \
10 --data-binary '{"musing":"To be, or not to be: that is the question"}'
11 ```
12
13 # Configuration
14
15 ## Authentication
16
17 Authentication can be handled in two different ways.
18
19 ### None
20
21 ``` {.lua}
22 pubsub_post_actor = "superuser"
23 ```
24
25 The module uses an internal actor that has all privileges and can always
26 do everything. It is strongly suggested that you do not expose this to
27 the Internet. *Maybe* it shouldn't be the default...
28
29 ### IP
30
31 ``` {.lua}
32 pubsub_post_actor = "request.ip"
33 ```
34
35 Uses the IP address from the HTTP request as actor, which means this
36 pseudo-JID must be given a 'publisher' affiliation. This should work
37 nicely with the `autocreate_on_publish` setting, where the first actor
38 to attempt to publish to a non-existant node becomes owner of it, which
39 includes publishing rights.
40
41 Prosodys PubSub module does not currently support [setting affiliations
42 via XMPP](https://xmpp.org/extensions/xep-0060.html#owner-affiliations),
43 but this is planned.
44
45 It can however be done from another plugin:
46
47 ``` {.lua}
48 local mod_pubsub = module:depends("pubsub");
49 local pubsub = mod_pubsub.service;
50
51 pubsub:create("princely_musings", true);
52 pubsub:set_affiliation("princely_musings", true, "127.0.0.1", "publisher");
53 ```