Commit graph libervia-backend/sat/tools
Author SHA1 Message Date
Goffi
f7fdde6dce tools (utils): fix parse_xmpp_date timezone:
rel 381
2022-10-28 18:47:17 +02:00
Goffi
7f0e230af4 tools (common/async_utils): set default maxsize to 50 in async_lru 2022-10-15 20:37:00 +02:00
Syndace
6d1e942f43 plugin XEP-0373 and XEP-0374: Implementation of OX and OXIM:
GPGME is used as the GPG provider.

rel 374
2022-09-20 16:22:18 +02:00
Goffi
0f20af88f1 tools (stream): log error when a SatFile is closed:
error where only sent on `ProgressError`, but it is necessary to log the error as it may
happen before any progression is started.
2022-10-06 16:02:05 +02:00
Goffi
8444115262 plugin XEP-0384, xml_tools: avoid getItems timeout + fix empty node crash + parsing:
- use `max_items` in `getItems` calls for bundles, as otherwise some pubsub service may
  return full nodes, which may be huge is `max_items=1` is not set on the node, possibly
  resulting in timeouts.

- the plugin was crashing when TWOMEMO devices list node has no items at all. This is not
  the case anymore.

- a naive parsing method has been implemented in `xml_tools` to replace the
  serialisation/deserialisation method. This should be more efficient and will avoid
  annoying `ns0:` prefixes in XML logs.
2022-09-24 16:37:46 +02:00
Syndace
75ae8160ae plugin XEP-0384: Fully reworked to adjust to the reworked python-omemo:
- support for both (modern) OMEMO under the `urn:xmpp:omemo:2` namespace and (legacy) OMEMO under the `eu.siacs.conversations.axolotl` namespace
- maintains one identity across both versions of OMEMO
- migrates data from the old plugin
- includes more features for protocol stability
- uses SCE for modern OMEMO
- fully type-checked, linted and format-checked
- added type hints to various pieces of backend code used by the plugin
- added stubs for some Twisted APIs used by the plugin under stubs/ (use `export MYPYPATH=stubs/` before running mypy)
- core (xmpp): enabled `send` trigger and made it an asyncPoint

fix 375
2022-08-23 21:06:24 +02:00
Goffi
093b9d83bc tools (common/date_utils) handle timestamp and in + delta2human:
regex used to parse datetimes has been improved to handle a unix time (which can be used
with `+ <delta>` or `- <delta>`), and the `in <delta>` (e.g. `in 6 days`).

`DEFAULT_DATETIME` has been removed as dateutil use current date by default, which is the
expected behaviour.

Add `delta2human` method which convert the difference of 2 unix times to a human friendly
approximate text.

rel 372
2022-09-22 00:01:48 +02:00
Goffi
97c0d6a0e5 tools (xml_tools): handle required field in dataDict2dataForm:
rel 372
2022-09-21 22:43:55 +02:00
Goffi
1e4fc213f6 tools (utils): helper parse_xmpp_date method:
This method converts an XMPP date(time) to a unix time

rel 372
2022-09-21 22:29:54 +02:00
Goffi
a74f9327f2 core, CLI (base), tools (common/data_format): typing/core readability 2022-09-21 22:20:43 +02:00
Goffi
672174fb23 tools: renamed module sat.tools.datetime to date.tools.xmpp_datetime to avoid conflict with Python's standard lib 2022-08-31 13:18:56 +02:00
Goffi
ed3660c4a7 tools (datetime, utils): fix incorrect use of naive object:
`tools.datetime.format_datetime` was expecting aware datetime objects while
`tools.utils.xmpp_date` was returning naive datetime objects. A check has been added to
the former one, and latter one has been modified to return aware datetime objects.
2022-08-31 13:11:26 +02:00
Syndace
d1b5ff0c41 plugin XEP-0420: Implementation of Stanza Content Encryption:
Includes implementation of XEP-0082 (XMPP date and time profiles) and tests for both new plugins.
Everything is type checked, linted, format checked and unit tested.
Adds new dependency xmlschema.

fix 377
2022-08-23 12:04:11 +02:00
Goffi
6c170ef8cc plugin XEP-0060, tools (utils): doc/type hints 2022-07-20 17:18:17 +02:00
Goffi
70cfacfe1a tools (common/uri): accept URIs without type:
URIs without type are used to link JIDs.

rel 369
2022-07-09 16:30:37 +02:00
Goffi
1e1da8a7ae core (tools/web): helped method to download files:
this method is for internal file download, progression mechanism is not used.

rel 368
2022-06-29 12:07:45 +02:00
Goffi
8946b6fb4e tools (common/email): use from_email is specified, always set email_sender_domain 2022-05-16 13:03:53 +02:00
Goffi
7d6c2eb6f2 tools (async_trigger): fix return value in asyncReturnPoint + typing hints 2022-05-13 18:19:56 +02:00
Goffi
d3b81a7fa9 tools (common/template): fix setting of css_files_noscript when css_file is specified 2022-03-22 17:00:42 +01:00
Goffi
3ee5e1bbba tools (utils): fix getRepositoryData crash:
- use `hg_path` to be sure to use the right executable
- better exception handling
2022-03-22 17:00:42 +01:00
Goffi
e393c908b0 tools (xml_tools): fix widget_args modification in _dataFormField2XMLUIData:
in `textbox` widget, the first arg was modified with all values, lettings other ones
unchanger, resulting in invalid number of arguments. This has been fixed by replacing all
args with the new value.
2022-01-31 18:35:52 +01:00
Goffi
9b5d3ea17d tools (common): new async_utils module with an async version of lru_cache 2022-01-25 17:25:10 +01:00
Goffi
03ca0037f3 tools (xml_tools): implement list-multi in _dataFormField2XMLUIData:
`list-multi` was missing and thus these data form field type was not supported, resulting
in those fields shown as a text field.

