Commit graph

4,687 commits

Author SHA1 Message Date
Goffi
912ffd4e8b plugin XEP-0054: Fix missing await 2026-08-24 11:24:25 +02:00
Goffi
14dbca530b plugin XEP-0313: check message origin:
Check that "from" attribute of the forwarded message is coming from the service.
2026-08-18 18:48:04 +02:00
Goffi
93ce4112f8 plugin identity: Use Pydantic models:
Use Pydantic models for data used with bridge.
Also update `backend.models.core.DiscoIdentity` to have `None` as possible and default
value for `name`.
2026-08-14 14:53:46 +02:00
Goffi
a3cc29ca3c cli (debug/monitor): Add timestamp to XML logs. 2026-08-12 18:12:02 +02:00
Goffi
dc9e3e98d5 plugin XEP-0045: Use disco as fallback for is_room:
If a room was not joined (e.g., due to failure), `is_room` was wrongly returning `False`.
Disco identity is now used as fallback to detect correctly is an entity is a room or not.
This changes makes `is_room` async, and by extension `get_bare_or_full` too.
2026-08-12 18:10:51 +02:00
Goffi
e5781641f3 plugin XEP-0045: Fix use of empty string for nicks:
If empty string is used for nick in `join` (e.g., due to a bridge call), take use part of
the JID. This fix the use of empty resource, which was resulting in rejection by the
server.
2026-08-12 18:02:14 +02:00
Goffi
25a491d7f0 plugin identity: Raise timeout:
5s timeout is too short, if the server is overloaded or connection is slow, it makes the
identity retrieval fail. 15s is more reasonable and matches timeout used for disco.
2026-08-12 17:57:13 +02:00
Goffi
1bfc7bd10b plugin XEP-0313: fallback to last N items in case of missing item:
If a reference item is missing (e.g., after server purge) we now fallback to last N items
(50 for now), instead of giving up.
2026-08-10 12:02:47 +02:00
Goffi
ad397e9705 plugin XEP-0199: fix typo 2026-07-22 02:27:10 +02:00
Goffi
b88d335d92 memory (sqla): Get original message in thread in history_get:
When using `thread_id` filter, original message could be missing (notably with a reply).
We now include it with `History.uid == filters["thread_id"]`.
2026-07-21 19:13:37 +02:00
Goffi
4b235fc86b core (xmpp): Prevent non printable message to be displayed:
We now use `client.is_message_printable` to check if message is printable. If it's not, we
block storage in DB and sending to bridge. The previous code could let message pass if
metadata were stored in `extra`.
2026-07-21 19:11:17 +02:00
Goffi
b384c6bb8f app manager (weblate): Update images:
Update image to run on latest version, pin PostgreSQL to v18, and remove the now
deprecated `version` field.
2026-07-21 11:52:22 +02:00
Goffi
33132827f3 cli (application): new update command:
Update an application, or all of them.
2026-07-21 11:50:20 +02:00
Goffi
6b4f7252e3 plugin app manager, app manager docker: update implementation:
A new `application_update` bridge method is added to easily update images. Running
container are automatically updated if necessary.
2026-07-21 11:50:20 +02:00
Goffi
6119c37c0f plugin app manager docker: add support for Podman:
Podman can be used as a drop-in replacement for Docker, and it doesn't need root
permissions. The plugin now has a settings to use Podman, and use `auto` by default which
will choose the first found on the device (Podman is tested first).
2026-07-21 11:50:20 +02:00
Goffi
feae9ff38d plugin app manager docker (peertube): update image:
`chocobozzz/peertube:production-bookworm` is outdated, moving to
`chocobozzz/peertube:production` to avoid up-to-date versions.
2026-07-19 14:51:09 +02:00
Goffi
53a83b6042 doc (cli/serverless): serverless commands documentation:
Document the commands `discover` and `info`.

fix 479
2026-07-17 23:27:47 +02:00
Goffi
e013f9ba66 cli (serverless): New serverless commands:
New `serverless` commands. For now only `discover` and `info` are implemented:

    - `discover` find other peers on LAN
    - `info` get various infos on serverless status (for now, our own device ID,
      advertised service name, and the number of found peers)

rel 479
2026-07-17 23:27:47 +02:00
Goffi
2ae02c8e4a plugin serverless: first draft, peer discovery on LAN:
Implement peer discovery on LAN using mDNS (via `zeroconf`).
A Peer ID is generated (via `libP2P`) per instance, and announced on backend startup.
Meanwhile, other peers are discovered on LAN. A signal is send on peer found and another
on peer lost.

