Commit graph

3,876 commits

Author SHA1 Message Date
Goffi
b79a06e488 plugin mr mercurial: limit export to ancestors of working directory parent 2022-08-23 23:37:22 +02:00
Goffi
b6d57c0495 plugin merge-requests: fix await use on blocking method 2022-08-23 13:00:07 +02:00
Goffi
6bb76a2bd0 doc (components/AP gateway): "repeat" and "noticed/like":
fix 370
2022-07-22 17:40:03 +02:00
Goffi
4b8e1c2747 doc (cli/pubsub, cli/blog): attachments subcommands documentation:
rel 370
2022-07-22 17:16:28 +02:00
Goffi
fa5a0de7f7 doc (cli/blog): repeat documentation:
rel 370
2022-07-22 17:15:40 +02:00
Goffi
155c249884 tests (unit/AP gateway): tests for item repeat/announce and noticed/like conversion:
Add tests for

- XMPP blog post repeat => AP Announce conversion and vice versa
- XMPP pubsub `noticed` attachment => AP like conversion and vice versa

rel 370
2022-07-22 15:45:33 +02:00
Goffi
2cee9c9519 component AP gateway: fix item ID for XMPP items on Announce:
if an Announced item is from XMPP, the AP id must be parsed to retrieve the XMPP original
ID.

rel 370
2022-07-22 15:42:59 +02:00
Goffi
9089a6494e component AP gateway: handle Like and Undo/Like activities:
rel 370
2022-07-21 18:07:35 +02:00
Goffi
a945d3cb67 component AP gateway (pubsub): only emit a Follow activity for microblog subscription:
this avoid to emit Follow subscription when an entity wants to subscribe to attachments
or other special nodes.

rel 370
2022-07-21 18:05:20 +02:00
Goffi
c20e09fb22 plugin XEP-0060: sender can now be specified in sendItems and publish:
if not sended is set, `client.jid` is used.
2022-07-21 18:02:33 +02:00
Goffi
0aa9613693 cli (blog, pubsub): new attachments subcommands:
`pubsub/attachments` subcommands has a `get` and a `set` subcommand to manage attachments
of a pubsub item.

`blog` has the same subcommands, the only difference is that if `--node` is not specified,
the default blog namespace will be used.

rel 370
2022-07-20 17:55:11 +02:00
Goffi
d841a51a1a component AP gateway: handle XMPP attachments -> AP likes conversion:
convert `noticed` attachments coming from XMPP to suitable `Like` activities. Virtual node
is created in cache when necessary, and virtual items published to virtual JID mapping AP
accounts are cached too.

rel 370
2022-07-20 17:53:12 +02:00
Goffi
89f67ee50d plugin pubsub attachments: partial implementation of pubsub-attachments protoXEP:
This is an implementation of the "Basic Usage" of
https://xmpp.org/extensions/inbox/pubsub-attachments.html.

rel 370
2022-07-20 17:49:51 +02:00
Goffi
60a747b6f8 plugin pubsub cache: replace empty list by None in getItemsFromCache:
if an empty list is used, no item can be retrieved, this patch replace empty list by None
to avoid this case.
2022-07-20 17:46:58 +02:00
Goffi
8bae5e3d7e core (memory/sqla): add argument to getPubsubNode to auto-create a node:
if the node is not in cache, the new `create` and `create_kwargs` arguments can be used to
automatically call `setPubsubNode`

rel 370
2022-07-20 17:41:44 +02:00
Goffi
38c5cc2fba plugin XEP-0277: add a trigger to send method:
rel 370
2022-07-20 17:19:53 +02:00
Goffi
6c170ef8cc plugin XEP-0060, tools (utils): doc/type hints 2022-07-20 17:18:17 +02:00
Goffi
8d64157d88 core: fix calls to domish.Element.elements:
domish.Element.elements should be called with namespace and element name as 2 arguments,
but it has been confused in several places with the call to `domish.Element.addElement`
which is often done with a `(namespace, name)` tuple. Unfortunately calling with a tuple
is accepted and doesn't raise any error in `elements`, but this result in a wrong element
returned.

This patch fixes the erroneous calls.
2022-07-20 17:12:29 +02:00
Goffi
9ce0f943cc cli (blog/get): verbose level of 2 now shows extra field 2022-07-14 12:55:30 +02:00
Goffi
44849a1fda cli (blog/set): show ID of published item 2022-07-14 12:55:30 +02:00
Goffi
51f786bc21 component AP gateway: when a repeated blog post is retracted, it converted to suitable Activity:
when a retract item is received, the former item is now retrieve from cache, and if it was
a "repeat" blog post, it is converted to the suitable `Undo` of `Announce` activity
(instead of the default `Delete` activity).

rel 370
2022-07-14 12:55:30 +02:00
Goffi
ee898b120d component AP gateway: "repeat" to "Announce" conversion:
when an XMPP blog post is marked as repeated, it is converted to an AP Announce activity

rel 370
2022-07-14 12:55:30 +02:00
Goffi
5ceb75a137 plugin XEP-0060: fix bad naming of return variable 2022-07-14 12:55:30 +02:00
Goffi
e73d4ebeff component AP gateway: fix wrong exception + use of mb_data["xml"] when it may be absent 2022-07-14 12:55:30 +02:00
Goffi
eb5b89d113 component AP gateway: we need to use actor and not attributedTo for activities:
`attributedTo` may not be filled, notably when the object is a string URL
2022-07-14 12:55:30 +02:00
Goffi
9a5801fedd component AP gateway: get items when not found in cache in apGetLocalObject:
rel 370
2022-07-14 12:55:30 +02:00
Goffi
9f6d69c75d component AP gateway: use the new priority argument of addManagedNode:
priority is needed because we'll need to inspect former items on retract to check the
Acitivy to use (it may be an `Undo` activity is some cases), and this must be done before
the cache is updated by pubsub cache plugin.

