Commit graph libervia-backend/sat/plugins
Author SHA1 Message Date
Goffi
c68eb151ec plugin file sharing management: added a fileSharingDelete method 2020-06-19 15:39:32 +02:00
Goffi
348ca4d2cb plugin list of interests: added id to data + fixed key conflict:
fixed conflict between interest namespace and files namespace.
2020-06-19 15:38:17 +02:00
Goffi
c2788fea50 plugin list of interest: new "interestRetract" method 2020-06-19 15:37:02 +02:00
Goffi
762f96acb2 plugin XEP-0050: some modernisation + adHocSequence:
improved code by reordering imports, adding some type hints, using standard dict instead
of OrderedDict, etc.

New sequence method/adHocSequence bridge method allow to easily send a sequence of data to
a well known ad-hoc node.
2020-06-19 15:35:45 +02:00
Goffi
86aaf35b60 comp file sharing: file paths are now quoted on upload to allow unicode 2020-06-19 14:56:45 +02:00
Goffi
9f9a6a5a2b plugin list of interest: expose interestsRegisterFileSharing to bridge + use coroutines 2020-06-09 06:25:20 +02:00
Goffi
47edb01bd3 comp file sharing management: fixed confirmation check 2020-06-09 06:23:37 +02:00
Goffi
87298f8a19 comp file sharing: handle upload with headers:
`Xmpp-File-Path` can now be used to specify file path, and `Xmpp-File-No-Http` when file
must not be served publicly by HTTP.
2020-06-09 06:23:01 +02:00
Goffi
4ecdb41695 comp file sharing: CORS:
- added CORS headers to allow using the HTTP server from an other domain
- added `Content-Security-Policy`
2020-06-09 06:21:23 +02:00
Goffi
43466029ab plugin XEP-0363: register namespace 2020-06-09 05:59:14 +02:00
Goffi
e712981938 plugin XEP-0363: fixed fileHTTPUploadGetSlot 2020-06-09 05:58:57 +02:00
Goffi
ca655f01a8 component file sharing: don't initialise the plugin if not component use it 2020-06-01 11:15:16 +02:00
Goffi
5a14c5aebd plugin comp file sharing: files can now be uploaded/downloaded via HTTP:
plugin XEP-0363 can now be used by components, and file sharing uses it.
The new `public_id` file metadata is used to serve files.
Files uploaded are put in the `/uploads` path.
2020-05-29 21:55:45 +02:00
Goffi
d1521dde4b core (memory/sqlite): new database schema (v9):
this new schema brings the new `public_id` column, which will be used to serve files via
HTTP, splits `mime_type` in 2 (`media_type` and `media_subtype`) to make indexing/media
filtering easier, and fixes indexes for `files` table.
2020-05-29 21:50:49 +02:00
Goffi
8da309e51e plugin XEP-0300; fixed use of calculateHash with getHasher 2020-05-29 21:06:10 +02:00
Goffi
4fdf49f4cb plugin XEP-0054: don't use cache anymore in getAvatar:
caching is now handled by plugin identity.
2020-05-19 18:34:06 +02:00
Goffi
771e40dad5 plugin identity: fixed update in avatarSetPostTreatment 2020-05-19 18:34:05 +02:00
Goffi
7438f4218e plugin identity: fixed infinite loop on nicknames update 2020-05-18 23:52:34 +02:00
Goffi
234bbcbdd5 plugin XEP-0231, XEP-0264: fixed some remaining encoding issue following Python 3 port 2020-05-18 23:39:41 +02:00
Goffi
abbd14484b plugin XEP-0060: fixed payload parsing in sendItem 2020-05-18 23:38:21 +02:00
Goffi
9780bd3480 plugin pubsub schema, tools (common/template xmlui): use a JID for publisher:
- a JidWidget is used instead of text for publisher, nothing is set if publisher attribute
  doesn't exist
- added missing JidWidget implementation in tools.common.template_xmlui
2020-05-18 23:37:04 +02:00
Goffi
a693f9f53e plugin list of interest: fixed wrong variable used in a log 2020-05-18 23:31:55 +02:00
Goffi
81650a8ed4 plugin identity: fixed update when cached data is None 2020-04-20 14:51:58 +02:00
Goffi
2591e8e444 plugin XEP-0054: SVG images can now be uploaded for avatars. 2020-04-19 16:40:34 +02:00
Goffi
678adcb697 plugin identity: fixed update with get_all + better new data detection for avatar:
- when metadata doesn't exist, update with `get_all` set doesn't crash anymore.
- fixed avatarUpdateIsNewData
2020-04-19 16:38:46 +02:00
Goffi
88072e0453 core, frontends: avatar refactoring:
/!\ huge commit

