Commit graph

55 commits

Author SHA1 Message Date
Bruno Windels 8b8233ff00
Merge pull request #691 from vector-im/madlittlemods/only-crypto-in-secure-context
Only initialize `Crypto` when olm is provided
2022-03-03 17:33:50 +01:00
Eric Eastwood 2f4c639cef Only initialize Crypto when olm is provided
See https://github.com/vector-im/hydrogen-web/pull/691#discussion_r816988082
2022-03-02 03:17:59 -06:00
Tushar 7055f02f16 typescriptify domain/avatar.js 2022-02-25 15:52:54 +05:30
Eric Eastwood 0935f2d23a Only try to use window.crypto.subtle in secure contexts to avoid it throwing and stopping all JavaScript
Relevant error if you crypto is used in a non-secure context like a local LAN IP `http://192.168.1.151:3050/`
```
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'deriveBits')
	at new Crypto
	at new Platform
	at mountHydrogen
```

For my use-case with https://github.com/matrix-org/matrix-public-archive, I don't need crypto/encryption at all.

Docs:

 - https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts
 - https://developer.mozilla.org/en-US/docs/Web/API/Crypto/subtle
    - "Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers."

---

Related to https://github.com/vector-im/hydrogen-web/issues/579
2022-02-25 01:59:48 -06:00
Bruno Windels 13e77636a9 export paths from vite.js as required by Platform, reorder ctor params
make it easier for SDK users
2021-12-22 17:48:08 +01:00
Bruno Windels 9238961992 cache olm and olm worker promise inside Platform
as prep to call them every time a Client is created
2021-12-22 17:19:10 +01:00
Bruno Windels 0ec86b6dc1 Merge branch 'master' into bwindels/vite-mvp 2021-12-09 18:07:17 +01:00
Bruno Windels 62827b92b7 implement placeholder replacement so it still works with minification 2021-12-09 16:37:31 +01:00
Bruno Windels 4c2c99fc07 actually remove lookbehind 2021-12-08 18:05:57 +01:00
Bruno Windels c8b0354d07 dont use lookbehind in regular expressions, safari & older firefoxes choke on them 2021-12-08 18:00:37 +01:00
Bruno Windels c87628b614 cleanup 2021-12-06 15:40:15 +01:00
Bruno Windels 155cd4c9bd make olmPath absolute if it isn't already 2021-12-06 13:49:14 +01:00
Bruno Windels d91aaabeb3
Merge pull request #596 from vector-im/ts-conversion-matrix-sessioninfo
Convert matrix/sessioninfo to typescript
2021-12-02 09:29:11 +01:00
Bruno Windels 7e1818b285 Merge branch 'master' into bwindels/vite-mvp 2021-12-01 12:30:33 +01:00
Bruno Windels ef712b16f5
Merge pull request #584 from vector-im/ts-conversion-utils
Convert /utils to typescript
2021-11-30 14:13:09 +01:00
RMidhunSuresh fe77b71c97 use transformer function 2021-11-30 13:28:28 +05:30
RMidhunSuresh bb18af414b Convert SessionInfoStorage.js to ts 2021-11-25 15:18:03 +05:30
RMidhunSuresh ef53a12f7a Fix imports 2021-11-17 20:28:44 +05:30
RMidhunSuresh a7d059b3ed Fix imports 2021-11-14 19:42:18 +05:30
RMidhunSuresh 8c7a765e11 Convert IDBLogger to ts 2021-11-12 15:06:21 +05:30
Bruno Windels 923a1a2057 use vite define option to inject version number everywhere 2021-11-08 11:10:34 +01:00
Danila Fedorin 9252f3bede Migrate StorageFactory to TypeScript 2021-08-27 09:30:16 -07:00
Bruno Windels e105bc4237 fix lint warnings 2021-08-24 15:31:18 +02:00
RMidhunSuresh 987a83b4cf Add method to redirect to a specific URL
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-08-18 22:04:33 +05:30
Danila Fedorin c835dc324e Merge branch 'master' of github.com:vector-im/hydrogen-web into formatted-messages 2021-07-16 14:05:43 -07:00
Danila Fedorin 4022c6121b Switch to DOMPurify in platform layer for sanitization. 2021-07-12 15:00:16 -07:00
Danila Fedorin 005580f385 Move HTML parsing into platform. 2021-07-02 15:05:50 -07:00
RMidhunSuresh b8c01272f4 remove listener on dispose
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-07-01 15:42:07 +05:30
RMidhunSuresh b469c4299f implement new approach
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-06-30 23:30:44 +05:30
Bruno Windels 25e0211ca1
Merge pull request #279 from Johennes/feature/safari-viewport
Manually adapt UI when keyboard shows or hides on mobile Safari
2021-04-28 11:04:43 +02:00
Will Hunt 6bdf7f1ee9 Allow specifying a custom defaultHomeServer 2021-03-30 17:43:03 +01:00
Johannes Marbach 14ed5fd1e8 Manually adapt UI when keyboard shows or hides on mobile Safari
Mobile Safari seems to be the only browser that does *not* resize the
viewport when the keyboard shows and hides. Instead the window is moved
to make room for the keyboard which moves content at the top off screen.