There a bridge methods to find already discovered peers, and to get infos on serverless
(our own ID, adverised service name, and number of peers found).

`Zeroconf` runs in background in its own thread.

rel 479
2026-07-17 23:27:47 +02:00
Goffi
e05c69267d core (main, xmpp): fix cleaning methods:
Cleaning methods per-profile (`profile_disconnected`) and per-plugin (`unload`) were not
called correctly. They are now called on shutdown with the `before/shutdown` Twisted
event.
With this event, it's still possible to call Deferred and do cleaning requiring async
calls.

rel 479
2026-07-17 23:27:47 +02:00
Goffi
a539c21f9d plugin XEP-0060: fix exception on _node_cb modification:
Due to the yielding, `_node_cb` could be modified during node event management, resulting
in an exception. The items are now shallow copied to avoid issue.
2026-07-17 23:27:47 +02:00
Goffi
831f1ad78b install: add libp2p and zeroconf dependencies for the new serverless extra:
`libp2p` will used for implementing serverless features, `zeroconf` for LAN discovery.
Lock file has been updated.

Note: `libp2p` is currently not compatible with Python 3.14 (cf.
https://github.com/libp2p/py-libp2p/issues/1100 )

rel 479
2026-07-17 23:27:47 +02:00
Goffi
f7a42771e8 core: implement isolation mode:
Normally the backend is made to have a singleton instance, and handle all profiles.
However, it may be useful to run instances independently (e.g., for development, to run
components in independent processes, for testing, etc).

This was previously possible by using a specific configuration files at backend's root.
This patch introduce a cleaner way by using an isolation mode.

Isolation mode is activated by settings the `LIBERVIA_ISOLATION` environment variable to
the name of the isolated instance. `LIBERVIA_ISOLATION_MODE` can be used to specify one of
the following mode:
- normal (default): config and shared files are in XDG in a `isolated/<name>` subdirectory
  (usually `~/.local/share/libervia/isolated/<name>` and
  `~/.config/libervia/isolated/<name>`). Runtime files and other instance specific data
  (such as D-Bus name) are also isolated. Config uses cascade as usual.
- full: same as above, but config isn't cascading, it's using only its own isolated config
  file.
- tmp: same as normal but the local directory is put in a temporary directory, and deleted
  on backend startup. It stays on termination, so data can be checked if necessary (this mode is
  usually used for development).

This feature will notably be useful to test severless mode on a single machine.

rel 479
2026-07-17 16:45:29 +02:00
Goffi
c6f390df3c test: minor formatting 2026-07-17 16:45:29 +02:00
Goffi
92cb52dd04 plugin XEP-0363, upload: compute hash on file upload:
- Hash (SHA-256) is now automacally computed when a file is uploaded via XEP-0363, and
  used if no hash has been specified by frontend already.
- Use named tuples (`UploadTracking` and `UploadResult`) to handle callback values.
- upload: fix a bug (missing variable) in `unregister` (which is not used yet anyway).
- usual docstring/type hints improvements
2026-07-09 17:13:37 +02:00
Goffi
dbc3973642 plugin XEP-0447: handle deferred sources:
XEP-0447 allow to send sources after the original message. Dino is doing that, and thus we
can't display attachment immediately with only the original message.

This patch handle that by updating the original message once the sources are received, and
emitting a `message_update` signal to notify frontends.
2026-07-09 17:13:37 +02:00
Goffi
88ba99acd0 core (types): Fix type hint for mess_id2uid 2026-07-09 17:13:37 +02:00
Goffi
14a50673a1 plugin XEP-0300: Fix hash encoding and use StrEnum for hashes:
- Fix the wrong encoding of the hash hex string value instead of the binary value.
- Use a `StrEnum` for model, use models specified in XEP-0414.
- Minor typing hint/docstring improvments.
2026-07-09 17:13:37 +02:00
Goffi
7b2afd238b core (xmpp): make client.encryption a property to make pyright happy 2026-07-09 17:13:37 +02:00
Goffi
5e89f1661e memory (disco): handle remote-server-timeout in get_infos errback:
`remote-server-timeout` is treated like `remote-server-not-found`.
2026-07-09 17:13:37 +02:00
Goffi
31296c6108 plugin XEP-0447: Mutiple-files support:
- multiple-files support now that the XEP has them. The legacy message compatibility layer
  is implemented too, with the new `message_sent` trigger for 1:1, and with follow-up
  messages sent on message echo for MUC.
- usual modernisation (type hints, `get_plugin_data`)
- (core) new `message_sent` trigger point
2026-07-09 17:13:37 +02:00
Goffi
a214ba6fe3 plugin XEP-0367: "Message Attaching" implementation 2026-07-09 17:13:37 +02:00
Goffi
46e0e3b582 core (xmpp): make message_parse an async trigger point 2026-07-09 17:13:37 +02:00
Goffi
5e272710f3 plugin XEP-0066: "Out of Band Data" implementation 2026-07-09 17:13:37 +02:00
Goffi
1b747b6ee1 plugin XEP-0447: fix wrong element used during parsing 2026-07-09 17:13:37 +02:00
Goffi
33f9554b94 plugin XEP-0264: Convert image to RGB if there is transparency:
JPEG doesn't support transparency, which was resulting in exception if a preview of an
image with transparency was made. This is now checked, and the image is converted if
necessary.
2026-07-09 17:13:37 +02:00
Goffi
ebe072dbd4 memory (disco): fix incorrect use of await 2026-07-09 17:13:37 +02:00
Goffi
7696afb3d8 core: uid is now set in extra in client.sendMessage:
By setting `uid` in extra, it can now be specified by frontends.
2026-07-09 17:13:37 +02:00
Goffi
5ed83ae9e3 plugin XEP-0085: Modernisation:
- Async coroutines, type hints
- Use client plugin data instead of per-profile dict
- Detect chat state availability with disco queries
- Better spec compliance
2026-07-02 15:35:23 +02:00
Goffi
7d2d97fa75 plugin XEP-0045: Notification on mention:
If a mention is detected in a MUC (`groupchat`, not DM), a notification is sent.
2026-06-26 23:03:24 +02:00
Goffi
b65325c1d6 plugin XEP-0084: Support multiple images format:
XEP-0084 implementation was only supporting PNG, but some client (notably Conversations)
don't publish PNG, so we have to handle a few other formats.
2026-06-21 12:52:57 +02:00
Goffi
e241075a34 core: Unseen message counter:
This patches add handling for unseen messages counter, and last message received. The
counters are retrieved from DB on startup, they updated in-memory. Frontend are expected
to have their own in-memory counter too, the backend one is used for re-sync (e.g.; on page
reload).

Bridge methods are added to retrieve the state, and indicate which message has been seen
last by user. A signal is sent on counter reset to all frontends can synchronise.

This is currently local only, but it should be compatible with a future XEP-0490 (Message
Displayed Synchronization) implementation.
2026-06-20 15:11:06 +02:00
Goffi
a909d99fa9 plugin XEP-0374, XEP-0384: use debug instead of warning logs:
Those cases are expected on semi-anonymous rooms, thus a warning is inappropriate.
2026-06-20 15:06:55 +02:00
Goffi
09848498cd plugin XEP-0373: Fix local exceptions shadowing core.exceptions 2026-06-20 10:48:16 +02:00
Goffi
7107d64a5b sqla (mapping): fix missing PEP constraint:
A constraint name was missing on the `PubsubNode.pep` column, resulting in a crash when
trying to generate the initial database on launch with an empty `local_dir`.

Migration script introducing the column (f4cb5fc600c7_add_missing_pep_check_constraint.py)
has been updated too. Another migration script has been made to add the constraint to
existing DB (only if they are missing).
2026-06-20 10:27:51 +02:00
Goffi
de13f16791 plugin XEP-0045: fix early return in availableReceived blocking room join:
On room join, the room object is created before the server's self-presence arrives.
`_getRoomUser()` thus returns `user=None` for the initial presence, which led to
`super().availableReceived(presence)` not being called, resulting in wrong typing of the
room and the room not really being joined.
2026-06-19 14:12:42 +02:00
Goffi
8bc3b4156a doc (component): the section use a . now 2026-06-19 12:14:54 +02:00
Goffi
cf225eee83 core (constants): fix XDG config path:
The config path was using `APP_NAME` instead of `APP_NAME_FILE`, resulting in `Libervia`
(with uppercase `L`) used instead of `libervia`.
2026-06-19 12:10:14 +02:00
Goffi
34ecf8b22e plugin XEP-0084: refactor get_avatar:
`get_avatar()` was checking the cache directly, bypassing `plugin_misc_identity`'s
`use_cache` flag. As a result, cache disabling was ineffective. It now fetches from the
PEP node and doesn't handle the cache anymore.

`_parse_metadata_info()` has been added to factorize the metadata parsing.
2026-06-09 16:12:39 +02:00
Syndace
5d9f2d2da9 plugin XEP-0384: code cleanup and failure tracking 2026-06-08 14:26:15 +02:00