Commit graph libervia-backend/sat/plugins
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
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
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
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
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
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
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
66dc184866 plugin XEP-0191: fix wrong name and description 2022-06-17 18:25:55 +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
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
Goffi
8869b1b05d component AP gateway: message retractation => AP deletion
Convert XEP-0424 message retractation request to suitable AP delete activity.

The message workflow and its triggers are now used instead of a direct observer, as it is
now possible to do so with component, and this let other plugin to parse and eventually
update metadata.

rel 367
2022-06-17 14:15:23 +02:00
Goffi
7d3e66dc28 component AP gateway: set POST default response code to 202 (accepted) 2022-06-17 14:15:23 +02:00
Goffi
bcdd1356bb plugin XEP-424: Message Retractation implementation:
rel 367
2022-06-17 14:15:23 +02:00
Goffi
46132a523e plugin XEP-0428: Fallback Indication implementation:
rel 367
2022-06-17 14:15:23 +02:00
Goffi
f21f5255b0 plugin XEP-0422: Message Fastening implementation:
rel 367
2022-06-17 14:15:23 +02:00
Goffi
bb3e7ffa9b core (memory/sqla), plugin XEP-0359: always add origin-id, and store:
`origin-id` is now always added to messages, and it is stored to database in the new
column instead of `extra` when present.
2022-06-17 14:15:23 +02:00
Goffi
3ccd4280ac core (xmpp): adapt message workflow to components:
message workflow were not used for components so far. This patch activate it, normalise
namespace to the client one to simplify parsing, and use SatXMPPComponent.sendHistory and
SatXMPPComponent.receiveHistory to indicate if a component should store sent and received
message in database (they both default to False).

OTR plugin is deactivated for components.

rel 367
2022-06-17 14:15:23 +02:00
Goffi
408dc04ee6 component AP gateway: convert Delete AP activities to corresponding Pubsub retract:
when a `Delete` actity is received, the item is removed from cache, and the corresponding
item `retract` is sent to local XMPP subscribers.

rel 367
2022-06-17 14:15:23 +02:00
Goffi
4e0c1fe7bf comp AP gateway: convert pubsub item retractation to AP Delete activity:
when an item `retract` is received from a node from which an AP actor is subscribed, a
corresponding `Delete` activity is created and sent to AP followers.

Trying to retract an item from a virtual node of the gateway pubsub service now return a
`forbidden` stanza error (those nodes are handled on AP side and thus are not owned by
XMPP entities).

rel 367
2022-06-17 14:15:23 +02:00
Goffi
83a6d475a9 plugin XEP-0060: do not raise an error when not subscribed on unsubscribe:
when an error is received on unsubscribe because user was not subscribed, a warning is
logged, but no exception is raised anymore, as the expected result is reached.
2022-06-17 14:15:23 +02:00
Goffi
5f64ea2bf3 plugin XEP-0191: Blocking Command implementation:
rel 367
2022-05-27 12:12:16 +02:00
Goffi
fa81d96d79 comp AP gateway: message conversion:
Convert direct AP items to XMPP `<message>` stanzas, and vice versa.
Documentation will follow soon to explain the behaviour.

rel 366
2022-05-24 17:57:36 +02:00
Goffi
85911b33d4 plugin invitation: use store hint to be sure that the invitation is archived 2022-05-16 14:20:01 +02:00
Goffi
f4fa679e9c comp file sharing: handle admins in quotas 2022-05-15 14:15:24 +02:00
Goffi
0114769fa4 comp AP gateway: publish, (un)subscribe/(un)follow, public subscription/following/followers:
this patch implements those major features:

- `publish` is implemented on virtual pubsub service, thus XMPP entities can now publish
  to AP using this service
- replies to XMPP items are managed
- `inReplyTo` is filled when converting XMPP items to AP objects
- `follow` and `unfollow` (actually an `undo` activity) are implemented and mapped to
  XMPP's (un)subscribe. On subscription, AP actor's `outbox` collection is converted to
  XMPP and put in cache. Subscriptions are always public.
- `following` and `followers` collections are mapped to XMPP's Public Pubsub Subscription
  (which should be XEP-0465, but the XEP is not yet published at the time of commit), in
  both directions.
- new helper methods to check if an URL is local and to get JID from actor ID

doc will follow to explain behaviour

rel 365
2022-05-13 19:12:33 +02:00
Goffi
436bb119e8 plugin XEP-0277: be sure to have service set in item2mbdata and node when provided
rel 365
2022-05-13 18:50:33 +02:00
Goffi
6a0ca28f45 plugin XEP-0277: bridge method mbIsCommentNode + methods renaming 2022-05-13 18:48:41 +02:00
Goffi
36eb09e53e plugin XEP-0277: fix await trigger incorrectly used on a sync trigger 2022-05-13 18:46:51 +02:00
Goffi
ab2f9661d1 plugin pubsub cache: new resync argument to force resynchronisation in synchronize 2022-05-13 18:44:54 +02:00
Goffi
4e441258b3 plugin pubsub cache: more resilient node caching:
- cache only latest 20 items when disco infos are hidden and thus we can't discover
  feature/RSM implementation
- better handling of args when calling `storage.getItems`

rel 365
2022-05-13 18:43:42 +02:00
Goffi
d20e609a5c plugins XEP-0060, XEP-0376, XEP-0465, CLI: PAM + PSS implementation:
- update psSubscriptionsGet to use serialised return value
- implement XEP-0376 Pubsub Account Management
- implement XEP-0465 Public Pubsub Subscriptions
- CLI `pubsub` commands updated accordingly, and added `--public` flags to `subscribe`,
  `Subscriptions` and `node Subscriptions get`

⚠ `XEP-0465` is speculative, the XEP has been accepted by council but not published yet.
As is should be the next one, and current latest one is `XEP-0464`, `XEP-0465` has been
anticipated.

rel 365
2022-05-13 18:38:05 +02:00