Commit graph

3,853 commits

Author SHA1 Message Date
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
Goffi
a5381c8c86 tests (unit/ap-gateway): tests for XMPP identity/vCard4 <=> AP actor data conversion:
rel 368
2022-06-29 14:06:33 +02:00
Goffi
5a021e63a1 CLI (identity): add description to identity set:
rel 368
2022-06-29 12:13:49 +02:00
Goffi
68c627570d component AP: convert AP identity data to XMPP:
metadata are converted to vCard4 (XEP-0292).
Avatar is converted to User Avatar (XEP-0084), it is downloaded, resized, converted and
cached on first request.

If avatar is bigger than 5 Mio, it won't be used.

rel 368
2022-06-29 12:12:09 +02:00
Goffi
1d5e64a6b7 plugin XEP-0163: allow unset event_type in addPEPEvent, check conflict + type hints 2022-06-29 12:08:53 +02:00
Goffi
1e1da8a7ae core (tools/web): helped method to download files:
this method is for internal file download, progression mechanism is not used.

rel 368
2022-06-29 12:07:45 +02:00
Goffi
303e25f72e component AP: XMPP identity => AP actor data converstion:
XMPP identity data (coming from various XEPs, notably XEP-0292 (vCard4) and XEP-0084 (User
Avatar)) are now used to complete actor data.

Avatar files can now be delivered with the `avatar` type in URL.

rel 368
2022-06-29 12:06:21 +02:00
Goffi
f6ccf044da plugin XEP-0084: "User Avatar" implementation:
rel 368
2022-06-29 11:59:07 +02:00
Goffi
610e457bec plugin XEP-0292: vCard4 Over XMPP implementation:
implementation of vCard4, the dedicated <IQ/> protocol is not implemented because it's
obsoleted (see comments).

Fow now, only `fn`, `nickname` and `note` are handled.

rel 368
2022-06-29 11:58:00 +02:00
Goffi
f2e11805b2 core (memory/cache): type hints + filename fix:
cached file filename is now always UID + extension to avoid collision. `filename` argument
as been renamed to `original_filename`, it is store if present, and used to guess media
type when necessary.
2022-06-29 11:54:53 +02:00
Goffi
fe11bc9a2b plugin identity: make the plugin compatible with component + description:
the plugin can now be used with components.

the new `description` field is now available.

rel 368
2022-06-29 11:49:03 +02:00
Goffi
35be6b741f plugin identity, XEP-0054: move avatar resizing and caching method to identity plugin:
resizing and caching is now done in identity plugin, to prepare for the implementation of
other XEP to handle avatars.

rel 368
2022-06-29 11:47:48 +02:00
Goffi
11d003b8c1 plugin XEP-0060: type hints 2022-06-29 11:36:31 +02:00
Goffi
ead62068ce core (memory/sqla_config): set a timeout for SQLite:
with default timeout, we may have database lock errors from time to time. To avoid this, a
timeout of 30s is now set.
2022-06-29 10:17:33 +02:00
Goffi
a2c409a4a2 core (memory/sqla): session_add must have a default value in delete 2022-06-29 10:16:03 +02:00
Goffi
07109f0354 core (types): add is_component to SatXMPPEntity 2022-06-29 10:14:14 +02:00
Goffi
66dc184866 plugin XEP-0191: fix wrong name and description 2022-06-17 18:25:55 +02:00
Goffi
f9eb48d72d doc (components): AP item retraction + blocking:
fix 367
2022-06-17 15:50:34 +02:00
Goffi
57c945dc9f tests (unit/ap gateway): message/item retractation tests:
this patch adds 4 tests to check pubsub <=> AP item retractation and message <=> AP item
retractation.

rel 367
2022-06-17 15:50:34 +02:00
Goffi
847780b473 tests (unit/ap gateway): fix onMessage call following change in the component:
the component now uses the normal message workflow, thus the tests had to be updated

rel 367
2022-06-17 15:50:34 +02:00
Goffi
c02dcf3d94 component AP gateway typing + remove unused activity arg from newAPDeleteItem
rel 367
2022-06-17 15:50:34 +02:00
Goffi
daccd1de5d doc (cli/message): retract command 2022-06-17 15:50:15 +02:00
Goffi
a44acbc1bb cli (message/retract): message retractation command:
rel 367
2022-06-17 14:15:23 +02:00
Goffi
bfd9168449 component AP gateway: AP delete activity => message retract:
handle retractation of messages. As it is not possible to know from the AP item alone if
we need to to a message retractation (XEP-0424) or a pubsub retractation (XEP-0060), we
now cache sent message, and decide which method to use according to how the item is cached
(i.e. in message history or in pubsub cache).

rel 367
2022-06-17 14:15:23 +02:00