Commit Graph

100 Commits

Author SHA1 Message Date
JC Brand 5a710e4601 Add new sponsor BairesDev 2023-06-05 16:53:49 +02: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 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 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
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 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 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
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 1809e38911 Move `isUniView` function to utils 2021-09-29 12:03:21 +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 60826ac6c6 Move functions out of core.js 2021-07-19 16:40:40 +02:00
JC Brand 2c0fbec43c Move arraybuffer utility methods into their own file 2021-06-24 18:57:32 +02:00
JC Brand 58d96c8594 Use intersection observer to remember scrolling position 2021-06-03 18:24:55 +02:00
JC Brand 3d58b67517 Use `@converse/openpromise` 2021-04-28 18:35:08 +02:00
JC Brand 7b7ec45db8 Move disco plugin into folder and import lodash utilities separately 2021-04-21 11:03:22 +02:00
ubermanu 3bfd60a3df Move the httpToGeoUri util into core 2021-03-25 09:08:39 +01:00
JC Brand c855d2f4ce Updates #2350 Avoid bundling Strophe twice
by not importing Strophe outside of @converse/headless
2020-12-10 16:32:01 +01:00
JC Brand f86efca9a6 autocomplete: Use regex instead of hardcoded list...
to determine valid characters to form a boundary before an `@` mention

Also fixed an issue with mentions looking like they're part of URLs, by
first processing mentions separately.
2020-11-27 22:06:22 +01:00
Xavi Ferrer 8b9c97745f Allow selected characters to precede a mention 2020-11-27 14:12:29 +01:00
JC Brand 7aee9c4432 muc: simplify `api.rooms` methods.
- Let `api.rooms.open` call `api.rooms.get` directly, instead of indirectly via `api.rooms.create`
- Remove the `createChatRoom` function
- Also strip URI parts from JID in `api.rooms.get` and use utility method for doing so
2020-10-07 15:31:13 +02:00
Xavi 86c04b876b
Allow mention autocomplete to trigger right after a new line (#2267)
* catch all whitespace characters instead of just new line
2020-10-07 11:05:18 +02:00
JC Brand 6d9752645f Replace lodash methods with native ones
filter
find
has
isEmpty
isString
isUndefined
noop
reject
uniq
2020-10-01 12:56:00 +02:00
JC Brand 0ca2e5ae08 Remove need for lodash templates in headless build 2020-09-26 09:58:34 +02:00
JC Brand b0cb489769 Use @converse/skeletor, lodash-es and latest webpack-dev-server 2020-06-08 19:38:16 +02:00
JC Brand dd7bb28d86 Report traceback when `waitUntil` times out 2020-06-05 15:49:18 +02:00
JC Brand 9f7b6d6fa1 Fixes #2035 2020-06-03 10:56:38 +02:00
JC Brand 1ff6ced3ab Don't override initialization settings via api.settings.update
This is a problem that could occur when calling converse.initialize twice
2020-06-03 09:15:35 +02:00
JC Brand 7651d58470 Render chat messages as web components
- Render chat content as a <converse-chat-content> component
- Create new component for rendering the message body
- Get rid of `showMessage` method
2020-06-01 09:53:19 +02:00
JC Brand b5eea12d49 Refactor so that message attributes are parsed early
It's better to parse an incoming message stanza early, than to have
all kinds of methods throughout the codebase that does querySelector
etc.

Firstly, it allows us to catch and report errors and malicious stanzas early on.
It also simplifies programming because you don't need to try and
remember how to properly parse a stanza, all the work is done upfront
for you.
2020-04-27 16:34:37 +02:00
JC Brand 6391cc0803 Rename applyUserSettings to applySiteSettings 2020-03-31 14:08:34 +02:00
JC Brand 631b9bb438 Use the settings API for setting and getting config settings
This is an initial step towards no longer storing and accessing settings
directly via the `_converse` object
2020-03-31 11:57:03 +02:00
JC Brand b5d57f0ef8 Handle and render chat state notifications separately from messages 2020-03-21 17:21:53 +01:00