Commit graph libervia-backend/libervia/backend/tools/common
Author SHA1 Message Date
Goffi
836a9c962e tools (common/uri): Modernization + more flexible URIs:
- Remove Python < 3.9 workaround
- Type hints + docstring update
- Accept `kwargs` when `type_` is `None`.

rel 477
2026-06-06 12:23:06 +02:00
Goffi
68da01a043 Dates update. 2026-03-31 12:57:17 +02: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
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
82e2c6efac apply black to the whole codebase. 2026-03-09 09:22:04 +01:00
Goffi
c46f0716dc tools (common/async_process): Accept bytes as stdin 2026-02-18 17:44:26 +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
Goffi
c4c3b5bd7c update templates handling folling changes in Libervia Templates 2025-12-19 22:43:20 +01:00
Goffi
4fda71eeec config: remove web settings as they are now in web frontend. 2025-12-15 11:43:11 +01:00
Goffi
6a7b7bc36a core: Replace legacy INI config system with Pydantic-based TOML configuration.
This is a huge configuration refactoring.

The configuration system now uses Pydantic settings, with better validation, better
support for environment variables and other goodies.

The main config files now use TOML instead of INI, this allow for better handling of
complex types, notably dict.

Plugins, components and frontends can declare their config settings in a class which will
be imported dynamically.
2025-11-30 12:27:35 +01:00
Goffi
8c35f015f1 tools (common/uri): fix missing f for f-string. 2025-10-10 17:44:04 +02:00
Goffi
96bf3af324 Global reformatting with black. 2025-09-13 10:46:10 +02:00
Goffi
3dbd990902 backend: various fixes, and type hints improvments. 2025-08-03 23:36:22 +02:00
Goffi
0f42421804 template: Add initials filter. 2025-04-11 18:19:17 +02:00
Goffi
ce5ba7123b template: fix name handling for icons. 2025-04-11 18:18:50 +02:00
Goffi
2a0f4e28f8 component email gateway: convert autocrypt header:
Autocrypt header must be transmitted in both directions to allow opportunistic end-to-end
encryption with this protocol.

Moved email validation regex to `tools/common/regex.py`, as it can be used in other
locations.

rel 456
2025-02-28 09:23:35 +01:00
Goffi
da51288c7a tools (common/template), cli (call/gui): use font-awesome instead of fontello:
following change in Libervia Media, code has been updated to use font-awesome now instead
of fontello.
2024-10-26 22:42:17 +02:00
Goffi
a4f494ac70 plugin XEP-0106, tools (common/email): type hints. 2024-09-06 17:44:08 +02:00
Goffi
17ae6ba241 tools (common/async_process): accept Path instances as command path. 2024-06-20 14:47:09 +02:00
Goffi
53fdaa9d09 Reformatted code base using black. 2024-06-19 18:44:57 +02:00
Goffi
594112fed1 tools (common/data_objects): set attachments url from sources if missing. 2024-06-12 23:06:10 +02:00
Goffi
4fb87fb4c1 tools (common/async_process): show command and arguments used in error message in case a failure. 2024-05-31 11:08:23 +02:00
Goffi
de7260bfb9 backend, frontend: prepare remote control:
This is a series of changes necessary to prepare the implementation of remote control
feature:

- XEP-0166: add a `priority` attribute to `ApplicationData`: this is needed when several
  applications are working in a same session, to know which one must be handled first.
  Will be used to make Remote Control have precedence over Call content.
- XEP-0166: `_call_plugins` is now async and is not used with `DeferredList` anymore: the
  benefit to have methods called in parallels is very low, and it cause a lot of trouble
  as we can't predict order. Methods are now called sequentially so workflow can be
  predicted.
- XEP-0167: fix `senders` XMPP attribute <=> SDP mapping
- XEP-0234: preflight acceptance key is now `pre-accepted` instead of `file-accepted`, so
  the same key can be used with other jingle applications.
- XEP-0167, XEP-0343: move some method to XEP-0167
- XEP-0353: use new `priority` feature to call preflight methods of applications according
  to it.
- frontend (webrtc): refactor the sources/sink handling with a more flexible mechanism
  based on Pydantic models. It is now possible to have has many Data Channel as necessary,
  to have them in addition to A/V streams, to specify manually GStreamer sources and
  sinks, etc.
- frontend (webrtc): rework of the pipeline to reduce latency.
- frontend: new `portal_desktop` method. Screenshare portal handling has been moved there,
  and RemoteDesktop portal has been added.
- frontend (webrtc): fix `extract_ufrag_pwd` method.