Due to legacy, current implementation use a hack to split values, this should be fixed
later by using proper serialisation.
2021-12-08 15:45:57 +01:00
Goffi
7b05d97229 merge bookmark 0.9 2021-12-01 16:13:31 +01:00
Goffi
9eecdc184c tools (common/async_process): use parent environment by default 2021-11-30 17:28:42 +01:00
Goffi
50d7cb2a51 merge bookmark @ 2021-09-08 11:20:37 +02:00
Goffi
adad4494c3 tools (common/uri): fix uri parsing for Python 3.9+ 2021-09-08 11:14:47 +02:00
Goffi
fe502fc0fc merge branche "@" 2021-08-28 15:32:58 +02:00
Goffi
547eb9feba bridge: bridge can now be set using environment variable:
The `LIBERVIA_BRIDGE_NAME` environment variable can now be used to specify the bridge to
use. If set and different from empty string, the environment has precedence over config
file value.

For `pb` bridge, the following environment variable can also be used:

- LIBERVIA_BRIDGE_PB_CONNECTION_TYPE
- LIBERVIA_BRIDGE_PB_HOST
- LIBERVIA_BRIDGE_PB_PORT
2021-08-28 15:26:02 +02:00
Goffi
436696f28c merge branche "@" 2021-08-27 14:51:40 +02:00
Goffi
506368275a tools (common/date_utils): parse now alone (when used without relative delta) 2021-08-27 14:48:38 +02:00
Goffi
cb62511fa7 tools (common/async_process): remove useless encoding + use full path for command:
- arguments don't need to be encoded anymore, `spawnProcess` handles str directly now
- use full path even for first argument: even if first argument should be only executable
  name, it appears that using full path only in `command` is not enough (seen with Python
  where system installation is used instead of the VirtualEnv one when full path is not
  used as first argument).
(grafted from 25cbaf04772855cd8aead18771465a4f00f5fa03)
2021-07-29 22:51:01 +02:00
Goffi
60fe49f883 tools (common/async_process): remove useless encoding + use full path for command:
- arguments don't need to be encoded anymore, `spawnProcess` handles str directly now
- use full path even for first argument: even if first argument should be only executable
  name, it appears that using full path only in `command` is not enough (seen with Python
  where system installation is used instead of the VirtualEnv one when full path is not
  used as first argument).
2021-07-29 22:51:01 +02:00
Goffi
aab8a38836 tools (common/date_utils): accept more units (shortcuts) + fix timezone when date with relative delta is used 2021-07-29 22:51:01 +02:00
Goffi
4421eefbf3 merge changes from main branch 2021-06-17 13:05:58 +02:00
Goffi
7adbf3ead8 core, frontends: fix invalid translatable strings.
Some f-strings where used in translatable text, this has been fixed by using explicit
`format()` call (using a script based on `tokenize`).

As tokenize messes with spaces, a reformating tool (`black`) has been applied to some
files afterwards.
2021-06-14 18:35:12 +02:00
Goffi
80ee158daa tools (common/template_xmlui: add multi and value propertied to OptionsWidget 2021-06-04 14:44:33 +02:00
Goffi
893e8e7a96 tools (utils): new ensure_deferred decorator 2021-06-03 15:21:43 +02:00
Goffi
a5f225e1ea core (memory/storage): backend storage is now based on SQLAlchemy 2021-06-03 15:20:47 +02:00
Goffi
3c12c4f797 component file sharing (management): add values of quota and used size on result form 2021-05-05 15:37:33 +02:00
Goffi
6e6bc64eab tools (async_trigger): new asyncReturnPoint method 2021-05-05 15:37:33 +02:00
Goffi
4e36667134 tools (common/utils): new methods to parse and generate file size with symbols:
- `parseSize` lets parse a size which can be either a int, or a string with a symbol like
  `Mio`
- `getSizeMultiplier` returns a tuple of size with it's multiplier symbol
- `getHumanSize` returns a string with size and adapted multiplier.
2021-05-05 15:37:33 +02:00
Goffi
af053c5f34 tools (common/date_utils): fix date_only for short, long and full format 2021-05-01 18:36:13 +02:00
Goffi
2596f7ae77 tools (common/regex): move code to make user friendly URLs from web frontend 2021-04-16 18:32:44 +02:00
Goffi
839aea4e2b tools (xml_tools): new findAncestor method:
this methods help to find a `domish.Element` ancestor with specific name/namespace
2021-03-27 14:35:07 +01:00
Goffi
e39783de7f tools (config): show a warning when no config file has been found + don't use hardcoded filename in fixConfigOption 2021-03-20 20:42:07 +01:00
Goffi
018d09caaa Renamed the project from "Salut à Toi" to "Libervia":
This renaming follows the decision taken at the General Assemblee of January 27th 2021 (cf.
https://repos.goffi.org/sat_docs/raw-file/tip/association/2021-01-27%20-%20compte%20rendu%20de%20l%27AG%20extraordinaire.pdf)
2021-03-20 20:42:04 +01:00
Goffi
dc86957043 date update 2021-03-19 15:45:14 +01:00
Goffi
591b9fe8bc tools (common/template): new fallback settings:
`fallback` can be used to change fallback behaviour. By default, fallback is done on
`default` theme, this can be set to an other theme with a string, or to a list of
fallback. The list can also be empty is no fallback is desired (notably usefull for "main"
themes, on which other themes may fallback).

This setting replaces `css_default_fallback`.
2021-03-19 14:01:52 +01:00
Goffi
bd779e8ddd tools (image): fix bad method name used when fix_orientation is set in resize 2021-03-19 14:01:51 +01:00