Commit graph

4,708 commits

Author SHA1 Message Date
Goffi
ed66cfd458 git: ignore Sphinx build artifacts 2026-10-01 11:57:10 +02:00
Goffi
13db2e36fa component conferences: Clean stale Galène process if any before launching a new one. 2026-09-23 18:25:38 +02:00
Goffi
bdca7d2354 tools (common/async_process): add a cleaning mecanism:
PID of commands run with `CommandProtocol` are now tracked in memory and stopped/killed on
exit. A `pid_file` argument can be use to track the file on disk, which is useful to
detect stalled processes after a crash/unclean ending of the backend.

Add helper methods to stop and kill those processes.
2026-09-23 18:19:03 +02:00
Goffi
0fbf74aad6 tools (common/template): add brands style in icon definitions:
`brands` is notably needed for the new XMPP icon available in font-awesome.
2026-09-20 12:10:11 +02:00
Goffi
7fed56203b plugin XEP-0277: fix unawaited coroutine. 2026-09-19 18:02:34 +02:00
Goffi
b2bc25657d plugin XEP-0277: fix mb_preview D-Bus signature 2026-09-18 10:19:53 +02:00
Goffi
45024d913e doc (howto backup, cli/backup): document the new backup mechanism:
Add a "How-To" for backup, and document the new `backup` commands

fix 480
2026-09-15 11:48:11 +02:00
Goffi
4ce7c807be tests (backup): add tests for backup engine:
rel 480
2026-09-15 11:48:11 +02:00
Goffi
f22af42ece cli (backup): add backup commands:
Add the `li backup` commands with `export`, `import` and `verify`:

- data types selection (`-i`/`-e`) and profile selection (`-p`), `--no-db` on export, `--use-db` on
  import
- GPG symmetric encryption of the archive (`--encrypt`)
- progression is shown, with ETA
- the commands can run without a backend connection (import from DB MUST be run without
  backend)
- cli (base): `BRIDGELESS_COMMANDS` holds the name of the few commands which can be run
  without backend.

rel 480
2026-09-15 11:48:11 +02:00
Goffi
86a91b5850 tools (backup): add backup/restore:
Add an offline backup/restore engine in `tools.backup`:

- format based on XEP-0227 (pie), extended with Libervia sections
- handle several data types (params, private, roster, pep , gpg, files and db)
- per profile export/import and global handlers
- a manifest is used to have metadata and checksums
- full database snapshot/restore with the `db` type
- sqla: add `get_db_url`
- tools.common.utils: add `is_safe_relpath` and `is_process_running`

rel 480
2026-09-15 11:48:11 +02:00
Goffi
63b3f4dfe2 tests (xep_0272): assert the group setup call in the preparation test 2026-09-15 11:48:11 +02:00
Goffi
7325353d18 plugin XEP-0373, tools: Move GPG backend to tools.common:
GPG backend will be used for backup, and may be used in general to handle GPG.

rel 480
2026-09-15 11:48:11 +02:00
Goffi
18d55242b9 Fix generated path in .gitignore 2026-09-15 11:48:11 +02:00
Goffi
1af645c0f0 plugin XEP-0045, XEP-0402: Update bookmark on room join/leave:
As PEP bookmarks are nowadays used to sync joined state across devices, trigger points
have been added to XEP-0045 so XEP-0402 can automatically update the `autojoin` status on
MUC joining or leaving.

A check has been added to ignore already joined or left room when XEP-0402 plugin updates
the MUC status on bookmark update.
2026-09-15 11:48:04 +02:00
Goffi
2be5d62dfc memory (sqla): add after_uid filter in history_get 2026-08-26 17:55:01 +02:00
Goffi
2f635798ac plugin XEP-0308: better author check:
Check full JID for MUC private messages.
2026-08-25 19:07:06 +02:00
Goffi
7a7a3d8fe4 plugin XEP-0308: check message edit for room messages:
- Reference the stanza-id assigned by the MUC service when correcting.
- Ignore the edit (with a warning) if the original message has no usable id.
2026-08-25 19:07:06 +02:00
Goffi
403b9e9d31 plugin XEP-0308: fix message edit for MUC private messages:
- Keep the destination resource when resending the correction (e.g. `room/nick`).
- Match the corrected message by id (fallback: last message from the sender).
- Ignore corrections that can't be matched, or whose content is already applied (e.g.
  own corrections redelivered by MAM).
2026-08-25 19:02:59 +02:00
Goffi
2cfe6c7a82 tools (common/template): add jid_resource filter 2026-08-25 19:02:59 +02:00
Goffi
de6c050db2 plugin JID Search: Update cutoff ratio + dedup:
- `RATIO_CUTOFF` has been adapted to avoid returning approximate matches.
- In case of duplicate entries (e.g., rooms returned by the local search are also returned
  by the external one), we keep only the item with the most metadata.
- Exclude `None` values in `jid_search` bridge method.
2026-08-24 11:52:53 +02:00
Goffi
1a96c32c45 plugin XEP-0433: Check frontend's allow_external option:
To allow external search, there must now be both the general settings and the
`allow_external` option set by frontend.
2026-08-24 11:43:31 +02:00
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