Commit Graph

167 Commits

Author SHA1 Message Date
JC Brand
5a710e4601 Add new sponsor BairesDev 2023-06-05 16:53:49 +02:00
JC Brand
48e7987f38 Start work on removing constants from _converse object 2023-03-03 17:28:26 +01:00
JC Brand
fb054c40be Experimenting with avoiding importing the converse global 2023-03-03 17:28:26 +01:00
JC Brand
885a3d92b5 Move private API to own file 2023-02-26 18:10:01 +01:00
JC Brand
9a63629b40 Get rid of lodash's isFunction 2023-02-26 18:10:01 +01:00
JC Brand
dcfc0d50f4 Refactor shared API functions out into src/headless/shared/api 2023-02-26 18:10:01 +01:00
JC Brand
3530ccc35d Add initial TypeScript support and declaration files 2023-02-23 09:38:11 +01:00
JC Brand
85181053e6 Make the role form a custom element
So that it can be used in the occupant modal as well.
2023-02-21 23:14:16 +01:00
JC Brand
15c10376b0 Rename all templates to camelCase
To conform with naming conventions regarding functions, which the
templates are.
2023-02-15 14:29:07 +01:00
JC Brand
0fcdb2a594 Add-hoc form fixes
- Provide actions as received in the Ad-Hoc form
- Add support for multi-stage ad-hoc forms
- Add new tests for multi-stage forms

Fixes #2240
2023-02-14 11:51:35 +01:00
JC Brand
5029d93523 XML stanza parsing fixes
- Add a `Stanza` class which can be used by Strophe because it has a
  `tree()` function. This is what gets returned by the `stx` tagged
  template.

- Throw an error when no valid namespace is on the stanza.
    Strophe.Builder used to automatically add the `jabber:client` namespace,
    but that doesn't happen with `toStanza`, so we need to fail if it's not
    specified by the user.

- Use the Strophe XML Parser
    This opens the door to NodeJS support
2023-02-14 11:50:38 +01:00
JC Brand
7539fc1a6f Move functions out of src/headless/core.js into utils 2022-12-28 21:36:40 +01:00
JC Brand
f740332e95 Fixes based on Github's code scanning results 2022-12-28 21:14:15 +01:00
JC Brand
fdcab413f5 Use crypto.randomUUID() if available 2022-12-28 11:49:37 +01:00
JC Brand
6494b34da3 Don't automatically log in again if the user manually logged out
Fixes #2759
2022-12-28 09:57:32 +01:00
JC Brand
447fe8ba08 Refactor the code related to storing SCRAM keys
- No need to create a new storage mechanism, just use `persistent`.
- Store SCRAM keys per JID
- Upon succesfull login, store the current session JID, so that we know who to fetch SCRAM keys for
- Only store SCRAM keys when the device is trusted

Fixes #3001
2022-12-28 09:56:41 +01:00
based-a-tron
8ab0b718de Added option to save SCRAM keys 2022-12-27 22:39:12 +01:00
JC Brand
eb9fd74c77 Provide error message instead of aesm URL
when encrypted media cannot be decrypted because it can't be downloaded.
2022-10-23 11:56:59 +02:00
JC Brand
e555469e3f Move clearSession function to utils 2022-09-29 14:26:54 +02:00
JC Brand
f1cc8c85f4 Rename the stanza TTL to stx to avoid name clashes 2022-08-11 15:30:51 +02:00
JC Brand
fe9345b7fc MUC: only allow corrections with a matching sender occupant-id
Also, don't render messages from a sender with a different `occupant-id`
as a followup message.
2022-08-10 14:53:18 +02:00
JC Brand
d2bdce51e8 Add a tagged template literal function stanza
For creating XML stanzas from template literals.
2022-08-10 14:50:12 +02:00
JC Brand
71d1383604 Move code that sets active flag on session to initSession
It doesn't belong in the `converse-status` plugin and the event handler
doesn't get registered when all CSI-related timeouts are set to 0.
2022-07-25 11:59:25 +02:00
JC Brand
4d9c0d3f9a Also check for body 2022-07-12 09:05:28 +02:00
JC Brand
ab7e879261 Don't automatically convert OpenStreetMap URLs into geo: URIs in sent messages
Updates #1850 and #2914
2022-05-13 10:14:31 +02:00
JC Brand
0a07cad2cb Move connection api into separate file 2022-04-25 09:48:08 +02:00
JC Brand
6b1845ff39 Release 9.1.0 2022-04-02 19:31:37 +02:00
JC Brand
c3933426b9 Refactor checkFileTypes
- Don't check the protocol in `checkFileTypes`, it should be doing one
    thing only, and that is check whether the URL ends with a particular
    file extension.
- Raise an error when a URI object can't be created from the passed in URL

Adds new function `isAllowedProtocolForMedia` which checks whether the
URL points to a file on the file system (`file:`), is in a Chrome
extension or uses HTTPs.

Use that in `shouldRenderMediaFromURL` to filter out URLs that shouldn't
be rendered.

