Commit Graph

70 Commits (2fd291c23c77f8d5cb85c5ee74c1efaabad3ed22)

Author SHA1 Message Date
Richard van der Hoff 0a01320fca
Element-R: pass pickleKey in as raw key for indexeddb encryption (#12543)
* Element-R: pass pickleKey in as raw key for indexeddb encryption

Currently, we pass the `pickleKey` to the rust library for use as a passphrase
for encrypting its crypto store. The Rust libary then passes that passphrase
through 200000 rounds of PBKDF2 to generate an encryption key, which is
(deliberately) slow.

However, the pickleKey is actually 32 bytes of random data (base64-encoded). By
passing the raw key into the rust library, we can therefore save the PBKDF
operation.

Backwards-compatibility with existing sessions is maintained, because if the
rust library discovers that the store was previously encrypted with a key based
on a PBKDF, it will re-base64 and PBKDF the key we provide, thus reconstructing
the right key.

* Update src/Lifecycle.ts

Co-authored-by: Florian Duros <florianduros@element.io>

* Lifecycle-test: clean up test setup

Rely less on the unit under test for setting up the test preconditions -- not
least because we don't really want to fire up matrix clients and the like
during test setup.

* Factor out "encryptPickleKey" method

For a start it makes it easier to grok what's going on, but also I went to use
this in a test

* Improve tests for `Lifecycle.restoreFromLocalStorage`

---------

Co-authored-by: Florian Duros <florianduros@element.io>
2024-06-05 08:52:28 +00:00
Michael Telatynski d0b30d1631
Allow explicit configuration of OIDC dynamic registration metadata (#12514)
* Fix `element-desktop-ssoid being` included in OIDC Authorization call

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Split out oidc callback url into its own method

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Allow explicit configuration of OIDC dynamic registration metadata

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Fix test

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Fix unexpected hash on oidc callback url

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* undefined > []

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2024-05-14 09:38:33 +00:00
Michael Telatynski cc6958980b
Fix `element-desktop-ssoid being` included in OIDC Authorization call (#12495)
* Fix `element-desktop-ssoid being` included in OIDC Authorization call

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Split out oidc callback url into its own method

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Fix unexpected hash on oidc callback url

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Update src/BasePlatform.ts

Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
2024-05-13 13:31:08 +00:00
Travis Ralston d25d529e86
Extract functions for service worker usage, and add initial MSC3916 playwright test (when supported) (#12414)
* Send user credentials to service worker for MSC3916 authentication

* appease linter

* Add initial test

The test fails, seemingly because the service worker isn't being installed or because the network mock can't reach that far.

* Remove unsafe access token code

* Split out base IDB operations to avoid importing `document` in serviceworkers

* Use safe crypto access for service workers

* Fix tests/unsafe access

* Remove backwards compatibility layer & appease linter

* Add docs

* Fix tests

* Appease the linter

* Iterate tests

* Factor out pickle key handling for service workers

* Enable everything we can about service workers

* Appease the linter

* Add docs

* Rename win32 image to linux in hopes of it just working

* Use actual image

* Apply suggestions from code review

Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>

* Improve documentation

* Document `??` not working

* Try to appease the tests

* Add some notes

---------

Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
2024-05-02 22:19:55 +00:00
Michael Telatynski 618462ba06
Fix Native OIDC for Element Desktop (#12253)
* Reuse exported common type

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Improve client metadata used for OIDC dynamic registration

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Fix Native OIDC for Element Desktop by including ssoid in the url_state of the /auth call

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Reuse exported common type

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Improve client metadata used for OIDC dynamic registration

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Fix typo

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Fix test

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Mock PlatformPeg

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Mock platform

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Add comment

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Improve comment

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Update src/BasePlatform.ts

Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
2024-02-19 15:10:11 +00:00
Michael Telatynski cd8679c172
Improve client metadata used for OIDC dynamic registration (#12257) 2024-02-16 14:43:58 +00:00
David Baker 21dc26f725
Update base64 import (#11784)
Apologies, I broke this with https://github.com/matrix-org/matrix-js-sdk/pull/3818

This fixes it, but needs https://github.com/matrix-org/matrix-js-sdk/pull/3820
2023-10-20 18:19:09 +01:00
Michael Telatynski 27d79458da
Remove dead & duplicated code (#11405)
* Remove dead code

* Make dead code happier

* DRY pickle additional data calculation

* Iterate
2023-08-15 08:43:15 +00:00
Michael Telatynski e67ca33c4a
Switch to importing models/Room from main js-sdk export (#11361)
* Switch to importing TypedEventEmitter from main js-sdk export

* Switch to importing js-sdk/matrix in cypress

* Remove duplicated imports

* Fix lint:js-fix to run prettier last otherwise ESLint --fix may cause a mess

* Add lint rule

* Switch to importing models/Room from main js-sdk export

* Fix cypress-axe import

* Fix more imports

* Fix cypress-axe import

* Fix duplicated lint rule
2023-08-04 07:36:16 +00:00
Michael Telatynski 96c8267f71
Improve types to match reality (#10691) 2023-04-24 07:29:01 +00:00
Michael Telatynski 1e651bf1a5
Clear electron data when logging out (#10386) 2023-03-15 15:56:29 +00:00
Michael Telatynski 145a5a8a8d
Conform more code to strict null checking (#10153)
* Conform more code to strict null checking

* Conform more code to strict null checking

* Iterate

* Iterate
2023-02-15 13:36:22 +00:00
Michael Telatynski 61a63e47f4
Comply with noImplicitAny (#9940)
* Stash noImplicitAny work

* Stash

* Fix imports

* Iterate

* Fix tests

* Delint

* Fix tests
2023-02-13 11:39:16 +00:00
Michael Telatynski 9743852380
Improve typescript null checking in places (#10073 (#10073
* Improve typescript null checking in places

* Iterate

* Fix Timer.ts
2023-02-03 15:27:47 +00:00
Hugh Nimmo-Smith d698193196
Implementation of MSC3824 to make the client OIDC-aware (#8681) 2023-01-27 11:06:10 +00:00
Michael Telatynski 030b7e90bf
Enable `@typescript-eslint/explicit-function-return-type` in /src (#9788)
* Enable `@typescript-eslint/explicit-member-accessibility` on /src

* Prettier

* Enable `@typescript-eslint/explicit-function-return-type` in /src

* Fix types

* tsc strict fixes

* Delint

* Fix test

* Fix bad merge
2023-01-12 13:25:14 +00:00
Michael Telatynski f1e8e7f140
Enable `@typescript-eslint/explicit-member-accessibility` on /src (#9785)
* Enable `@typescript-eslint/explicit-member-accessibility` on /src

* Prettier
2022-12-16 12:29:59 +00:00
Michael Weimann 526645c791
Apply prettier formatting 2022-12-12 12:24:14 +01:00
Šimon Brandner bd30b75f79
Add support for disabling spell checking (#8604)
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
2022-07-28 08:10:04 +00:00
Robin 4dd74261b5
Hide screenshare button in video rooms on Desktop (#9045)
* Hide screenshare button in video rooms on Desktop

* Fix tests
2022-07-12 08:23:35 -04:00
Johannes Marbach 6f21a155a4
Add option to display tooltip on link hover (#8394)
* Add option to display tooltip on link hover

This makes it possible for platforms like Electron apps, which lack
a built-in URL preview in the status bar, to enable tooltip previews
of links.

Relates to: vector-im/element-web#6532
Signed-off-by: Johannes Marbach <johannesm@element.io>

* Gracefully handle missing platform

* Use public access modifier

Co-authored-by: Travis Ralston <travpc@gmail.com>

* Use exact inequality

Co-authored-by: Travis Ralston <travpc@gmail.com>

* Document getAbsoluteUrl

* Appease the linter

* Clarify performance impact in comment

Co-authored-by: Travis Ralston <travpc@gmail.com>

* Use URL instead of anchor element hack

* Wrap anchor in tooltip target and only allow focus on anchor

* Use optional chaining

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>

* Use double quotes for consistency

* Accumulate and unmount tooltips and extract tooltipify.tsx

* Fix indentation

* Blur tooltip target on click

* Remove space

* Mention platform flag in comment

* Add (simplistic) tests

* Fix lint errors

* Fix lint errors ... for real

* Replace snapshot tests with structural assertions

* Add missing semicolon

* Add tooltips in link previews

* Fix copyright

Co-authored-by: Travis Ralston <travpc@gmail.com>
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
2022-07-06 09:43:30 +00:00
Michael Telatynski ba2ce5ecba
Abstract electron settings properly to avoid boilerplate-hell (#8798)
* Remove unused method `BasePlatform::screenCaptureErrorString`

* Improve platform typescripting

* Remove redundant awaits

* Abstract electron settings properly to avoid boilerplate-hell

* i18n

* Fix stray semi-colons

* Fix setting level order for Platform settings
2022-06-10 22:38:50 +01:00
Šimon Brandner 125a265806
Improve Typescript in `BasePlatform` (#8768)
* Improve Typescript in `BasePlatform`

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* `installUpdate()` should not be abstract

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
2022-06-06 08:31:20 +02:00
Michael Telatynski d75e2f19c5
Fix font not resetting when logging out (#8670)
* Fix font not resetting when logging out

* Adopt on_logged_in and on_logged_out into DispatcherAction

* Add tests

* Add copyright
2022-05-26 09:56:53 +01:00
James Salter 4f9598361f
Add the option to disable hardware acceleration (#8655) 2022-05-23 11:23:40 +01:00
Travis Ralston 548290b006
Run a minor code quality checker over the repo (#8524)
* Run a minor code quality checker over the repo

Largely targeted at spelling of common words and misc code issues.

* Update snapshots
2022-05-09 22:52:05 +00:00
Šimon Brandner d162e021e1
Add message right click context menu v2 (#5672)
* migrate the message context menu to IconizedContextMenu

Signed-off-by: Michael Weimann <mail@michael-weimann.eu>

* migrate the message context menu to IconizedContextMenu

Signed-off-by: Michael Weimann <mail@michael-weimann.eu>

* Added right-click menu

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* add message context menu group keys

Signed-off-by: Michael Weimann <mail@michael-weimann.eu>

* add message context menu icons

Signed-off-by: Michael Weimann <mail@michael-weimann.eu>

* add _MessageContextMenu.scss license header

Signed-off-by: Michael Weimann <mail@michael-weimann.eu>

* use null vars for context menu lists

* Add allowOverridingNativeContextMenus()

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Use allowOverridingNativeContextMenus()

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Fix types

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Fix types

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Remove mistaken line

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Fix styling

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* InputHTMLAttributes -> AllHTMLAttributes

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Convert to TS

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Add some types

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Make onClick optional

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Add rightClick prop

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Add copy button

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* What about upgrading deps after the eslint migration, Simon?

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Add edit button

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* fix

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Add reply button

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Add react button

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Cleanup render()

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Fix comments

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Add save button

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Don't show context menu if editing

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Add special handling for click a timestamp

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Fix double empty line

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Don't show context menu for images

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Cleanup

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Fix order

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Keep action bar shown when right-clicking

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Highlight event tile when right-clicking

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Delint

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Pointless change so that I can re-run the CI

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Remove dowload button

Because we don't use this menu when clicking on images

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Be more clear for non-bools

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Use triggerOnMouse down prop

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Remove a comment

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Remove unused var

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Remove unnecessary import

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Add some missing types

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Add missing type

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Remove unused import

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Add a missing type

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Fix types

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Fix types/naming

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Add missing current

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Remove unused var

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Fix editing and replying

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* i18n

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Fix import

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Support right-click context menu for threads

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Make button order match `MessageActionBar`

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Fix missing permalink button

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Remove useless part of if statement

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Some small refactoring for consistency

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Some more refactoring

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Fix `editEvent()` call

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Make editing polls work

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Fix collapse reply chain button

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Fix timelineRenderingType

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Fix reply button

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Hide right-click context menu behind a labs flag

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Add missing return type

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Make `contextMene` optional

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Move `renderContextMenu()`

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Simplify `renderContextMenu()`

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Improve `aboveLeftOf` typing

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Use `InputHTMLAttributes`

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Disable message right-click context menu in browser (for now)

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Give permalink button more props

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

Co-authored-by: Michael Weimann <mail@michael-weimann.eu>
2022-04-15 08:22:59 -06:00
Travis Ralston d8a939df5d
Use & enforce snake_case naming convention on config.json settings (#8062)
* Document and support the established naming convention for config opts

This change:
* Rename `ConfigOptions` to `IConfigOptions` to match code convention/style, plus move it to a dedicated file
* Update comments and surrounding documentation
* Define every single documented option (from element-web's config.md)
* Enable a linter to enforce the convention
* Invent a translation layer for a different change to use
* No attempt to fix build errors from doing this (at this stage)

* Add demo of lint rule in action

* Fix all obvious instances of SdkConfig case conflicts

* Fix tests to use SdkConfig directly

* Add docs to make unset() calling safer

* Appease the linter

* Update documentation to match snake_case_config

* Fix more instances of square brackets off SdkConfig
2022-03-18 10:12:36 -06:00
Šimon Brandner 93a9af7b3a
Keybinding code unification #3 (#7850) 2022-02-23 09:12:04 +00:00
Michael Telatynski 658590e5bc
More posthog tracking around joining rooms and room search (#7807) 2022-02-17 18:03:27 +00:00
Šimon Brandner 73899bb2e3
Switch to IPC channel for `getDesktopCapturerSources` (#7782) 2022-02-11 10:41:15 +00:00
Michael Telatynski 0d6ef76605
Add analytics for the ViewRoom action (#7666) 2022-02-10 14:29:55 +00:00
Germain 53081f52fb
Pass MatrixEvent to displayNotification method (#7355) 2021-12-15 08:34:52 +00:00
Michael Telatynski 37bf85489d
Don't inhibit current room notifications if user has Modal open (#7274) 2021-12-03 11:02:47 +00:00
James Salter e549438e2a
Add logging for a bunch of silently swallowed errors (#7148) 2021-11-18 09:01:45 +11:00
Dariusz Niemczyk 5e73a212f4 Replace console.error with logger.error
Related https://github.com/vector-im/element-web/issues/18425
2021-10-18 14:08:23 +02:00
Michael Telatynski 6250d9ba61
Merge branch 'develop' into t3chguy/ts/4 2021-06-29 22:24:47 +01:00
J. Ryan Stinnett ae0a8b8da4 Auto-fix lint errors 2021-06-29 13:11:58 +01:00
Michael Telatynski 4492627401 More js-sdk type consolidation 2021-06-24 19:20:02 +01:00
Germain Souquet 2e44d7e17f Do not throw on setLanguage 2021-04-27 15:11:49 +01:00
Germain Souquet a43ad8d881 Allow for multiple locale and stabilise set language call 2021-04-26 13:55:14 +01:00
Germain Souquet 8f1ea84eb6 Broadcast language change to ElectroPlatform 2021-04-23 17:11:45 +01:00
Germain Souquet 25a47b463e Add user settings for warn before exit 2021-03-25 14:14:38 +00:00
Šimon Brandner 1ba512af2a
Use getSpellCheckLanguages() instead of a setting
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
2021-02-18 20:12:48 +01:00
Šimon Brandner bd0e5446c5
Merge branch 'develop' into feature-multi-language-spell-check 2021-02-18 18:16:16 +01:00
Michael Telatynski 5d86c2f8e0 Better errors for SSO failures 2021-02-01 16:42:58 +00:00
J. Ryan Stinnett 84b1f2e6c6 Resolve typing errors after TypeScript upgrade 2021-01-27 12:42:37 +00:00
Hubert Chathi 649ea0d148 apply changes from review, and other fixes/improvements 2020-12-10 21:52:18 -05:00
Hubert Chathi 753ec9e45a use random pickle key on all platforms, and store access token encrypted in IDB 2020-12-09 18:40:31 -05:00
Šimon Brandner 19d9ea3477 Merge branch 'develop' into feature-multi-language-spell-check 2020-12-03 12:06:43 +01:00