This uses the VisualViewport API to manually resize the `SessionView`
in response to keyboard display events. Additionally, if a DOM element
exists that has the `bottom-aligned-scroll` CSS class, its scroll
position is retained. Currently this only applies to the `Timeline`.

Note that the VisualViewport API was only introduced with iOS 13.
According to [statista.com], versions below 13 made up for 19% of
all iOS users in summer 2020, with the share continuing to fall off.
As a result, this seems like an acceptable workaround.

Fixes: #181

[statista.com]: https://www.statista.com/statistics/565270/apple-devices-ios-version-share-worldwide/

Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2021-03-26 08:29:33 +01:00
Bruno Windels f764323c80 fixup: notif service 2021-03-23 18:20:23 +01:00
Bruno Windels 5d71b655ad halt any fetch request while waiting for new service worker to activate
this make updates apply instantly rather than sometimes being stalled
for seconds or minutes.
2021-03-18 19:50:53 +01:00
Bruno Windels 5d55f6d78c log app version when opening session 2021-03-15 16:55:14 +01:00
Bruno Windels c6ff56a942 send video messages 2021-03-09 19:35:25 +01:00
Bruno Windels 6ad778d27b support file downloads on iOS through data: uris 2021-03-04 21:51:29 +01:00
Bruno Windels 42654dbd4f console logger for local dev 2021-03-01 15:07:24 +01:00
Bruno Windels f65db338cf make it work 2021-02-12 18:05:39 +01:00
Bruno Windels bbab1e9ecc move base64/58 encoding into platform
fixes https://github.com/vector-im/hydrogen-web/issues/99
2021-02-12 16:01:54 +01:00
Bruno Windels 4c2abcf9c7 add logger to platform 2021-02-12 13:04:18 +01:00
Bruno Windels e49639fda2 move textencoder/decoder into platform 2021-02-11 17:29:48 +01:00
Bruno Windels 9ab81eea02 add setting for image compression level 2020-11-20 15:51:16 +01:00
Bruno Windels f6dbb23f79 better error handling for file and picture upload 2020-11-18 20:07:31 +01:00
Bruno Windels 6fd10b63e5 add device pixel ratio scaling while at it 2020-11-12 13:50:32 +01:00
Bruno Windels 1ad8af34d1 add thumbnailing code 2020-11-12 13:50:06 +01:00
Bruno Windels 6384702863 fix file selector for IE11 2020-11-11 12:47:26 +01:00
Bruno Windels c278b0f4a3 rename blob.blob to blob.nativeBlob
also to make the name a bit more unique where we want to do duck typing
2020-11-11 10:44:44 +01:00
Bruno Windels 2cfffa015d WIP 2020-11-10 22:36:26 +01:00
Bruno Windels 6fa9471292 remove trailing whitespace 2020-11-10 17:51:39 +01:00