Commit graph libervia-backend/libervia/backend/core/constants.py
Author SHA1 Message Date
Goffi
2af29e7999 doc (configuration): update (and rewrite for TOML):
- Configuration is now made with TOML, and the documentation was outdated. It has been
  rewritten for TOML, and autodoc is used to show configuration options available in code
  (and keep it up-to-date).
- New isolation mode is documentated.
- (core/constants): fix the `tmp` isolation mode to inherits the parent configuration like
  `normal`.
2026-11-03 18:02:05 +01:00
Goffi
2f0c1d4818 core: reject dashes in isolation instance names:
To avoid confusion and hard-to-debug behaviours, `-` are now rejected in isolation
instance names, only `_` is accepted.
2026-11-03 18:02:05 +01:00
Goffi
bd1c93f7d4 memory (cache): add persistent cache entries:
`max_age` can now be `C.MAX_AGE_PERSISTENT` to keep a cache entry indefinitely: its `eol`
is then `None` and no expiration check is done.
2026-10-26 18:36:41 +01:00
Goffi
0c6f852ce9 plugin XEP-0272: update to v0.2.0 + fixes:
- use the proper `urn:xmpp:jingle:muji:0` namespace
- replace XEP-0249 invitations with XEP-0482
- the dedicated `META_TYPE_GROUP_CALL` subtype is now used for the confirm action (instead
  of `META_TYPE_MUC_INVITATION`)
- handle MUJI invitation: on accept, join the room, start preparing and answer with the
  connection method element
- add the `<muji>` element to outgoing Jingle IQs
- propagate the call type (audio/video) in the MUJI invites (the `type` attribute), so the
  invited clients set up the proper local stream
- the joining participant initiates the sessions with the other participants, using their
  real JIDs, extracted from the presence (the room is set non-anonymous for that)
- only trust the `<muji>` element of a `session-initiate` from a member of the room
- add a `call_group_end` bridge method to clean the MUJI session
- typo fix in `META_TYPE_MUC_INVIRATION` (`R` instead of `T`)
2026-10-17 13:43:33 +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
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
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
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
80e5a9e6ac memory (disco): Fix error handling for find_service_entity/find_service_entities:
- Error raised by `disco_info` where not properly handler, resulting in an exception
  instead of appropriate logging and return value.
- `async` coroutines, type hints
2026-04-24 17:38:54 +02:00
Goffi
68da01a043 Dates update. 2026-03-31 12:57:17 +02:00
Goffi
80944e7a62 core (constants): Fix path for hidden config files in $HOME:
Config file can be hidden in $HOME (`~/.libervia.toml`), and the path was wrongly handled
probably following a change to use `Path`.
2026-03-30 11:37:17 +02: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
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
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
53fdaa9d09 Reformatted code base using black. 2024-06-19 18:44:57 +02:00
Goffi
e7d240b7e4 core (main): add a mechanism to have a shared temp directory:
this directory may be used to share files between backend and frontends. Normally, an
os-dependent temporary directory is created for that, but if this option is set, the
directory will be created in <local_dir>/<cache_dir>, which may be useful in some use case
(e.g. containerized frontends and backend).
2024-06-12 22:47:34 +02:00
Goffi
0e23b8c1b0 plugin XEP-0272: implement XEP-0272: Multiparty Jingle (Muji)
rel 429
2024-05-15 17:34:46 +02:00
Goffi
ed7a2fa132 core: Jingle Remote Control implementation:
This is an implementation of the protoXEP that will be submitted to XSF. It handle
establishment of a remote control session, and the management of A/V calls with XEP-0167.

rel 436
2024-05-11 13:52:43 +02:00
Goffi
0ee6a64e3b core (constants): use bool_type:
Using `bool` for type hint in `Const.bool_const` if conflicting with `Const.bool` method.
To avoid this, `bool_type` is used as an alias to `bool`.
2024-04-06 12:14:10 +02:00
Goffi
a804e6a9dc plugin XEP-0234: fix action type when pre-flight file confirmation is confirmed:
the `C.META_TYPE_FILE` can't be used in this case as it is a preflight and we don't have
yet data such as progress ID. `C.META_TYPE_FILE` is used as a sub-type to help with dialog
management in frontend.
2024-03-05 17:31:49 +01:00
Goffi
dc8078fe4c core: use a user specific directory for PID file:
default location of pid file is now specific to logged user, this allow to run several
instances of Libervia by different users on the same machine without PID conflicts.
2024-01-14 17:48:02 +01:00
Goffi
f1cc34cc53 plugin XEP-0050: small code quality improvements + add C.ENTITY_ADMINS magic key to allow administrators profiles 2023-12-10 15:08:08 +01:00
Goffi
6f8230804f core (constants): user platform temporary dir by default for PID files 2023-12-04 17:51:28 +01:00
Goffi
3c35dea8b1 plugin XEP-0424: message retraction update:
- follow specification update (with namespace bump)
- retract from history on message reception for group chat
- send bridge message
2023-11-30 13:23:53 +01:00
Goffi
85cecd3d30 plugin XEP-0308: implement Last Message Correction 2023-11-28 17:38:31 +01:00
Goffi
da5d3dfb86 bridge: add message_update signal 2023-11-22 14:26:13 +01:00
Goffi
40e7440de0 core (constants): accept y and t as True values. 2023-10-18 15:33:34 +02:00
Goffi
b7618e12f7 version: use standard Python's dev0 instead of Libervia specific D for dev version 2023-06-06 12:41:53 +02:00
Goffi
d2685ba11b refactoring: renamed sat package to libervia.backend 2023-06-02 11:49:51 +02:00
Renamed from sat/core/constants.py (Previous history)