Mercurial > libervia-backend
comparison doc/components.rst @ 3683:a1eff4e32848
doc (components): base documentation for AP Gateway:
fix: 362
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 26 Sep 2021 16:41:58 +0200 |
parents | ba4ef64a6938 |
children | 643622ff1492 |
comparison
equal
deleted
inserted
replaced
3682:7c990aaa49d3 | 3683:a1eff4e32848 |
---|---|
149 "users": "50 Mio", | 149 "users": "50 Mio", |
150 "jids": {"pierre@example.org": "1 Gio"} | 150 "jids": {"pierre@example.org": "1 Gio"} |
151 } | 151 } |
152 | 152 |
153 .. _SI prefixes and binary prefixes: https://en.wikipedia.org/wiki/Octet_(computing)#Unit_multiples | 153 .. _SI prefixes and binary prefixes: https://en.wikipedia.org/wiki/Octet_(computing)#Unit_multiples |
154 | |
155 | |
156 ActivityPub Gateway | |
157 ------------------- | |
158 | |
159 **entry_point:** ``ap-gateway`` | |
160 | |
161 .. note:: | |
162 | |
163 this component is currently in active development, and not yet usable for end-user. This | |
164 documentation will be updated during evolution of component. | |
165 | |
166 You can follow the development by reading `Libervia Progress Notes`_. | |
167 | |
168 .. _Libervia Progress Notes: https://www.goffi.org/tag/Libervia%20progress | |
169 | |
170 This gateway will provide a bidirectional gateway between XMPP and `ActivityPub`_ (or AP | |
171 below). That means that user from XMPP will be able to follow actors or comments messages | |
172 from any software compatible with ActivityPub protocol, and vice versa. | |
173 | |
174 .. _ActivityPub: https://activitypub.rocks/ | |
175 | |
176 .. note:: | |
177 | |
178 this component is mostly tested with Prosody as XMPP server reference, and Mastodon as | |
179 AP server reference, but it should work with any XMPP or AP server. | |
180 | |
181 The component launches a HTTP server (necessary to communicate with AP software). This | |
182 server needs to handle HTTP requests made at paths ``/.well-known/webfinger`` and ``/_ap`` | |
183 (or the ``ap_path`` set in configuration, see below). If the component is not directly | |
184 facing internet (e.g. integrated in an existing website though a proxy), you'll have to | |
185 redirect the requests made to those path to the HTTP server (i.e. to component host at the | |
186 port set at ``http_port``, see configuration below). Please check your HTTP server | |
187 documentation to find how this must be done. | |
188 | |
189 how to address an AP actor from XMPP | |
190 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
191 | |
192 When addressing an ActivityPub actor from XMPP, you must use a JID corresponding to the | |
193 actor. The domain part of the JID correspond to the gateway JID (the one set in gateway | |
194 profile), while the local part (before the ``@``) is used to specify the AP actor. | |
195 | |
196 `XEP-0106`_ (JID Escaping) is used to indicate the AP actor identifier, thus the ``@`` | |
197 must be escaped with ``\40``. | |
198 | |
199 .. _XEP-0106: JID Escaping | |
200 | |
201 **example** | |
202 | |
203 If Louise wants to talk to Pierre which is on the ``example.net`` AP server, she can use | |
204 her XMPP AP gateway which is at ``ap.example.org``. Pierre AP's actor identifier is | |
205 ``pierre@example.net``, Louise can access it via the JID | |
206 ``pierre\40example.net@ap.example.org``. | |
207 | |
208 Of course, this is a bit cumbersome to do by hand, it is expected that XMPP clients will | |
209 do the (un)escaping automatically for end-user, in a way that Louise could enter | |
210 ``pierre@example.net`` directly, with an indicator to show that this is an ActivityPub | |
211 actor identifier rather than an XMPP JID. | |
212 | |
213 how to address an XMPP entity from AP | |
214 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
215 | |
216 To access an XMPP entity, just use its bare JID as AP actor. | |
217 | |
218 **example** | |
219 | |
220 If Pierre wants to talk Louise, he can directly use the JID which is the same as the AP | |
221 actor identifier, i.e. ``louise@example.org`` (note that on AP software, a ``@`` prefix is | |
222 often required, thus Pierre will look for ``@louise@example.org``). | |
223 | |
224 .. note:: | |
225 | |
226 Currently the gateway only uses bare JID, and character set must be recognised by the | |
227 AP software to be used. This will evolve in the close future to have a way to access | |
228 various XMPP Pubsub nodes. | |
229 | |
230 The actor endpoint can also be used directly in AP software (in the example above, it | |
231 would be by default ``https://example.org/_ap/actor/louise%40example.org``). | |
232 | |
233 | |
234 using the component | |
235 ~~~~~~~~~~~~~~~~~~~ | |
236 | |
237 The component is currently only usable for development purpose, and it can be used with | |
238 the following method (with can be accessed through the ``APSend`` bridge method, client is | |
239 then replaced by the ``profile`` name, as last argument): | |
240 | |
241 .. automethod:: sat.plugins.plugin_comp_ap_gateway.APGateway.publishMessage | |
242 | |
243 The method can be used either with CLI's :ref:`debug bridge method | |
244 <li_debug_bridge_method>` or with any D-Bus tool like ``qdbus`` or ``d-feet`` (only if you | |
245 use the D-Bus bridge). | |
246 | |
247 example | |
248 ~~~~~~~ | |
249 | |
250 On its ``example.net`` Mastodon instance, Pierre has published a message with the id | |
251 ``https://example.net/@pierre/106986412193109832``. To send a reply to this message, | |
252 Louise can use the following command:: | |
253 | |
254 $ li debug bridge method -c APSend '"{\"node\": \"https://example.net/@pierre/106986412193109832\", \"content\": \"A lille hello from XMPP\"}","pierre\\40example.net@ap.example.org", "louise"' | |
255 | |
256 Note the double escaping, one for the shell argument, and the other to specify JSON | |
257 object. |