Commit graph

4,514 commits

Author SHA1 Message Date
Goffi
a9fa2eeed4 core (main, config): Component auto-configuration:
New `jid`, `secret` and `autoconnect` field are used for component settings. When used,
backend will automatically create the profile and set its relevant parameters, or check
that existing profile is in sync (and update it if necessary).

This make component installation easier to Libervia, as it is not
necessary anymore to use the CLI frontend to install a component.

rel 476
2026-03-30 11:37:17 +02:00
Goffi
51776603e0 depdencies, core: update Tx-XMPP to be version >= 10.0:
This version changes the package name, so all `wokkel` imports habe been replaced by
`tx_xmpp`
2026-03-24 16:42:27 +01:00
Goffi
9fb5912567 install (dependencies): use tx-xmpp from PyPI 2026-03-22 13:18:00 +01:00
Goffi
eaa49911a6 core (xmpp): Don't use Tx-XMPP deprecated attributes:
Some deprecated attribute from `Tx-XMPP` (`Wokkel`) were still used.
This patch also remove some legacy `inlineCallbacks`.
2026-03-21 12:24:39 +01:00
Goffi
78d72304d5 core: bye bye sat_tmp :)
After 11 years of "temporary" monkey patches, I've finally made a friendly fork of Wokkel
at https://www.goffi.org/forge/goffi/tx-xmpp with all needed PRs merged and changes from
`sat_tmp`, using the same license as Wokkel (with agreement from contributors). No more
monkey patching, and it will also stop the deprecation warning due to outdated packages
used in Wokkel. Last but not least, it should unblock the move to the latest Twisted and
Python versions.
2026-03-20 18:32:36 +01:00
Goffi
243aab9cec bridge (pb): Remove existing socket if any:
If the backend was not closed properly, the former socket may still be present. This was
preventing the backend to start again, while now the old socket is removed in this case.
2026-03-19 12:01:21 +01:00
Goffi
04d53ebe10 plugin forge: Check that repository exist before returning counters. 2026-03-18 10:54:59 +01:00
Goffi
bc95840d46 plugin (forge): add bridge methods to handle clone counters:
A counter of clones (i.e.; Git clones as Git is currently the only backend) can be incremented or retrieved.
Counters are stored per day.
2026-03-18 10:42:15 +01:00
Goffi
a405d6c8f7 memory (storage): add get_profile_by_name method 2026-03-17 17:55:03 +01:00
Goffi
ea52ebe434 plugin (XEP-0059): fix max handling:
since the move to the new model, the `_` suffix must not be used any more with `max`.
2026-03-17 16:08:37 +01:00
Goffi
42df19195d config: renamed common.hosts_dict to common.hosts and improved its description 2026-03-14 00:58:08 +01:00
Goffi
f4ca8c52cc core (main): ensure that reactor is running during post initialisation:
In background mode, the reactor is run later, this may cause troubles during some
initialisation. This has notably be seen for PB bridge which was not correctly listening
to the socket.
2026-03-13 22:45:04 +01:00
Goffi
a338bef90d core (constants): Use runtime dir:
PID and PB bridge socket were using temporary directory, but the good practice is to use
XDG_RUNTIME_DIR instead.
2026-03-13 17:16:35 +01:00
Goffi
1cf75f1126 install (dependencies): update miniupnpc and make netifaces optional:
- update `miniupnpc` as latest version have proper wheels, making installation easier.
- `netifaces` is not maintained anymore, and only used optionally in one plugin
  (plugin_misc_ip). It cause troubles during installation because it needs do be build.
  This patch make it optional, and it will probably be removed in the future.
2026-03-13 13:01:03 +01:00
Goffi
c9211fb270 install (pyproject): Remove dbus-python and make pygobject optional:
`dbus-python` is no longer used since the D-Bus bridge is now fully based on txdbus.

As a consequence, `pygobject` is no longer necessary for base features, but still
necessary for webRTC-based features (as we are using GStreamer). Making it optional makes
the installation far easier, as the GLib parts often cause trouble during installation
(mainly because they need local libraries).
2026-03-13 12:08:29 +01:00
Goffi
b69c7e4565 cli (loop): Remove GLib and Twisted related code:
Now that D-Bus has been fully reimplemented with txdbus, GLib is not needed anymore for
D-Bus bridge.
As `dbus` and `pb` (and future other bridges) both support "AIOBridge", we don't have to
use a Twisted specific version for anything.
2026-03-13 11:54:27 +01:00
Goffi
b607b962a8 core (main): fix bridge return value of message_send:
`message_send` was returning message data while the method is declared
with no return value, this was causing issues with some bridges (pb
notably).
2026-03-13 11:38:14 +01:00
Goffi
e82a946123 tools (dynamic_import): add an argument to select bridge type:
If a frontend is using Twisted it must use the `TwistedBridge` instead of `AIOBridge`. A
new argument has been added to let do that.
2026-03-13 11:38:14 +01:00
Goffi
2278002f38 bridge (pb): add TwistedBridge:
`TwistedBridge` is needed for Twisted based frontends (it's the case for
the web frontend).

