Germain Souquet
cb91c4292c
Merge branch 'develop' into gsouquet/pr-review-linting-rules
2021-05-27 16:00:12 +01:00
Germain Souquet
5caf05cfa1
Apply new linting rules
2021-05-11 11:25:43 +01:00
Matthew Hodgson
977682d37f
fix lint
2021-03-08 09:24:25 +00:00
Matthew Hodgson
0bafe263d7
fix lint
2021-03-08 05:05:14 +00:00
J. Ryan Stinnett
09bd91a588
Enforce logger module via lint rules
...
This adds lint rules (and fixes various errors) to ensure we use the `logger`
intermediary module, rather than accessing the console directly.
2020-10-01 14:28:24 +01:00
Will Hunt
5447d99481
If there are extraParams set, ensure that queryParams is defined
2020-09-23 14:06:39 +01:00
Jorik Schellekens
0f559050d8
Fix whitespace issues
2020-07-21 10:00:16 +01:00
Bruno Windels
6b4fefc123
move fn to http-api and add jsdoc
2020-04-23 15:32:40 +02:00
Bruno Windels
668e8f6f24
exclude aborted requests and matrix errors when creating connectionerror
...
- throw an AbortError when aborting is detected
- don't turn AbortError's into a ConnectionError
- also consider the string "aborted" an AbortError for unit tests
- unit tests like to reject the request with a MatrixError,
so exclude those too
2020-04-23 15:18:52 +02:00
Bruno Windels
50febaf477
throw ConnectionError when request fails
2020-04-23 13:37:10 +02:00
Bruno Windels
907f317b04
cleanup: use class for MatrixError
...
this way we get stacktraces as well
2020-04-23 13:36:40 +02:00
Travis Ralston
95164d08d5
Remove v1 identity server fallbacks
...
Fixes https://github.com/vector-im/riot-web/issues/10443
**Review with https://github.com/matrix-org/matrix-react-sdk/pull/4191 **
2020-03-09 17:06:10 -06:00
Jack Works
468fb2cc41
chore: remove custom promise, use es6 standard
...
Signed-off-by: Jack Works <jackworks@protonmail.com >
2020-01-23 19:23:08 -07:00
Jack Works
7c79e7e836
fix: typos
...
Signed-off-by: Jack Works <jackworks@protonmail.com >
2020-01-23 19:21:19 -07:00
Travis Ralston
f952f6742f
Remove ancient "use strict" annotations
...
We don't need these anymore. Theoretically this commit could go to develop, but for safety it's going to `travis/sourcemaps` first.
2019-12-17 15:43:02 -07:00
Travis Ralston
d3ce0cb82f
Convert src to ES6
...
The bulk of this is just export/import changes, though there's a couple pieces to highlight:
* We no longer use default exports. This is because it's discouraged by the JS community, though not in any official capacity.
* We now use `polyfillSuper` for some prototype inheritance because the tests, and sometimes webpack, break on "cannot call EncryptionAlgorithm without 'new'". It's very much a workaround, and definitely not needed when we use real classes.
There is some import shuffling to help keep the imports clean - this was done by my IDE.
2019-12-17 15:14:22 -07:00
Michael Telatynski
9faab093f7
delint
2019-12-02 22:34:46 +00:00
Michael Telatynski
733008cfc4
delint and replace more defers
2019-12-02 22:34:46 +00:00
Hubert Chathi
e9908b1d97
fix the path in references to logger.js
2019-10-25 23:24:30 -04:00
Travis Ralston
0e51dfed46
Don't convert errors to JSON if they are JSON already
...
For example, if the identity server throws a 401 on `/account`, we end up here with a JSON object. Don't convert the string `object Object` to JSON because it'll fail: just use the object.
2019-08-23 12:00:07 -06:00
Travis Ralston
8b9bef5cb3
Clean up JSON handling in identity server requests
2019-08-22 08:32:20 -06:00
Travis Ralston
ba78d1a9ae
JSON is JSON
2019-08-21 14:30:04 -06:00
Travis Ralston
8a0ddc43ab
Use the v2 (hashed) lookup for identity server queries
...
Fixes https://github.com/vector-im/riot-web/issues/10556
Implements [MSC2134](https://github.com/matrix-org/matrix-doc/pull/2134 ) with assistance from [MSC2140](https://github.com/matrix-org/matrix-doc/pull/2140 ) for auth.
Note: this also changes all identity server requests to use JSON as a request body. URL encoded forms were allowed in v1 but deprecated in favour of JSON. v2 APIs do not allow URL encoded forms.
2019-08-21 14:08:46 -06:00
David Baker
b930638156
Be more verbose
...
Co-Authored-By: J. Ryan Stinnett <jryans@gmail.com >
2019-08-12 16:00:40 +01:00
David Baker
39c1de19fc
Throw an exception if trying to do an ID server request with no ID server
...
Will help with https://github.com/vector-im/riot-web/issues/10540
2019-08-12 15:39:50 +01:00
David Baker
4c6d11d9ed
Add setIdentityServerUrl
...
Hopefully fairly self explanatory. The ID server URL can be changed
fairly readily, whereas the HS URL would require a different access
token etc.
2019-08-09 18:05:37 +01:00
J. Ryan Stinnett
64ddbd97dd
Merge pull request #1009 from matrix-org/jryans/user-settings-toggle-3pid
...
Add API for bulk lookup on the Identity Server
2019-08-07 18:05:58 +01:00
J. Ryan Stinnett
8f016726f0
Add API for bulk lookup on the Identity Server
...
This adds support for querying `/bulk_lookup` on the IS to check several 3PIDs
at the same time.
Part of https://github.com/vector-im/riot-web/issues/10159
2019-08-07 17:45:13 +01:00
J. Ryan Stinnett
649fe7a490
Merge pull request #1000 from matrix-org/t3chguy/remove_authedRequestWithPrefix
...
Remove deprecated authedRequestWithPrefix and requestWithPrefix
2019-08-06 18:58:24 +01:00
J. Ryan Stinnett
9b093f7569
Add first pass of IS v2 API with authentication
...
This only updates the `/lookup` API so far. It also doesn't handle falling back
to v1.
2019-07-29 13:15:19 +01:00
Michael Telatynski
b004d1602d
Remove deprecated authedRequestWithPrefix and requestWithPrefix
...
replacing as documented with authedRequest
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com >
2019-07-29 12:25:38 +01:00
David Baker
6cca73b999
Merge pull request #988 from matrix-org/dbkr/terms
...
Support for MSC2140 (terms of service for IS/IM)
2019-07-23 10:32:05 +01:00
Travis Ralston
fe4ac06f43
Use the correct media endpoints
2019-07-10 13:24:11 -06:00
David Baker
c3b5767999
update comment to reflect right version
2019-07-10 12:19:12 +01:00
David Baker
e9528ebb98
Support for MSC2140 (terms of service for IS/IM)
2019-07-09 18:50:01 +01:00
Travis Ralston
3aa2bf8a76
Include the error object when raising Session.logged_out
...
Note: The `call` argument previously defined in the SDK was never actually populated, and appears to be a documentation error when the definition was copied from `Call.incoming` directly above it.
2019-07-03 16:42:33 -06:00
J. Ryan Stinnett
ac26c91cba
Fix content uploads for modern browsers
...
Modern browsers now expose a `stream` function on the Blob and File interfaces.
This conflicts with an older style of passing data to the `uploadContent` SDK
method, which supported supplying the data to upload in the `stream` property of
an object.
Since this old style is still in active use in the Matrix JS ecosystem, we
preserve the backwards compatibility for now by checking whether `stream` is a
function.
This fix has been tested in Firefox Nightly (69), Firefox Release (67), Chrome
Canary (77), and Chrome Stable (75).
Fixes https://github.com/vector-im/riot-web/issues/9913
Fixes https://github.com/matrix-org/matrix-js-sdk/issues/949
2019-06-11 13:02:42 +01:00
jkasun
a73dabcb67
Console logging to loglevel
2019-05-19 09:29:40 +05:30
Travis Ralston
568ff5a3f5
Appease the linter
2018-10-25 14:36:14 -06:00
Travis Ralston
0c540ac8de
Re-add the querystring options
2018-10-24 16:36:12 -06:00
Travis Ralston
d8bcc4e3f1
Initial support for specifying which servers to try in joinRoom
...
This has a bug when using browser-request where the query string for `server_name: [a, b]` comes out as `?server_name=a,b` instead of `?server_name=a&server_name=b`. This is due to browser-request not supporting the same qs options as request, so the qsStringifyOptions do nothing.
2018-10-19 13:34:22 -06:00
Michael Telatynski
7fe3e2f90a
invert argument to make it positive without breaking backwards compat
...
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com >
2018-06-18 12:27:25 +01:00
Michael Telatynski
c0b2151929
allow omitting filename from upload entirely
...
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com >
2018-06-15 18:25:20 +01:00
Michael Telatynski
5e3b1bf6b0
use Authorization header in media/v1/upload if enabled, instead of query
...
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com >
2018-06-15 09:57:30 +01:00
Michael Telatynski
b7208c12ac
Merge pull request #643 from matrix-org/t3chguy/content-type-bugfix
...
fix typo where `headers` was not being used and thus sent wrong content-type
2018-06-08 12:29:35 +01:00
Luke Barnard
bafbe5cbec
Emit no_consent when M_CONSENT_NOT_GIVEN received ( #647 )
2018-05-22 18:02:21 +01:00
Michael Telatynski
1bf1ce7070
fix typo where headers was not being used and thus sent wrong mime
...
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com >
2018-04-30 06:56:43 +01:00
Richard van der Hoff
34b31865c5
Add progress handler to uploadContent
...
bluebird doesn't support promise progression (or rather, it does, but it's
heavily deprecated and doesn't use the same API as q), so replace the
(undocumented) promise progression on uploadFile with a callback.
2017-07-14 16:51:43 +01:00
Richard van der Hoff
cfffbc4a09
replace q method calls with bluebird ones
...
```
find src spec -name '*.js' |
xargs perl -i -pe 's/q\.(all|defer|reject|delay|try)\(/Promise.$1(/'
```
2017-07-12 23:33:55 +01:00
Richard van der Hoff
b96062b6de
replace imports of q with bluebird
...
```
find src spec -name '*.js' |
xargs perl -i -pe 'if (/require\(.q.\)/) { $_ = "import Promise from '\''bluebird'\'';\n"; }'
find src spec -name '*.js' |
xargs perl -i -pe 'if (/import q/) { $_ = "import Promise from '\''bluebird'\'';\n"; }'
```
2017-07-12 23:32:28 +01:00