rel 436
2024-05-11 13:52:41 +02:00
Goffi
5bf34b4744 core: update pygobject version and replace deprecated configparser.SafeConfigParser 2024-05-11 13:16:13 +02:00
Goffi
e8fb0a8a28 plugin XEP-0353, XEP-0234, jingle: WebRTC data channel signaling implementation:
Implement XEP-0343: Signaling WebRTC Data Channels in Jingle. The current version of the
XEP (0.3.1) has no implementation and contains some flaws. After discussing this on xsf@,
Daniel (from Conversations) mentioned that they had a sprint with Larma (from Dino) to
work on another version and provided me with this link:
https://gist.github.com/iNPUTmice/6c56f3e948cca517c5fb129016d99e74 . I have used it for my
implementation.

This implementation reuses work done on Jingle A/V call (notably XEP-0176 and XEP-0167
plugins), with adaptations. When used, XEP-0234 will not handle the file itself as it
normally does. This is because WebRTC has several implementations (browser for web
interface, GStreamer for others), and file/data must be handled directly by the frontend.
This is particularly important for web frontends, as the file is not sent from the backend
but from the end-user's browser device.

Among the changes, there are:

- XEP-0343 implementation.
- `file_send` bridge method now use serialised dict as output.
- New `BaseTransportHandler.is_usable` method which get content data and returns a boolean
  (default to `True`) to tell if this transport can actually be used in this context (when
  we are initiator). Used in webRTC case to see if call data are available.
- Support of `application` media type, and everything necessary to handle data channels.
- Better confirmation message, with file name, size and description when available.
- When file is accepted in preflight, it is specified in following `action_new` signal for
  actual file transfer. This way, frontend can avoid the display or 2 confirmation
  messages.
- XEP-0166: when not specified, default `content` name is now its index number instead of
  a UUID. This follows the behaviour of browsers.
- XEP-0353: better handling of events such as call taken by another device.
- various other updates.

rel 441
2024-04-06 12:57:23 +02:00
Goffi
e14dd9da8b core: add new init_script_path option:
`init_script_path` option can be used in `[DEFAULTS]` to run a script at the end of
backend initialisation. A new `init_pre_script` method is used to wait for backend to
reach this stage (designed to be used mostly by CLI frontend), then the usual `ready_get`
method is finished once the script is finished.
2023-12-13 22:00:22 +01:00
Goffi
ff5c2e0ea5 plugin ad-hoc registration: Implement plugin to handle registration links:
registration links are used in web frontend to allow registration with secret links when
it's normally closed.
2023-12-10 18:32:04 +01:00
Goffi
ee4caf8ee7 template: add a bare_jid filter 2023-11-28 17:41:49 +01:00
Goffi
39dc28fedf tools (common/data_objects): expose message's extra field. 2023-11-22 15:11:25 +01:00
Goffi
5d8334061b tools (common/data_objects): handle messages without body 2023-08-08 23:49:36 +02:00
Goffi
173519a630 tools (common/template): add filter to get media types:
Add 2 filters to get main type and subtype of media type. Jinja2 and Nunjucks don't handle
slices in the same way (Python way for Jinja2, JS way for Nunjucks), making it difficult
to retrieve main type of a media from media type. Thoses filters work in both cases.
2023-06-22 15:49:06 +02:00
Goffi
fd53fb537e tools (common/data_objects): add attachments in Message 2023-06-22 15:47:17 +02:00
Goffi
fbf72390da tools (common/template): allow use of extra attributes in icon function 2023-06-08 21:28:26 +02:00
Goffi
735822ab74 tools (common/date_utils): update date parsing regex:
the regex `<timestamp> + 30 minutes` was not parsed correctly, this update should fix it.
2023-06-08 21:27:12 +02:00
Goffi
85c1457054 tools (common/data_objects): fix import of Markup following change after Jinja2 version bump 2023-06-08 21:26:09 +02:00
Goffi
620f89f589 tools/common (template): add id argument to _icon_use 2023-06-07 22:26:54 +02:00
Goffi
7c6a675435 installation: moved from setup.py to pyproject.toml:
- updated installation to use the now standard `pyproject.toml` instead of legacy
`setup.py`. `setup.py` and other legacy files have been deleted.
- removed outdated README4PACKAGERS
- removed pylintrc which has not been correctly reviewed. Linter conf should go to
  `pyproject.toml` now.
- [hatch](https://hatch.pypa.io) is now used as main building tool. However, thanks to the
use of standards, other tools can be used too.
- update .hgignore
- several dependencies version bump, with code update to adapt to changes.
2023-06-06 16:45:16 +02:00
Goffi
fd16770c19 refactoring: rename libervia.frontends.jp to libervia.cli 2023-06-02 14:54:26 +02:00
Goffi
4ab9bd7bc8 refactoring: rename sat_frontends to libervia.frontends 2023-06-02 14:12:38 +02:00
Goffi
d2685ba11b refactoring: renamed sat package to libervia.backend 2023-06-02 11:49:51 +02:00