Regenerated bridges.
2026-03-13 11:38:07 +01:00
Goffi
baab23abe4 bridge (dbus): replace D-Bus implementation:
The D-Bus bridge was the oldest one and using the legacy `dbus-python` implementation. In
addition to be dependent on GLib, this implementation has numerous issues and it's even
recommanded on its own documentation to use alternative.

On the other hand, txdbus is Twisted native D-Bus implementation and can be used natively
with asyncio reactor.

Regenerated bridges.
2026-03-13 11:37:37 +01:00
Goffi
364f365bc7 core (launcher): set AsyncIO reactor in launcher
The reactor is now set in the launcher, as it is the first script to be
loaded. This should avoid race conditions when some Twisted or libervia
packages are imported and end up importing `twisted.internet.reactor`,
which installs the default reactor before the AsyncIO one. The AsyncIO
reactor is still set in `twisted.plugin.libervia_backend_plugin` (but it
no longer fails if already set), in case the backend is started as a
plugin (although this is not recommended anyway)
2026-03-13 10:30:06 +01:00
Goffi
99377fadfc install (pyproject): add a main extra to install essential packages:
`all` install everything, `main` only the essential ones.
Also add some comments to explain what the groups are for.
2026-03-13 10:27:51 +01:00
Goffi
1256e92cec cli (base): Refactor loop handling:
The loop was chosen according to the bridge used, but this is not possible anymore before
running it, because there is now an "auto" bridge which falls back from D-Bus to PB. To
work around that, the loop has been refactored to be started before knowing which bridge
is used, then the bridge-dependent hooks are installed later.
2026-03-13 10:27:51 +01:00
Goffi
30619f5689 bridge (dbus, pb): fix intialisation issues:
- D-Bus bridge check if it can import GLib, to raise early a BridgeInitError if it's not
  possible
- PB bridge now do lazy import of `reactor` to avoid race condition in Twisted loop
  initialisation.
- regenerated bridges.
2026-03-13 10:27:51 +01:00
Goffi
84321be4cc bridge: automatic bridge:
Add a new "auto" bridge which tries D-Bus and fall back to PB in case of problem. This is
the defaut reactor, but can also be explicitely used.
2026-03-13 10:27:51 +01:00
Goffi
0d57c1bbed install: move to uv:
`uv` is now used as the main project management tool. `hatchling` is
currently kept as the build system due to the use of its dynamic
versioning feature and to make the transition easier.

Most fields used are standardised and should work with all modern
packaging tools.