Re-add utility methods to the `u` object so that 3rd party plugins can
use them.
2022-03-29 19:41:16 +02:00
Keith Maika
be561addfa Fix endless loop of adding .png to image URL. 2022-03-29 19:08:39 +02:00
JC Brand
fca275b7c9 Refactor the login form
Render the form based on `api.settings` instead of its own model.

When the login form is submitted, save the JID, password and connection
URL to `api.settings`.

Set the `service` on the Strophe connection object just before
connecting for the first time, otherwise a user supplied URL (via the
login form) is never used.

New API setting: show_connection_url_input
2022-03-24 23:15:30 +01:00
JC Brand
d2622f6fed Fixes #2557
Add the ability to send OMEMO corrections.

Refactor how OMEMO messages are sent to avoid having to override
`sendMessage` and thereby also allowing corrections of OMEMO messages to
be sent out.

Add two new hooks.
- getOutgoingMessageAttributes
- createMessageStanza
2022-03-13 10:02:34 +01:00
JC Brand
d3fa925bff Move reconnection code to Connection class
And avoid calling `tearDown` twice
2022-02-02 13:53:05 +01:00
JC Brand
46a5a64dda Set id on MUC join presence
This is necessary for the Bifrost Matrix-XMPP bridge
2022-01-25 13:07:03 +01:00
JC Brand
c3aafdf341 Fix TypeError and remove tab 2021-12-17 20:55:52 +01:00
Dele Olajide
ee4ab47442 corrected as advised 2021-12-16 15:44:43 +01:00
Dele Olajide
4bb4f932cf fix #2751 - Media not rendered when Converse runs in a browser extension 2021-12-16 15:44:43 +01:00
JC Brand
b16d035975 Move setUserJID to init.js 2021-12-10 22:57:33 +01:00
JC Brand
bad2577e5e OMEMO Refactoring
When calling `getDeviceList`, wait for the devices to be fetched

Otherwise a race condition might occur, whereby a new device gets
created in the collection, and then removed again as the collection is
replaced with the values fetched from the browser-storage cache.

Also created `converse-omemo-fingerprints` component to asynchronously
render fingerprints in the user details modal. Was done as part of this
commit because due to `getDeviceList` being async, the relevant test for
the modal were also failing
2021-11-24 21:14:11 +01:00
JC Brand
366932e999 Allow render_media setting to be an array of domains
This allows for more flexibility in configuring which media URLs will
automatically render and which media URLs may be manually rendered by
the user (via the message actions dropdown).

For example, suppose you want to automatically render all media URLs
from https://xmpp.org, but still allow other media (which won't render
by default) to be rendered manually by the user (by clicking the "Show
URL previews" message dropdown action).

In this case, you set `render_media` to `['xmpp.org']` and
`allowed_image_domains` to `null` or `undefined`.

Or if you want to automatically render images from xmpp.org, and
restrict the domains users might manually click to render, you can add
those extra domains to `allowed_image_domains`.
2021-09-30 16:30:30 +02:00
JC Brand
1809e38911 Move isUniView function to utils 2021-09-29 12:03:21 +02:00
JC Brand
efafc2d691 Allow media to be invidually shown/rendered...
even if the global configuration is to disallow it.

* When parsing, include all media URLs, not just the ones from allowed domains.
  That makes it possible to change allowed domains on-the-fly,
  while still allowing media in individual messages to be shown manually
  (via the message actions dropdown).
* Merge `embed_audio`, `embed_video` and `show_images_inline` into `render_media`
* Create new config settings for allowable domains for images, video and audio
* Check the URL domain against a whitelist for the message actions dropdown
2021-09-21 17:08:30 +02:00
Ariel Fuggini
d44abbb48e
Adds hook to fetchLoginCredentials function (#2640)
* Adds hook to fetchLoginCredentials function

* Adds documentation
2021-09-10 16:12:46 +02:00
JC Brand
906a606010 Get rid of unnecessary specificity and functions 2021-09-09 11:35:00 +02:00
JC Brand
b78c19f6f2 Fix showing of HTML5 notifications for MEP messages 2021-09-08 17:30:30 +02:00
JC Brand
8854f67c20 Bugfix: Image previews not loading when not serving Converse locally
Fixes #2634
2021-09-06 20:00:01 +02:00
JC Brand
f739b9d37d Fix encrypted images not showing inline.
Updates #1182 #2554
2021-08-24 20:03:04 +02:00
JC Brand
0ccf25d986 Add support for controlling (e.g. pausing, looping) gifs
- Create new component `converse-gif`
- Draw gif in canvas and add controlls
2021-07-23 19:31:43 +02:00
JC Brand
60826ac6c6 Move functions out of core.js 2021-07-19 16:40:40 +02:00
JC Brand
b90a435833 Move url related utility methods to @converse/headless 2021-07-05 18:35:58 +02:00
JC Brand
7848d8cb2f Add support for decrypting XEP-0454 OMEMO media 2021-06-25 09:24:18 +02:00