Mercurial > prosody-modules
annotate mod_pubsub_post/README.markdown @ 3152:882f7d5c3ce8
mod_pubsub_post/README: Affiliation management in trunk now
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 27 Jun 2018 17:27:44 +0200 |
parents | a36710acd9c8 |
children | e0de1fdbc80a |
rev | line source |
---|---|
3100 | 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 | |
3152
882f7d5c3ce8
mod_pubsub_post/README: Affiliation management in trunk now
Kim Alvefur <zash@zash.se>
parents:
3151
diff
changeset
|
41 Prosodys PubSub module supports [setting affiliations via |
882f7d5c3ce8
mod_pubsub_post/README: Affiliation management in trunk now
Kim Alvefur <zash@zash.se>
parents:
3151
diff
changeset
|
42 XMPP](https://xmpp.org/extensions/xep-0060.html#owner-affiliations), in |
882f7d5c3ce8
mod_pubsub_post/README: Affiliation management in trunk now
Kim Alvefur <zash@zash.se>
parents:
3151
diff
changeset
|
43 trunk since [revision |
882f7d5c3ce8
mod_pubsub_post/README: Affiliation management in trunk now
Kim Alvefur <zash@zash.se>
parents:
3151
diff
changeset
|
44 384ef9732b81](https://hg.prosody.im/trunk/rev/384ef9732b81). |
3100 | 45 |
46 It can however be done from another plugin: | |
47 | |
48 ``` {.lua} | |
49 local mod_pubsub = module:depends("pubsub"); | |
50 local pubsub = mod_pubsub.service; | |
51 | |
52 pubsub:create("princely_musings", true); | |
53 pubsub:set_affiliation("princely_musings", true, "127.0.0.1", "publisher"); | |
54 ``` |