Commit graph

3,802 commits

Author SHA1 Message Date
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
0bd68d0e62 core (memory/sqla): generic get + session_add in delete:
new generic `get` allow to retrieve an ORM object with given column and value, and
optionally join load attributes.

In `delete`, it is now possible to specify instances to add to session, this allow, to
update them in the same transaction. It is also now possible to specify a list of object
to delete them all in the same transaction.

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
53ca566a9d core (memory/mapping): add origin_id column to History + constraints update:
- `origin_id` is added as a column instead of being just in extra, as it an important data
to filter on.
- Add some constraints.
- Add `serialise` method to Message and Subject.
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
441ae82fcb core (constants): type hints 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
5ecca19b71 doc (components): typo/spelling 2022-06-17 14:15:23 +02:00
Goffi
60dcb5d396 doc (cli/blocking): blocking command documentation:
rel 367
2022-06-17 14:15:23 +02:00
Goffi
ab0739c35f cli: new blocking commands:
commands to list blocked entities, block or unblock one or more entities

rel 367
2022-05-27 12:15:04 +02:00
Goffi
5f64ea2bf3 plugin XEP-0191: Blocking Command implementation:
rel 367
2022-05-27 12:12:16 +02:00
Goffi
5191343a40 doc (components): message delivery documentation:
fix 366
2022-05-24 17:57:41 +02:00
Goffi
4c28917466 test (unit/AP gateway): AP direct message ↔ XMPP <message> conversion:
test that AP direct messages are converted to XMPP `<message>` stanzas instead of pubsub
items.
test that XMPP `<message>` stanzas are converted to AP direct messages (i.e. items
addressed solely to the recipient, without *followers* or *public* collections).

rel 366
2022-05-24 17:57:39 +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
72ec311ef1 tests (unit/ap_gateway): fix tests 2022-05-24 17:49:14 +02:00
Goffi
c8df7104eb core (memory): fileDelete is now async, fix coroutine issue 2022-05-16 14:37:58 +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
8946b6fb4e tools (common/email): use from_email is specified, always set email_sender_domain 2022-05-16 13:03:53 +02:00
Goffi
d0973d121d core: remove useless method (it's available directly in client) 2022-05-16 13:02:59 +02:00
Goffi
f4fa679e9c comp file sharing: handle admins in quotas 2022-05-15 14:15:24 +02:00
Goffi
c8025a52eb core: method to know if a profile/entity is an admin:
the new `is_admin` SatXMPPEntity property tell if it's an administrator.

Admin JIDs are retrieve on init, so they can be looked after when profle is not available
(notably when a component handle a request and has only a JID available). The new
`memory.isAdminJID` method is then used.
2022-05-15 14:14:52 +02:00
Goffi
9564647b21 doc (installation): sat_media is now libervia-media 2022-05-14 23:00:35 +02:00
Goffi
975cfdcf76 install (setup): fix urwid-satext version 2022-05-14 22:48:35 +02:00
Goffi
f96d703098 doc (installation): fix missing hg clone instructions 2022-05-14 22:35:39 +02:00
Goffi
92cc11b137 install: requirements.txt update 2022-05-14 22:34:13 +02:00
Goffi
a59ddef97c doc (components): update AP gateway documentation:
add documentation for:
    - Publishing an Item
    - Following, Subscribing and Cache
    - Following/Followers Collections and Public Pubsub Subscription

fix 365
2022-05-13 19:34:12 +02:00
Goffi
f66f602df2 doc (cli/pubsub): document new --public flags:
`--public` option is documented for `subscribe`, `subscriptions` and `node subscriptions
get`, with examples. A warning has been added to show explicitely the privacy implication
of using `--public` with `subscribe`.

rel 365
2022-05-13 19:32:06 +02:00
Goffi
4d3f5f1afa tests (unit/ap-gateway): tests for following/followers <=> PPS:
AP following/followers collections to XMPP Public Pubsub Subscriptions conversion is
checked in both directions.

rel 365
2022-05-13 19:29:17 +02:00
Goffi
fca541a2f1 tests (e2e/cli/cache_search): make the test more resilient:
the caching is triggered by `li.blog.get`, but it is done in parallel without blocking the
command, thus there is a possibility that the data is not yet in cache when the following
test is done.

A loop with delay is done, to be sure that cache is filled before doing the assertion.
2022-05-13 19:27:21 +02:00
Goffi
5b85ebfcb7 docker (prosody-e2e): update Prosody's conf:
Due to mod_privilege and PAM implementation in Libervia Pubsub, permissions have been
udpated in `prosody.cfg.lua`, with the new `iq` permission and namespace delegation needed
for PAM.

`"urn:xmpp:delegation:2:bare:disco#info:*"` namespace delegation was also missing.

rel 365
2022-05-13 19:24:38 +02:00
Goffi
f0a0575f68 docker (backend-dev): move dbus unix socket:
there seem to be a regression with Docker: the volume is not propagated anymore with
pre-existing files when a unix socket is inside.

This is the case in `backend-dev` with the D-Bus unix socket put in
`/home/libervia/.local/share/libervia/dbus_socket`, when the volume is mounted at
`/home/libervia/.local/share/libervia/`, resulting in hard to debug failures.

To work around that, the socket is not put in the volume mount point anymore, and has been
moved to `/home/libervia/.local/share/`
2022-05-13 19:21:17 +02:00
Goffi
0f5e74efb6 docker (backend-dev/libervia.conf): don't force CLI background anymore:
CLI background autodetection has been fixed and should not crash anymore, thus this
workaround is not needed anymore.
2022-05-13 19:16:56 +02:00
Goffi
da7a90abd2 CLI: don't fail when calling getContacts with a component profile 2022-05-13 19:15:30 +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
Goffi
feee36791b plugin XEP-0060: use serialised options in psSubscribe + triggers update 2022-05-13 18:29:42 +02:00
Goffi
24a1355686 plugin XEP-0060: better filtering when looking for default pubsub service 2022-05-13 18:22:06 +02:00
Goffi
7d6c2eb6f2 tools (async_trigger): fix return value in asyncReturnPoint + typing hints 2022-05-13 18:19:56 +02:00
Goffi
c678f1f993 core (memory/sqla): searchPubsubItems can now filter on item names 2022-05-13 18:02:37 +02:00
Goffi
75684953be core (memory/sqla): add attribute to filter on item_ids in getItems 2022-05-13 17:58:51 +02:00