Avatar logic has been reworked around the IDENTITY plugin: plugins able to handle avatar
or other identity related metadata (like nicknames) register to IDENTITY plugin in the
same way as for other features like download/upload. Once registered, IDENTITY plugin will
call them when suitable in order of priority, and handle caching.

Methods to manage those metadata from frontend now use serialised data.

For now `avatar` and `nicknames` are handled:

- `avatar` is now a dict with `path` + metadata like `media_type`, instead of just a string
  path
- `nicknames` is now a list of nicknames in order of priority. This list is never empty,
  and `nicknames[0]` should be the preferred nickname to use by frontends in most cases.
  In addition to contact specified nicknames, user set nickname (the one set in roster) is
  used in priority when available.

Among the side changes done with this commit, there are:

- a new `contactGet` bridge method to get roster metadata for a single contact
- SatPresenceProtocol.send returns a Deferred to check when it has actually been sent
- memory's methods to handle entities data now use `client` as first argument
- metadata filter can be specified with `getIdentity`
- `getAvatar` and `setAvatar` are now part of the IDENTITY plugin instead of XEP-0054 (and
  there signature has changed)
- `isRoom` and `getBareOrFull` are now part of XEP-0045 plugin
- jp avatar/get command uses `xdg-open` first when available for `--show` flag
- `--no-cache` has been added to jp avatar/get and identity/get
- jp identity/set has been simplified, explicit options (`--nickname` only for now) are
  used instead of `--field`. `--field` may come back in the future if necessary for extra
  data.
- QuickContactList `SetContact` now handle None as a value, and doesn't use it to delete the
  metadata anymore
- improved cache handling for `metadata` and `nicknames` in quick frontend
- new `default` argument in QuickContactList `getCache`
2020-04-14 21:00:33 +02:00
Goffi
68a4d8ea98 core (memory/persistent): fixed "items", added "all" + "adel" to LazyPersistentBinaryDict:
- `items` was returning the dict with all values, it now returns a Deferred with actual dict items()
- `all` new method does return the dict with all values (in a Deferred)
- `adel` has been added to LazyPersistentBinaryDict
2020-04-14 20:36:24 +02:00
Goffi
e573f7f627 plugin android: use certifi SSL root certicates 2020-04-01 22:28:50 +02:00
Goffi
bd94d2620d plugin XEP-0384: fixed /omemo_reset + device ID type:
- the workflow done with /omemo_reset is now using the right methods
  (encryptRatchetForwardingMessage and decryptRatchetForwardingMessage)
- fixed type error with device when calling python-omemo methods: a mix of str and int
  was leading to two caches being created, and random bugs
2020-03-30 19:59:17 +02:00
Goffi
cabaa16279 plugin XEP-0384: OMEMO trust policy:
OMEMO trust policy can now be specified. For now there are 2 policies:

- `manual`: each new device fingerprint must be explicitly trusted or not before the
  device can be used, and the message sent
- `BTBV` (Blind Trust Before Verification): each new device fingerprint is automically
  trusted, until user manually trust or not a device, in which case the behaviour becomes
  the same as for `manual` for the entity. When using the Trust UI, user can put the
  entity back to blind trust if they wish.

A message is send as feedback to user when a new device is/must be trusted, trying to
explain clearly what's happening to the user.

Devices which have been automically trusted are marked, so user can know which ones may
cause security issue.
2020-03-27 10:02:14 +01:00
Goffi
240c62903d plugin XEP-0384: added resetTrust in OmemoSession 2020-03-27 09:55:16 +01:00
Goffi
2f8902e0d6 core (memory/encryption): automatic start encryption if peer send encrypted message:
If peer sends encrypted message and we have no encryption activated, we automatically
start encryption to avoid sending plain text message when answering.