Add `uv.lock` to the repository, as versioning this file is recommended.
2026-03-10 09:43:04 +01:00
Goffi
70c7451467 Transition from Mercurial to Git:
Repository has been converted to Git using fast-export
(https://github.com/frej/fast-export).

The following command has been used:
```sh
$ ../fast-export/hg-fast-export.sh -r ../hg-libervia-backend --hg-hash -M main
```

That means that previous HG hashes are annotated in the `hg` namespace.

`.hgignore` has been converted to `.gitignore`, and `_trial_temp/` has been removed as we
nowadays use `pytest` instead of `trial`.

While Mercurial is a great tool, more and more tools are only compatible with Git (e.g.,
ripgrep), and in particular `uv`, which becomes the new packaging de-facto standard in
Python. Also, many developers are more at ease with Git (even if Mercurial is actually
simpler to use).
2026-03-09 10:07:15 +01:00
Goffi
82e2c6efac apply black to the whole codebase. 2026-03-09 09:22:04 +01:00
Goffi
420df3340d CHANGELOG update 2026-03-09 09:22:02 +01:00
Goffi
c31b6e207c applicactions: fix applications:
This patch fix application configuration parsing. Peertube and Weblate can be started
again.
2026-03-04 15:49:47 +01:00
Goffi
f17fee4802 plugin forge/git: Implement diff retrieval:
Add models and parser to get diff from commits or branch references.
2026-03-04 12:32:48 +01:00
Goffi
48d197459a plugin forge: add tickets to settings:
Those settings are used to set the tickets node.
2026-03-04 12:32:48 +01:00
Goffi
9e10176914 plugin XEP-0060: cast types of plugins used internally. 2026-03-04 12:32:48 +01:00
Goffi
df2a9ba8e8 plugin android: only media on Android only:
Importing `media` on desktop was causing trouble as it may not be installed.
2026-02-24 09:43:32 +01:00
Goffi
3cf38d138e doc (cli/contacts): Add documentation for contacts:
describe the new `contacts` commands to handle pubsub contacts.

fix 475
2026-02-23 13:15:16 +01:00
Goffi
b4a13ce51e tests (unit): Add tests for pubsub contacts:
Tests the models and plugin data behaviour.

rel 475
2026-02-23 13:15:16 +01:00
Goffi
1a0cc787f8 cli (contacts): add commands to handle pubsub contacts:
Add commands to retrieve (`contacts get`) and set (`contacts set`) pubsub contacts. As
they are managed with pubsub node, deletion can be done using `pubsub delete`.

rel 475
2026-02-23 13:15:16 +01:00
Goffi
55e16c3db5 plugin pubsub contacts: Implementation of the new contacts handling XEP.
This patch implements Pubsub Contacts (currently named "End-to-End Encrypted Contacts
Metadata" but it will be most probably renamed soon as following council discussion, e2e
encryption won't be mandatory anymore).

It adds 2 bridge method `ps_contacts_get` and `ps_contact_set`, and handles retrieving
large contacts or groups lists using RSM.

rel 475
2026-02-23 13:15:16 +01:00
Goffi
0bc56134ad plugin XEP-0473: Decrypt items events when received:
The items events need to be decrypted too for plugin to handle correctly items updated or
retracted. When an event is decrypted, and `encrypted` attribute is added to the decrypted
<item> elements.

rel 475
2026-02-23 13:15:14 +01:00
Goffi
c21ac3af16 plugin XEP-0060: add_managed_node now do strict matching by default:
`add_managed_node` now match node when they are exactly the same by default, but if the
new `strict_match` argument is set to `False`, the old behaviour of matching all node
which start with the given `node` argument is used.

rel 475
2026-02-23 13:07:59 +01:00
Goffi
ad409de6a5 core (xmpp, core_type): SatXMPPEntity can now handle plugin data:
2 new methods `get_plugin_data` and `set_plugin_data` let plugin register data for a given
profile session (i.e. client instance). This is the clean way to handle plugin data
(instead of the former way of adding custom attribute to `client` instance), and it uses
generics so type hints are working correctly with linters.
2026-02-23 13:07:53 +01:00
Goffi
8805f63b1f plugins XEP-0473, XEP-0475, XEP-0477: rename plugins from prototype name to XEP number + doc update:
Plugin for pubsub encryption and signing were named using prototype name as the
specifications where not yet published at the time. Since, those specifications have been
accepted, so we can rename those plugins using the corresponding XEP numbers.

Doc has been updated to remove old mention saying that the XEP was still being evaluated.

rel 475
2026-02-23 12:56:42 +01:00
Goffi
1745f1e520 plugin XEP-0373: refactor and implement python-gnupg backend:
- split the plugin in several classes, with models, exceptions, and backends separated.
- add a backend for `python-gnupg`, as it can be pip installed without having to use
  `--system-site-packages` in the virtual environment.
- use modern syntax for type hints.

rel 475
2026-02-23 12:56:42 +01:00
Goffi
314b741cf6 plugin XEP-0060: fix extra passing when publishing an item. 2026-02-23 12:56:42 +01:00
Goffi
2b9b4e6bbf Convert data to JSON when using JSON output:
`output` with JSON was expecting a JSON str, this patch change it to use the `data`
argument, so a python object is given and converted to JSON
2026-02-23 12:56:36 +01:00
Goffi
c297da7ec9 plugin (forge, forge_git): forge plugin first draft:
This plugin implements the base for the forge feature in Libervia.

The "forge" plugin introduces configuration to set repositories to expose with the forge
(per profile), and the default repository to show.
In the future, this may be done dynamically from frontends, so users can create/import
repositories themselves.

The "forge_git" plugin implements methods to handle Git repositories. In the future, other
types of repositories may be managed (e.g.; Mercurial), but for now the focus is on Git.
2026-02-18 17:49:36 +01:00
Goffi
c46f0716dc tools (common/async_process): Accept bytes as stdin 2026-02-18 17:44:26 +01:00
Goffi
77e2c9ce11 plugin (android): add missing import. 2026-02-18 17:44:23 +01:00
Goffi
fa937e3e67 core(launcher): Force exit on early exception:
The backend was not properly exiting in case of early exception (e.g. configuration
error). It seems to be related to the use of the `@aio` decorator, but couldn't find the
exact issue with loop. The use of `os._exit` is a workaround for now, until the fix is
inspected more deeply and properly fixed.
2026-02-18 17:37:52 +01:00
Goffi
919cafc68c Update use of media_dir following change in Libervia Media:
Libervia Media is now a Python package instead of files to put in a directory to specify
in settings. The discovery is now automatic, removing the need for settings and enabling
easier installation. Furthermore, it should now work even if the package is zipped.
`libervia_media` can now be specified as a dependency for frontends requiring it.
2026-01-13 10:57:19 +01:00