rel 370
2022-07-14 12:55:30 +02:00
Goffi
c2ee7cbbbc plugin XEP-0060: handle priority in addManagedNode:
Priority lets order the callback list when an event is received. This is important in some
use case, notably when a plugin needs to check the former item before it is deleted from
cache or updated.

rel 370
2022-07-14 12:55:30 +02:00
Goffi
c7945a0ed6 plugin XEP-0277: return ID of published item in send and bridge's mbSend 2022-07-14 12:55:30 +02:00
Goffi
cd9d1d27e3 component AP gateway: new verbose attribute in AP gateway to activate debug logs:
when verbose is not null, object posted or returned on GET request are logged. Check
comments for vebosity level
2022-07-14 12:55:30 +02:00
Goffi
f4af47a929 component AP gateway: return item when item URL is used:
a request on an `item` type URL will return the suitable cached item.

rel 370
2022-07-14 12:55:30 +02:00
Goffi
7bd01dd06c component AP gateway: use createActivity in mbdata2APitem 2022-07-14 12:55:30 +02:00
Goffi
6e74e19c73 component AP gateway: Announce activity implementation:
`Announce` and `Undo` of `Announce` are now implemented and converted to suitable XEP-0277
"repeat" items, or retract.

rel 370
2022-07-14 12:55:30 +02:00
Goffi
575c3fe768 component AP gateway: getAPAccountFromId now works with local IDs:
rel 370
2022-07-14 12:55:30 +02:00
Goffi
fe4dc35f5c component AP gateway: apGetObject and apGetList now work with local object:
When a local item is linked, it is found from database instead of doing an HTTP request.

rel 370
2022-07-14 12:55:30 +02:00
Goffi
b533b3e56c li (blog): new repeat subcommand, to re-publish a blog post:
rel 370
2022-07-14 12:55:19 +02:00
Goffi
2550264eda plugin XEP-0277: post repeating implementation:
Repeating a post as specified at https://xmpp.org/extensions/xep-0277.html#repeat is now
implemented. On sending, one can either use the new `repeat` method (or the bridge
`mbRepeat` one from frontends) to repeat any XEP-0277 item, or use the field `repeated` in
microblog data's `extra`. This field must mainly contains the `by` field with JID of
repeater (the "author*" field being filled with original author metadata), and the `uri`
field with link (usually `xmpp:` one) to repeated item.

When receiving a repeated item, the same `repeated` field is filled.

rel 370
2022-07-13 12:15:04 +02:00
Goffi
ab221c78b7 install: pyyaml and treq update 2022-07-10 16:40:16 +02:00
Goffi
3633997ec4 doc (components/AP): Mention:
fix 369
2022-07-10 16:15:44 +02:00
Goffi
68d7c9257b test (unit/AP gateway): tests for XMPP reference/mention <=> AP mention conversion:
this patch add 5 tests:
- 2 to mention AP mention to XMPP conversion, with direct addressing or using "tag" field
- 2 to test automatic mention parsing of body
- 1 to test XEP-0372 Reference to AP mention conversion

rel 369
2022-07-10 16:15:09 +02:00
Goffi
0938a7cd58 doc (cli/pubsub): add doc for `reference` subcommand:
rel 369
2022-07-10 16:15:09 +02:00
Goffi
eb4c766489 cli (pubsub): new reference subcommand to send references/mentions to pubsub items:
rel 369
2022-07-10 16:15:09 +02:00
Goffi
e84436adfd cli: helper method to retrieve profile's jid:
rel 369
2022-07-10 16:15:09 +02:00
Goffi
9e2f4571f6 component AP gateway: convert XMPP mentions to AP:
When a XEP-0372 mention is received, the linked pubsub item is looked after in cache, and
if found, it is send to mentioned entity with `mention` tag added.

However, this doesn't work in some cases (see incoming doc for details). To work around
that, `@user@server.tld` type mention are also scanned in body, and mentions are added
when found (this can be disabled with `auto_mentions` setting).

Mention are only scanned in "public" messages, i.e. for pubsub items, and not direct
messages.

rel 369
2022-07-10 16:15:06 +02:00
Goffi
2c654e017d component AP gateway: convert AP mention to XEP-0372 mentions:
when a mentions are found in AP items (either with people specified directly as target, of
with `mention` tags as in
https://www.w3.org/TR/activitystreams-vocabulary/#microsyntaxes), they are converted to
XEP-0372 `mention` references.

This is only done for Pubsub items (i.e. not for private messages).

rel 369
2022-07-10 15:16:15 +02:00
Goffi
a626b8b888 plugin pubsub cache: resync in synchronise when node's sync_state is not set:
synchronisation used to be skipped when the node was existing and `resync` was not set,
however the case happens when a node is subscribed but not synchronised, thus this patch
update the behaviour to be sure to have the node synchronised.

rel 369
2022-07-10 15:16:15 +02:00
Goffi
618c360421 plugin XEP-0372: References implementation:
rel 369
2022-07-10 15:16:05 +02:00
Goffi
70cfacfe1a tools (common/uri): accept URIs without type:
URIs without type are used to link JIDs.

rel 369
2022-07-09 16:30:37 +02:00
Goffi
b682a3bfeb doc (developer): typo 2022-07-09 16:29:36 +02:00
Goffi
ebed317c3b doc (components/AP): identity and avatar:
fix 368
2022-06-29 14:23:16 +02:00