markAsEncrypted now needs the encryption algorithm namespace as mandatory argument.
2020-03-23 17:52:18 +01:00
Goffi
900daa7ad9 core (memory/encryption): encryption session are now restored on client connection 2020-03-22 18:39:12 +01:00
Goffi
ddf8cf6ea7 plugin attach: handle large images resizing:
if `C.MESS_KEY_ATTACHMENTS_RESIZE` flag is set for an attachment, it will be checked, and
if it is a large image, a resized copy will be uploaded.
2020-03-22 14:04:16 +01:00
Goffi
cdf468a7c1 plugin aesgcm: wait for each splitted message to be sent before sending next one 2020-03-22 14:01:47 +01:00
Goffi
06516eeb1d plugin attach, aesgcm: attachments refactoring:
attachment handling has been simplified, and now use a "register" method similar as the
ones used for download or upload.
A default method (for unencrypted messages) will try a simple upload and will copy the
links to body.

AESGCM plugin has been adapted to be used for encrypted files. If more than one file is
sent with AESGCM plugin, they will be split in several messages as current de-facto
standard (OMEMO media sharing) doesn't support several files per message.
2020-03-18 20:25:02 +01:00
Goffi
4ccd859b62 plugin XEP-0384: added "/omemo_reset" text command:
this command will delete all sessions with peer entity, and send empty message to trigger
a new key exchange.
2020-03-18 19:56:05 +01:00
Goffi
f7fb2dd238 plugin text commands: handles coroutines + better command parsing:
- async coroutine can now be used for text commands (in addition to Deferred and regular
  callbacks)
- isidentifier is now used to detect a command, allowing to use "_" in command names
- if message starts with a single `/`, it is never sent (previously it could be sent is
  some corner cases)
- don't use OrderedDict anymore as dict now keep insertion order by default
2020-03-13 17:50:08 +01:00
Goffi
1faa5e82da plugin XEP-0384: use "max_items=1" for devices and bundles nodes:
- max_items = 1 is requested with publish-options when publishing the bundle or the
  devices list. If the constraint is failed, a warning will be shown, and the publication
  will be done without this option
- fixed return values when devices list is badly formed
2020-03-11 20:44:49 +01:00
Goffi
d1abda6ddb plugin XEP-0060: async sendItems + precondition-not-met policy:
- sendItems is now an "async" coroutine, and sendItem use it instead of duplicating
  publication logic
- policy to use when a precondition is not met (with publish-options) can now be
  specified, for now it's either raise the exception (default policy), or try to publish
  without the options
- constants have been added to handle "extra" keys
2020-03-11 19:15:48 +01:00
Goffi
0ce6d6d841 plugin download: clean unfinished files and re-raise exception in case of download error 2020-03-06 18:19:03 +01:00
Goffi
1883dbd3ab plugin download, aesgcm: disable TLS check if check_certificate setting is disabled 2020-03-06 18:19:03 +01:00
Goffi
4c474efb3d plugin attachment: remove "path" from attachment once used:
"path" refers to a local path of a file, we don't want to store it in database as the file
may be in a temporary location, or even be a temporary file. So once the file has been
uploaded, we remove it.
2020-03-06 18:19:03 +01:00
Goffi
143dd9bc0a plugin XEP-0054: fixed use of current dir instead of empty string 2020-03-01 18:33:16 +01:00
Goffi
7924b601ab core (constants): renamed MESS_KEY_MEDIA_TYPE to MESS_KEY_ATTACHMENTS_MEDIA_TYPE 2020-02-29 16:55:22 +01:00
Goffi
5a9886d390 plugin attach: disable TLS check if "check_certificate" is disabled 2020-02-28 10:06:23 +01:00
Goffi
f71b40f86f plugin download: use cache if dest_path is empty:
if dest_path is not set, the file will be downloaded in cache. A new name will be
generated using a hash of the uri. If the file is already downloded in cache, it won't be
downloaded again (in this case returned progress_id is an empty string).
2020-02-26 22:03:11 +01:00
Goffi
c16dd25fc9 plugin download, aesgcm: fixed handling of HTTP errors 2020-02-26 15:54:43 +01:00
Goffi
12fc57062d memory (cache): purge + pathlib:
- cache is now purged on backend startup (every file which has passed EOL will be deleted)
- use of pathlib, getPath now returns a Path
2020-02-26 15:54:43 +01:00
Goffi
c5915d1dcb plugin attach, XEP-0363: progress id can now be specified:
progress id can be specified in options, using the "progress_id" option, this can be
more handy for frontends to keep track of attachments progresses.
2020-02-23 17:48:26 +01:00