Merge branch 'develop' into improve-layout-handling
|
@ -22,6 +22,8 @@ module.exports = {
|
||||||
"files": ["src/**/*.{ts,tsx}"],
|
"files": ["src/**/*.{ts,tsx}"],
|
||||||
"extends": ["matrix-org/ts"],
|
"extends": ["matrix-org/ts"],
|
||||||
"rules": {
|
"rules": {
|
||||||
|
// We're okay being explicit at the moment
|
||||||
|
"@typescript-eslint/no-empty-interface": "off",
|
||||||
// We disable this while we're transitioning
|
// We disable this while we're transitioning
|
||||||
"@typescript-eslint/no-explicit-any": "off",
|
"@typescript-eslint/no-explicit-any": "off",
|
||||||
// We'd rather not do this but we do
|
// We'd rather not do this but we do
|
||||||
|
|
129
CHANGELOG.md
|
@ -1,3 +1,132 @@
|
||||||
|
Changes in [3.13.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.13.1) (2021-02-04)
|
||||||
|
=====================================================================================================
|
||||||
|
[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v3.13.0...v3.13.1)
|
||||||
|
|
||||||
|
* [Release] Fix z-index of stickerpicker
|
||||||
|
[\#5618](https://github.com/matrix-org/matrix-react-sdk/pull/5618)
|
||||||
|
|
||||||
|
Changes in [3.13.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.13.0) (2021-02-03)
|
||||||
|
=====================================================================================================
|
||||||
|
[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v3.13.0-rc.1...v3.13.0)
|
||||||
|
|
||||||
|
* Upgrade to JS SDK 9.6.0
|
||||||
|
* [Release] Fix flair height after accent changes
|
||||||
|
[\#5612](https://github.com/matrix-org/matrix-react-sdk/pull/5612)
|
||||||
|
* [Release] Iterate Social Logins work around edge cases and branding
|
||||||
|
[\#5610](https://github.com/matrix-org/matrix-react-sdk/pull/5610)
|
||||||
|
* [Release] Lock widget room ID when added
|
||||||
|
[\#5608](https://github.com/matrix-org/matrix-react-sdk/pull/5608)
|
||||||
|
* [Release] Better errors for SSO failures
|
||||||
|
[\#5606](https://github.com/matrix-org/matrix-react-sdk/pull/5606)
|
||||||
|
* [Release] Fix RoomView re-mounting breaking peeking
|
||||||
|
[\#5603](https://github.com/matrix-org/matrix-react-sdk/pull/5603)
|
||||||
|
|
||||||
|
Changes in [3.13.0-rc.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.13.0-rc.1) (2021-01-29)
|
||||||
|
===============================================================================================================
|
||||||
|
[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v3.12.1...v3.13.0-rc.1)
|
||||||
|
|
||||||
|
* Upgrade to JS SDK 9.6.0-rc.1
|
||||||
|
* Translations update from Weblate
|
||||||
|
[\#5597](https://github.com/matrix-org/matrix-react-sdk/pull/5597)
|
||||||
|
* Support managed hybrid widgets from config
|
||||||
|
[\#5596](https://github.com/matrix-org/matrix-react-sdk/pull/5596)
|
||||||
|
* Add managed hybrid call widgets when supported
|
||||||
|
[\#5594](https://github.com/matrix-org/matrix-react-sdk/pull/5594)
|
||||||
|
* Tweak mobile guide toast copy
|
||||||
|
[\#5595](https://github.com/matrix-org/matrix-react-sdk/pull/5595)
|
||||||
|
* Improve SSO auth flow
|
||||||
|
[\#5578](https://github.com/matrix-org/matrix-react-sdk/pull/5578)
|
||||||
|
* Add optional mobile guide toast
|
||||||
|
[\#5586](https://github.com/matrix-org/matrix-react-sdk/pull/5586)
|
||||||
|
* Fix invisible text after logging out in the dark theme
|
||||||
|
[\#5588](https://github.com/matrix-org/matrix-react-sdk/pull/5588)
|
||||||
|
* Fix escape for cancelling replies
|
||||||
|
[\#5591](https://github.com/matrix-org/matrix-react-sdk/pull/5591)
|
||||||
|
* Update widget-api to beta.12
|
||||||
|
[\#5589](https://github.com/matrix-org/matrix-react-sdk/pull/5589)
|
||||||
|
* Add commands for DM conversion
|
||||||
|
[\#5540](https://github.com/matrix-org/matrix-react-sdk/pull/5540)
|
||||||
|
* Run a UI refresh over the OIDC Exchange confirmation dialog
|
||||||
|
[\#5580](https://github.com/matrix-org/matrix-react-sdk/pull/5580)
|
||||||
|
* Allow stickerpickers the legacy "visibility" capability
|
||||||
|
[\#5581](https://github.com/matrix-org/matrix-react-sdk/pull/5581)
|
||||||
|
* Hide local video if it is muted
|
||||||
|
[\#5529](https://github.com/matrix-org/matrix-react-sdk/pull/5529)
|
||||||
|
* Don't use name width in reply thread for IRC layout
|
||||||
|
[\#5518](https://github.com/matrix-org/matrix-react-sdk/pull/5518)
|
||||||
|
* Update code_style.md
|
||||||
|
[\#5554](https://github.com/matrix-org/matrix-react-sdk/pull/5554)
|
||||||
|
* Fix Czech capital letters like ŠČŘ...
|
||||||
|
[\#5569](https://github.com/matrix-org/matrix-react-sdk/pull/5569)
|
||||||
|
* Add optional search shortcut
|
||||||
|
[\#5548](https://github.com/matrix-org/matrix-react-sdk/pull/5548)
|
||||||
|
* Fix Sudden 'find a room' UI shows up when the only room moves to favourites
|
||||||
|
[\#5584](https://github.com/matrix-org/matrix-react-sdk/pull/5584)
|
||||||
|
* Increase PersistedElement's z-index
|
||||||
|
[\#5568](https://github.com/matrix-org/matrix-react-sdk/pull/5568)
|
||||||
|
* Remove check that prevents Jitsi widgets from being unpinned
|
||||||
|
[\#5582](https://github.com/matrix-org/matrix-react-sdk/pull/5582)
|
||||||
|
* Fix Jitsi widgets causing localized tile crashes
|
||||||
|
[\#5583](https://github.com/matrix-org/matrix-react-sdk/pull/5583)
|
||||||
|
* Log candidates for calls
|
||||||
|
[\#5573](https://github.com/matrix-org/matrix-react-sdk/pull/5573)
|
||||||
|
* Upgrade deps 2021-01
|
||||||
|
[\#5579](https://github.com/matrix-org/matrix-react-sdk/pull/5579)
|
||||||
|
* Fix "Continuing without email" dialog bug
|
||||||
|
[\#5566](https://github.com/matrix-org/matrix-react-sdk/pull/5566)
|
||||||
|
* Require registration for verification actions
|
||||||
|
[\#5574](https://github.com/matrix-org/matrix-react-sdk/pull/5574)
|
||||||
|
* Don't play the hangup sound when the call is answered from elsewhere
|
||||||
|
[\#5572](https://github.com/matrix-org/matrix-react-sdk/pull/5572)
|
||||||
|
* Move to newer base image for end-to-end tests
|
||||||
|
[\#5570](https://github.com/matrix-org/matrix-react-sdk/pull/5570)
|
||||||
|
* Update widgets in the room upon join
|
||||||
|
[\#5564](https://github.com/matrix-org/matrix-react-sdk/pull/5564)
|
||||||
|
* Update AuxPanel and related buttons when widgets change or on reload
|
||||||
|
[\#5563](https://github.com/matrix-org/matrix-react-sdk/pull/5563)
|
||||||
|
* Add VoIP user mapper
|
||||||
|
[\#5560](https://github.com/matrix-org/matrix-react-sdk/pull/5560)
|
||||||
|
* Improve styling of SSO Buttons for multiple IdPs
|
||||||
|
[\#5558](https://github.com/matrix-org/matrix-react-sdk/pull/5558)
|
||||||
|
* Fixes for the general tab in the room dialog
|
||||||
|
[\#5522](https://github.com/matrix-org/matrix-react-sdk/pull/5522)
|
||||||
|
* fix issue 16226 to allow switching back to default HS.
|
||||||
|
[\#5561](https://github.com/matrix-org/matrix-react-sdk/pull/5561)
|
||||||
|
* Support room-defined widget layouts
|
||||||
|
[\#5553](https://github.com/matrix-org/matrix-react-sdk/pull/5553)
|
||||||
|
* Change a bunch of strings from Recovery Key/Phrase to Security Key/Phrase
|
||||||
|
[\#5533](https://github.com/matrix-org/matrix-react-sdk/pull/5533)
|
||||||
|
* Give a bigger target area to AppsDrawer vertical resizer
|
||||||
|
[\#5557](https://github.com/matrix-org/matrix-react-sdk/pull/5557)
|
||||||
|
* Fix minimized left panel avatar alignment
|
||||||
|
[\#5493](https://github.com/matrix-org/matrix-react-sdk/pull/5493)
|
||||||
|
* Ensure component index has been written before renaming
|
||||||
|
[\#5556](https://github.com/matrix-org/matrix-react-sdk/pull/5556)
|
||||||
|
* Fixed continue button while selecting home-server
|
||||||
|
[\#5552](https://github.com/matrix-org/matrix-react-sdk/pull/5552)
|
||||||
|
* Wire up MSC2931 widget navigation
|
||||||
|
[\#5527](https://github.com/matrix-org/matrix-react-sdk/pull/5527)
|
||||||
|
* Various fixes for Bridge Info page (MSC2346)
|
||||||
|
[\#5454](https://github.com/matrix-org/matrix-react-sdk/pull/5454)
|
||||||
|
* Use room-specific listeners for message preview and community prototype
|
||||||
|
[\#5547](https://github.com/matrix-org/matrix-react-sdk/pull/5547)
|
||||||
|
* Fix some misc. React warnings when viewing timeline
|
||||||
|
[\#5546](https://github.com/matrix-org/matrix-react-sdk/pull/5546)
|
||||||
|
* Use device storage for allowed widgets if account data not supported
|
||||||
|
[\#5544](https://github.com/matrix-org/matrix-react-sdk/pull/5544)
|
||||||
|
* Fix incoming call box on dark theme
|
||||||
|
[\#5542](https://github.com/matrix-org/matrix-react-sdk/pull/5542)
|
||||||
|
* Convert DMRoomMap to typescript
|
||||||
|
[\#5541](https://github.com/matrix-org/matrix-react-sdk/pull/5541)
|
||||||
|
* Add in-call dialpad for DTMF sending
|
||||||
|
[\#5532](https://github.com/matrix-org/matrix-react-sdk/pull/5532)
|
||||||
|
|
||||||
|
Changes in [3.12.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.12.1) (2021-01-26)
|
||||||
|
=====================================================================================================
|
||||||
|
[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v3.12.0...v3.12.1)
|
||||||
|
|
||||||
|
* Upgrade to JS SDK 9.5.1
|
||||||
|
|
||||||
Changes in [3.12.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.12.0) (2021-01-18)
|
Changes in [3.12.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.12.0) (2021-01-18)
|
||||||
=====================================================================================================
|
=====================================================================================================
|
||||||
[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v3.12.0-rc.1...v3.12.0)
|
[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v3.12.0-rc.1...v3.12.0)
|
||||||
|
|
|
@ -35,12 +35,6 @@ General Style
|
||||||
- lowerCamelCase for functions and variables.
|
- lowerCamelCase for functions and variables.
|
||||||
- Single line ternary operators are fine.
|
- Single line ternary operators are fine.
|
||||||
- UPPER_SNAKE_CASE for constants
|
- UPPER_SNAKE_CASE for constants
|
||||||
- Single quotes for strings by default, for consistency with most JavaScript styles:
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
"bad" // Bad
|
|
||||||
'good' // Good
|
|
||||||
```
|
|
||||||
- Use parentheses or `` ` `` instead of `\` for line continuation where ever possible
|
- Use parentheses or `` ` `` instead of `\` for line continuation where ever possible
|
||||||
- Open braces on the same line (consistent with Node):
|
- Open braces on the same line (consistent with Node):
|
||||||
|
|
||||||
|
@ -162,7 +156,14 @@ ECMAScript
|
||||||
- Be careful mixing arrow functions and regular functions, eg. if one function in a promise chain is an
|
- Be careful mixing arrow functions and regular functions, eg. if one function in a promise chain is an
|
||||||
arrow function, they probably all should be.
|
arrow function, they probably all should be.
|
||||||
- Apart from that, newer ES features should be used whenever the author deems them to be appropriate.
|
- Apart from that, newer ES features should be used whenever the author deems them to be appropriate.
|
||||||
- Flow annotations are welcome and encouraged.
|
|
||||||
|
TypeScript
|
||||||
|
----------
|
||||||
|
- TypeScript is preferred over the use of JavaScript
|
||||||
|
- It's desirable to convert existing JavaScript files to TypeScript. TypeScript conversions should be done in small
|
||||||
|
chunks without functional changes to ease the review process.
|
||||||
|
- Use full type definitions for function parameters and return values.
|
||||||
|
- Avoid `any` types and `any` casts
|
||||||
|
|
||||||
React
|
React
|
||||||
-----
|
-----
|
||||||
|
@ -201,6 +202,8 @@ React
|
||||||
this.state = { counter: 0 };
|
this.state = { counter: 0 };
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
- Prefer class components over function components and hooks (not a strict rule though)
|
||||||
|
|
||||||
- Think about whether your component really needs state: are you duplicating
|
- Think about whether your component really needs state: are you duplicating
|
||||||
information in component state that could be derived from the model?
|
information in component state that could be derived from the model?
|
||||||
|
|
||||||
|
|
60
docs/widget-layouts.md
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
# Widget layout support
|
||||||
|
|
||||||
|
Rooms can have a default widget layout to auto-pin certain widgets, make the container different
|
||||||
|
sizes, etc. These are defined through the `io.element.widgets.layout` state event (empty state key).
|
||||||
|
|
||||||
|
Full example content:
|
||||||
|
```json5
|
||||||
|
{
|
||||||
|
"widgets": {
|
||||||
|
"first-widget-id": {
|
||||||
|
"container": "top",
|
||||||
|
"index": 0,
|
||||||
|
"width": 60,
|
||||||
|
"height": 40
|
||||||
|
},
|
||||||
|
"second-widget-id": {
|
||||||
|
"container": "right"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
As shown, there are two containers possible for widgets. These containers have different behaviour
|
||||||
|
and interpret the other options differently.
|
||||||
|
|
||||||
|
## `top` container
|
||||||
|
|
||||||
|
This is the "App Drawer" or any pinned widgets in a room. This is by far the most versatile container
|
||||||
|
though does introduce potential usability issues upon members of the room (widgets take up space and
|
||||||
|
therefore fewer messages can be shown).
|
||||||
|
|
||||||
|
The `index` for a widget determines which order the widgets show up in from left to right. Widgets
|
||||||
|
without an `index` will show up as the rightmost widgets. Tiebreaks (same `index` or multiple defined
|
||||||
|
without an `index`) are resolved by comparing widget IDs. A maximum of 3 widgets can be in the top
|
||||||
|
container - any which exceed this will be ignored (placed into the `right` container). Smaller numbers
|
||||||
|
represent leftmost widgets.
|
||||||
|
|
||||||
|
The `width` is relative width within the container in percentage points. This will be clamped to a
|
||||||
|
range of 0-100 (inclusive). The widgets will attempt to scale to relative proportions when more than
|
||||||
|
100% space is allocated. For example, if 3 widgets are defined at 40% width each then the client will
|
||||||
|
attempt to show them at 33% width each.
|
||||||
|
|
||||||
|
Note that the client may impose minimum widths on the widgets, such as a 10% minimum to avoid pinning
|
||||||
|
hidden widgets. In general, widgets defined in the 30-70% range each will be free of these restrictions.
|
||||||
|
|
||||||
|
The `height` is not in fact applied per-widget but is recorded per-widget for potential future
|
||||||
|
capabilities in future containers. The top container will take the tallest `height` and use that for
|
||||||
|
the height of the whole container, and thus all widgets in that container. The `height` is relative
|
||||||
|
to the container, like with `width`, meaning that 100% will consume as much space as the client is
|
||||||
|
willing to sacrifice to the widget container. Like with `width`, the client may impose minimums to avoid
|
||||||
|
the container being uselessly small. Heights in the 30-100% range are generally acceptable. The height
|
||||||
|
is also clamped to be within 0-100, inclusive.
|
||||||
|
|
||||||
|
## `right` container
|
||||||
|
|
||||||
|
This is the default container and has no special configuration. Widgets which overflow from the top
|
||||||
|
container will be put in this container instead. Putting a widget in the right container does not
|
||||||
|
automatically show it - it only mentions that widgets should not be in another container.
|
||||||
|
|
||||||
|
The behaviour of this container may change in the future.
|
138
package.json
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "matrix-react-sdk",
|
"name": "matrix-react-sdk",
|
||||||
"version": "3.12.0",
|
"version": "3.13.1",
|
||||||
"description": "SDK for matrix.org using React",
|
"description": "SDK for matrix.org using React",
|
||||||
"author": "matrix.org",
|
"author": "matrix.org",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -54,48 +54,47 @@
|
||||||
"test:e2e": "./test/end-to-end-tests/run.sh --app-url http://localhost:8080"
|
"test:e2e": "./test/end-to-end-tests/run.sh --app-url http://localhost:8080"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.10.5",
|
"@babel/runtime": "^7.12.5",
|
||||||
"await-lock": "^2.0.1",
|
"await-lock": "^2.1.0",
|
||||||
"blueimp-canvas-to-blob": "^3.27.0",
|
"blueimp-canvas-to-blob": "^3.28.0",
|
||||||
"browser-encrypt-attachment": "^0.3.0",
|
"browser-encrypt-attachment": "^0.3.0",
|
||||||
"browser-request": "^0.3.3",
|
"browser-request": "^0.3.3",
|
||||||
"cheerio": "^1.0.0-rc.3",
|
"cheerio": "^1.0.0-rc.5",
|
||||||
"classnames": "^2.2.6",
|
"classnames": "^2.2.6",
|
||||||
"commonmark": "^0.29.1",
|
"commonmark": "^0.29.3",
|
||||||
"counterpart": "^0.18.6",
|
"counterpart": "^0.18.6",
|
||||||
"diff-dom": "^4.1.6",
|
"diff-dom": "^4.2.2",
|
||||||
"diff-match-patch": "^1.0.5",
|
"diff-match-patch": "^1.0.5",
|
||||||
"emojibase-data": "^5.0.1",
|
"emojibase-data": "^5.1.1",
|
||||||
"emojibase-regex": "^4.0.1",
|
"emojibase-regex": "^4.1.1",
|
||||||
"escape-html": "^1.0.3",
|
"escape-html": "^1.0.3",
|
||||||
"file-saver": "^1.3.8",
|
"file-saver": "^2.0.5",
|
||||||
"filesize": "3.6.1",
|
"filesize": "6.1.0",
|
||||||
"flux": "2.1.1",
|
"flux": "2.1.1",
|
||||||
"focus-visible": "^5.1.0",
|
"focus-visible": "^5.2.0",
|
||||||
"fuse.js": "^2.7.4",
|
|
||||||
"gfm.css": "^1.1.2",
|
"gfm.css": "^1.1.2",
|
||||||
"glob-to-regexp": "^0.4.1",
|
"glob-to-regexp": "^0.4.1",
|
||||||
"highlight.js": "^10.1.2",
|
"highlight.js": "^10.5.0",
|
||||||
"html-entities": "^1.3.1",
|
"html-entities": "^1.4.0",
|
||||||
"is-ip": "^2.0.0",
|
"is-ip": "^3.1.0",
|
||||||
"katex": "^0.12.0",
|
"katex": "^0.12.0",
|
||||||
"linkifyjs": "^2.1.9",
|
"linkifyjs": "^2.1.9",
|
||||||
"lodash": "^4.17.19",
|
"lodash": "^4.17.20",
|
||||||
"matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop",
|
"matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop",
|
||||||
"matrix-widget-api": "0.1.0-beta.11",
|
"matrix-widget-api": "^0.1.0-beta.13",
|
||||||
"minimist": "^1.2.5",
|
"minimist": "^1.2.5",
|
||||||
"pako": "^1.0.11",
|
"pako": "^2.0.3",
|
||||||
"parse5": "^5.1.1",
|
"parse5": "^6.0.1",
|
||||||
"png-chunks-extract": "^1.0.0",
|
"png-chunks-extract": "^1.0.0",
|
||||||
"project-name-generator": "^2.1.7",
|
"project-name-generator": "^2.1.9",
|
||||||
"prop-types": "^15.7.2",
|
"prop-types": "^15.7.2",
|
||||||
"qrcode": "^1.4.4",
|
"qrcode": "^1.4.4",
|
||||||
"qs": "^6.9.4",
|
"qs": "^6.9.6",
|
||||||
"re-resizable": "^6.5.4",
|
"re-resizable": "^6.9.0",
|
||||||
"react": "^16.13.1",
|
"react": "^16.14.0",
|
||||||
"react-beautiful-dnd": "^4.0.1",
|
"react-beautiful-dnd": "^4.0.1",
|
||||||
"react-dom": "^16.13.1",
|
"react-dom": "^16.14.0",
|
||||||
"react-focus-lock": "^2.4.1",
|
"react-focus-lock": "^2.5.0",
|
||||||
"react-transition-group": "^4.4.1",
|
"react-transition-group": "^4.4.1",
|
||||||
"resize-observer-polyfill": "^1.5.1",
|
"resize-observer-polyfill": "^1.5.1",
|
||||||
"rfc4648": "^1.4.0",
|
"rfc4648": "^1.4.0",
|
||||||
|
@ -108,68 +107,71 @@
|
||||||
"zxcvbn": "^4.4.2"
|
"zxcvbn": "^4.4.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/cli": "^7.10.5",
|
"@babel/cli": "^7.12.10",
|
||||||
"@babel/core": "^7.10.5",
|
"@babel/core": "^7.12.10",
|
||||||
"@babel/parser": "^7.11.0",
|
"@babel/parser": "^7.12.11",
|
||||||
"@babel/plugin-proposal-class-properties": "^7.10.4",
|
"@babel/plugin-proposal-class-properties": "^7.12.1",
|
||||||
"@babel/plugin-proposal-decorators": "^7.10.5",
|
"@babel/plugin-proposal-decorators": "^7.12.12",
|
||||||
"@babel/plugin-proposal-export-default-from": "^7.10.4",
|
"@babel/plugin-proposal-export-default-from": "^7.12.1",
|
||||||
"@babel/plugin-proposal-numeric-separator": "^7.10.4",
|
"@babel/plugin-proposal-numeric-separator": "^7.12.7",
|
||||||
"@babel/plugin-proposal-object-rest-spread": "^7.10.4",
|
"@babel/plugin-proposal-object-rest-spread": "^7.12.1",
|
||||||
"@babel/plugin-transform-flow-comments": "^7.10.4",
|
"@babel/plugin-transform-flow-comments": "^7.12.1",
|
||||||
"@babel/plugin-transform-runtime": "^7.10.5",
|
"@babel/plugin-transform-runtime": "^7.12.10",
|
||||||
"@babel/preset-env": "^7.10.4",
|
"@babel/preset-env": "^7.12.11",
|
||||||
"@babel/preset-flow": "^7.10.4",
|
"@babel/preset-flow": "^7.12.1",
|
||||||
"@babel/preset-react": "^7.10.4",
|
"@babel/preset-react": "^7.12.10",
|
||||||
"@babel/preset-typescript": "^7.10.4",
|
"@babel/preset-typescript": "^7.12.7",
|
||||||
"@babel/register": "^7.10.5",
|
"@babel/register": "^7.12.10",
|
||||||
"@babel/traverse": "^7.11.0",
|
"@babel/traverse": "^7.12.12",
|
||||||
"@peculiar/webcrypto": "^1.1.3",
|
"@peculiar/webcrypto": "^1.1.4",
|
||||||
"@types/classnames": "^2.2.10",
|
"@sinonjs/fake-timers": "^7.0.2",
|
||||||
|
"@types/classnames": "^2.2.11",
|
||||||
"@types/counterpart": "^0.18.1",
|
"@types/counterpart": "^0.18.1",
|
||||||
"@types/flux": "^3.1.9",
|
"@types/flux": "^3.1.9",
|
||||||
"@types/jest": "^26.0.20",
|
"@types/jest": "^26.0.20",
|
||||||
"@types/linkifyjs": "^2.1.3",
|
"@types/linkifyjs": "^2.1.3",
|
||||||
"@types/lodash": "^4.14.158",
|
"@types/lodash": "^4.14.168",
|
||||||
"@types/modernizr": "^3.5.3",
|
"@types/modernizr": "^3.5.3",
|
||||||
"@types/node": "^12.12.51",
|
"@types/node": "^14.14.22",
|
||||||
"@types/pako": "^1.0.1",
|
"@types/pako": "^1.0.1",
|
||||||
"@types/qrcode": "^1.3.4",
|
"@types/qrcode": "^1.3.5",
|
||||||
"@types/react": "^16.9",
|
"@types/react": "^16.9",
|
||||||
"@types/react-dom": "^16.9.8",
|
"@types/react-dom": "^16.9.10",
|
||||||
"@types/react-transition-group": "^4.4.0",
|
"@types/react-transition-group": "^4.4.0",
|
||||||
"@types/sanitize-html": "^1.23.3",
|
"@types/sanitize-html": "^1.27.0",
|
||||||
"@types/zxcvbn": "^4.4.0",
|
"@types/zxcvbn": "^4.4.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^3.7.0",
|
"@typescript-eslint/eslint-plugin": "^4.14.0",
|
||||||
"@typescript-eslint/parser": "^3.7.0",
|
"@typescript-eslint/parser": "^4.14.0",
|
||||||
"babel-eslint": "^10.1.0",
|
"babel-eslint": "^10.1.0",
|
||||||
"babel-jest": "^24.9.0",
|
"babel-jest": "^26.6.3",
|
||||||
"chokidar": "^3.4.1",
|
"chokidar": "^3.5.1",
|
||||||
"concurrently": "^4.1.2",
|
"concurrently": "^5.3.0",
|
||||||
"enzyme": "^3.11.0",
|
"enzyme": "^3.11.0",
|
||||||
"enzyme-adapter-react-16": "^1.15.2",
|
"enzyme-adapter-react-16": "^1.15.6",
|
||||||
"eslint": "7.5.0",
|
"eslint": "7.18.0",
|
||||||
"eslint-config-matrix-org": "^0.1.2",
|
"eslint-config-matrix-org": "^0.2.0",
|
||||||
"eslint-plugin-babel": "^5.3.1",
|
"eslint-plugin-babel": "^5.3.1",
|
||||||
"eslint-plugin-flowtype": "^2.50.3",
|
"eslint-plugin-flowtype": "^5.2.0",
|
||||||
"eslint-plugin-react": "^7.20.3",
|
"eslint-plugin-react": "^7.22.0",
|
||||||
"eslint-plugin-react-hooks": "^2.5.1",
|
"eslint-plugin-react-hooks": "^4.2.0",
|
||||||
"glob": "^5.0.15",
|
"glob": "^7.1.6",
|
||||||
"jest": "^26.5.2",
|
"jest": "^26.6.3",
|
||||||
"jest-canvas-mock": "^2.3.0",
|
"jest-canvas-mock": "^2.3.0",
|
||||||
"jest-environment-jsdom-sixteen": "^1.0.3",
|
"jest-environment-jsdom-sixteen": "^1.0.3",
|
||||||
"lolex": "^5.1.2",
|
|
||||||
"matrix-mock-request": "^1.2.3",
|
"matrix-mock-request": "^1.2.3",
|
||||||
"matrix-react-test-utils": "^0.2.2",
|
"matrix-react-test-utils": "^0.2.2",
|
||||||
"olm": "https://packages.matrix.org/npm/olm/olm-3.2.1.tgz",
|
"olm": "https://packages.matrix.org/npm/olm/olm-3.2.1.tgz",
|
||||||
"react-test-renderer": "^16.13.1",
|
"react-test-renderer": "^16.14.0",
|
||||||
"rimraf": "^2.7.1",
|
"rimraf": "^3.0.2",
|
||||||
"stylelint": "^9.10.1",
|
"stylelint": "^13.9.0",
|
||||||
"stylelint-config-standard": "^18.3.0",
|
"stylelint-config-standard": "^20.0.0",
|
||||||
"stylelint-scss": "^3.18.0",
|
"stylelint-scss": "^3.18.0",
|
||||||
"typescript": "^3.9.7",
|
"typescript": "^4.1.3",
|
||||||
"walk": "^2.3.14"
|
"walk": "^2.3.14"
|
||||||
},
|
},
|
||||||
|
"resolutions": {
|
||||||
|
"**/@types/react": "^16.14"
|
||||||
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
"testEnvironment": "./__test-utils__/environment.js",
|
"testEnvironment": "./__test-utils__/environment.js",
|
||||||
"testMatch": [
|
"testMatch": [
|
||||||
|
|
|
@ -21,6 +21,11 @@ limitations under the License.
|
||||||
|
|
||||||
$hover-transition: 0.08s cubic-bezier(.46, .03, .52, .96); // quadratic
|
$hover-transition: 0.08s cubic-bezier(.46, .03, .52, .96); // quadratic
|
||||||
|
|
||||||
|
$EventTile_e2e_state_indicator_width: 4px;
|
||||||
|
|
||||||
|
$MessageTimestamp_width: 46px; /* 8 + 30 (avatar) + 8 */
|
||||||
|
$MessageTimestamp_width_hover: calc($MessageTimestamp_width - 2 * $EventTile_e2e_state_indicator_width);
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,6 +71,7 @@
|
||||||
@import "./views/dialogs/_EditCommunityPrototypeDialog.scss";
|
@import "./views/dialogs/_EditCommunityPrototypeDialog.scss";
|
||||||
@import "./views/dialogs/_FeedbackDialog.scss";
|
@import "./views/dialogs/_FeedbackDialog.scss";
|
||||||
@import "./views/dialogs/_GroupAddressPicker.scss";
|
@import "./views/dialogs/_GroupAddressPicker.scss";
|
||||||
|
@import "./views/dialogs/_HostSignupDialog.scss";
|
||||||
@import "./views/dialogs/_IncomingSasDialog.scss";
|
@import "./views/dialogs/_IncomingSasDialog.scss";
|
||||||
@import "./views/dialogs/_InviteDialog.scss";
|
@import "./views/dialogs/_InviteDialog.scss";
|
||||||
@import "./views/dialogs/_KeyboardShortcutsDialog.scss";
|
@import "./views/dialogs/_KeyboardShortcutsDialog.scss";
|
||||||
|
@ -106,6 +107,7 @@
|
||||||
@import "./views/elements/_AddressTile.scss";
|
@import "./views/elements/_AddressTile.scss";
|
||||||
@import "./views/elements/_DesktopBuildsNotice.scss";
|
@import "./views/elements/_DesktopBuildsNotice.scss";
|
||||||
@import "./views/elements/_DirectorySearchBox.scss";
|
@import "./views/elements/_DirectorySearchBox.scss";
|
||||||
|
@import "./views/elements/_DesktopCapturerSourcePicker.scss";
|
||||||
@import "./views/elements/_Dropdown.scss";
|
@import "./views/elements/_Dropdown.scss";
|
||||||
@import "./views/elements/_EditableItemList.scss";
|
@import "./views/elements/_EditableItemList.scss";
|
||||||
@import "./views/elements/_ErrorBoundary.scss";
|
@import "./views/elements/_ErrorBoundary.scss";
|
||||||
|
|
|
@ -134,7 +134,7 @@ limitations under the License.
|
||||||
mask-position: center;
|
mask-position: center;
|
||||||
mask-size: contain;
|
mask-size: contain;
|
||||||
mask-repeat: no-repeat;
|
mask-repeat: no-repeat;
|
||||||
mask-image: url('$(res)/img/feather-customised/widget/maximise.svg');
|
mask-image: url('$(res)/img/feather-customised/maximise.svg');
|
||||||
background: $muted-fg-color;
|
background: $muted-fg-color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,28 +64,23 @@ limitations under the License.
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_RoomDirectory_table {
|
.mx_RoomDirectory_table {
|
||||||
font-size: $font-12px;
|
|
||||||
color: $primary-fg-color;
|
color: $primary-fg-color;
|
||||||
width: 100%;
|
display: grid;
|
||||||
|
font-size: $font-12px;
|
||||||
|
grid-template-columns: max-content auto max-content max-content max-content;
|
||||||
|
row-gap: 24px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
table-layout: fixed;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_RoomDirectory_roomAvatar {
|
.mx_RoomDirectory_roomAvatar {
|
||||||
width: 32px;
|
padding: 2px 14px 0 0;
|
||||||
padding-right: 14px;
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mx_RoomDirectory_roomDescription {
|
|
||||||
padding-bottom: 16px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_RoomDirectory_roomMemberCount {
|
.mx_RoomDirectory_roomMemberCount {
|
||||||
|
align-self: center;
|
||||||
color: $light-fg-color;
|
color: $light-fg-color;
|
||||||
width: 60px;
|
padding: 3px 10px 0;
|
||||||
padding: 0 10px;
|
|
||||||
text-align: center;
|
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
background-color: $light-fg-color;
|
background-color: $light-fg-color;
|
||||||
|
@ -105,8 +100,7 @@ limitations under the License.
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_RoomDirectory_join, .mx_RoomDirectory_preview {
|
.mx_RoomDirectory_join, .mx_RoomDirectory_preview {
|
||||||
width: 80px;
|
align-self: center;
|
||||||
text-align: center;
|
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -219,7 +219,7 @@ hr.mx_RoomView_myReadMarker {
|
||||||
position: relative;
|
position: relative;
|
||||||
top: -1px;
|
top: -1px;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
transition: width 400ms easeInSine 1s, opacity 400ms easeInSine 1s;
|
transition: width 400ms easeinsine 1s, opacity 400ms easeinsine 1s;
|
||||||
width: 99%;
|
width: 99%;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -272,6 +272,9 @@ limitations under the License.
|
||||||
.mx_UserMenu_iconHome::before {
|
.mx_UserMenu_iconHome::before {
|
||||||
mask-image: url('$(res)/img/element-icons/roomlist/home.svg');
|
mask-image: url('$(res)/img/element-icons/roomlist/home.svg');
|
||||||
}
|
}
|
||||||
|
.mx_UserMenu_iconHosting::before {
|
||||||
|
mask-image: url('$(res)/img/element-icons/brands/element.svg');
|
||||||
|
}
|
||||||
|
|
||||||
.mx_UserMenu_iconBell::before {
|
.mx_UserMenu_iconBell::before {
|
||||||
mask-image: url('$(res)/img/element-icons/notifications.svg');
|
mask-image: url('$(res)/img/element-icons/notifications.svg');
|
||||||
|
|
|
@ -34,7 +34,7 @@ limitations under the License.
|
||||||
h3 {
|
h3 {
|
||||||
font-size: $font-14px;
|
font-size: $font-14px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: $authpage-primary-color;
|
color: $authpage-secondary-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
h3.mx_AuthBody_centered {
|
h3.mx_AuthBody_centered {
|
||||||
|
|
|
@ -18,7 +18,7 @@ limitations under the License.
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
width: 206px;
|
width: 206px;
|
||||||
padding: 25px 40px;
|
padding: 25px 25px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ limitations under the License.
|
||||||
.mx_AuthHeaderLogo {
|
.mx_AuthHeaderLogo {
|
||||||
margin-top: 15px;
|
margin-top: 15px;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
padding: 0 10px;
|
padding: 0 25px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_AuthHeaderLogo img {
|
.mx_AuthHeaderLogo img {
|
||||||
|
|
|
@ -83,7 +83,10 @@ limitations under the License.
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_InteractiveAuthEntryComponents_termsPolicy {
|
.mx_InteractiveAuthEntryComponents_termsPolicy {
|
||||||
display: block;
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: start;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_InteractiveAuthEntryComponents_passwordSection {
|
.mx_InteractiveAuthEntryComponents_passwordSection {
|
||||||
|
|
|
@ -23,6 +23,7 @@ limitations under the License.
|
||||||
font-size: $font-14px;
|
font-size: $font-14px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: $authpage-lang-color;
|
color: $authpage-lang-color;
|
||||||
|
width: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_AuthBody_language .mx_Dropdown_arrow {
|
.mx_AuthBody_language .mx_Dropdown_arrow {
|
||||||
|
|
|
@ -18,7 +18,6 @@ limitations under the License.
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
&.mx_WelcomePage_registrationDisabled {
|
&.mx_WelcomePage_registrationDisabled {
|
||||||
.mx_ButtonCreateAccount {
|
.mx_ButtonCreateAccount {
|
||||||
display: none;
|
display: none;
|
||||||
|
@ -27,6 +26,6 @@ limitations under the License.
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_Welcome .mx_AuthBody_language {
|
.mx_Welcome .mx_AuthBody_language {
|
||||||
width: 120px;
|
width: 160px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
138
res/css/views/dialogs/_HostSignupDialog.scss
Normal file
|
@ -0,0 +1,138 @@
|
||||||
|
/*
|
||||||
|
Copyright 2021 The Matrix.org Foundation C.I.C.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.mx_HostSignupDialog {
|
||||||
|
width: 90vw;
|
||||||
|
max-width: 580px;
|
||||||
|
height: 80vh;
|
||||||
|
max-height: 600px;
|
||||||
|
|
||||||
|
.mx_HostSignupDialog_info {
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
.mx_HostSignupDialog_content_top {
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_HostSignupDialog_paragraphs {
|
||||||
|
text-align: left;
|
||||||
|
padding-left: 25%;
|
||||||
|
padding-right: 25%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_HostSignupDialog_buttons {
|
||||||
|
margin-bottom: 24px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
button {
|
||||||
|
padding: 12px;
|
||||||
|
margin: 0 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_HostSignupDialog_footer {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: baseline;
|
||||||
|
|
||||||
|
img {
|
||||||
|
padding-right: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
iframe {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
border: none;
|
||||||
|
background-color: #fff;
|
||||||
|
min-height: 540px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_HostSignupDialog_text_dark {
|
||||||
|
color: $primary-fg-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_HostSignupDialog_text_light {
|
||||||
|
color: $secondary-fg-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_HostSignup_maximize_button {
|
||||||
|
mask: url('$(res)/img/feather-customised/maximise.svg');
|
||||||
|
mask-repeat: no-repeat;
|
||||||
|
mask-position: center;
|
||||||
|
mask-size: cover;
|
||||||
|
width: 14px;
|
||||||
|
height: 14px;
|
||||||
|
background-color: $dialog-close-fg-color;
|
||||||
|
cursor: pointer;
|
||||||
|
position: absolute;
|
||||||
|
top: 10px;
|
||||||
|
right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_HostSignup_minimize_button {
|
||||||
|
mask: url('$(res)/img/feather-customised/minimise.svg');
|
||||||
|
mask-repeat: no-repeat;
|
||||||
|
mask-position: center;
|
||||||
|
mask-size: cover;
|
||||||
|
width: 14px;
|
||||||
|
height: 14px;
|
||||||
|
background-color: $dialog-close-fg-color;
|
||||||
|
cursor: pointer;
|
||||||
|
position: absolute;
|
||||||
|
top: 10px;
|
||||||
|
right: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_HostSignup_persisted {
|
||||||
|
width: 90vw;
|
||||||
|
max-width: 580px;
|
||||||
|
height: 80vh;
|
||||||
|
max-height: 600px;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
position: fixed;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_HostSignupDialog_minimized {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 80px;
|
||||||
|
right: 26px;
|
||||||
|
width: 314px;
|
||||||
|
height: 217px;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
&.mx_Dialog {
|
||||||
|
padding: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_Dialog_title {
|
||||||
|
text-align: left !important;
|
||||||
|
padding-left: 20px;
|
||||||
|
font-size: $font-15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
iframe {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
border: none;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
}
|
72
res/css/views/elements/_DesktopCapturerSourcePicker.scss
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
/*
|
||||||
|
Copyright 2021 Šimon Brandner <simon.bra.ag@gmail.com>
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.mx_desktopCapturerSourcePicker {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_desktopCapturerSourcePicker_tabLabels {
|
||||||
|
display: flex;
|
||||||
|
padding: 0 0 8px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_desktopCapturerSourcePicker_tabLabel,
|
||||||
|
.mx_desktopCapturerSourcePicker_tabLabel_selected {
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 8px 0;
|
||||||
|
font-size: $font-13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_desktopCapturerSourcePicker_tabLabel_selected {
|
||||||
|
background-color: $tab-label-active-bg-color;
|
||||||
|
color: $tab-label-active-fg-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_desktopCapturerSourcePicker_panel {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: flex-start;
|
||||||
|
height: 500px;
|
||||||
|
overflow: overlay;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_desktopCapturerSourcePicker_stream_button {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
margin: 8px;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_desktopCapturerSourcePicker_stream_button:hover,
|
||||||
|
.mx_desktopCapturerSourcePicker_stream_button:focus {
|
||||||
|
background: $roomtile-selected-bg-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_desktopCapturerSourcePicker_stream_thumbnail {
|
||||||
|
margin: 4px;
|
||||||
|
width: 312px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_desktopCapturerSourcePicker_stream_name {
|
||||||
|
margin: 0 4px;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
overflow: hidden;
|
||||||
|
width: 312px;
|
||||||
|
}
|
|
@ -16,13 +16,26 @@ limitations under the License.
|
||||||
|
|
||||||
.mx_SSOButtons {
|
.mx_SSOButtons {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
||||||
|
.mx_SSOButtons_row {
|
||||||
|
& + .mx_SSOButtons_row {
|
||||||
|
margin-top: 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.mx_SSOButton {
|
.mx_SSOButton {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding-left: 32px;
|
padding: 7px 32px;
|
||||||
padding-right: 32px;
|
text-align: center;
|
||||||
|
border-radius: 8px;
|
||||||
|
display: inline-block;
|
||||||
|
font-size: $font-14px;
|
||||||
|
font-weight: $font-semi-bold;
|
||||||
|
border: 1px solid $input-border-color;
|
||||||
|
color: $primary-fg-color;
|
||||||
|
|
||||||
> img {
|
> img {
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
|
@ -32,10 +45,22 @@ limitations under the License.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mx_SSOButton_default {
|
||||||
|
color: $button-primary-bg-color;
|
||||||
|
background-color: $button-secondary-bg-color;
|
||||||
|
border-color: $button-primary-bg-color;
|
||||||
|
}
|
||||||
|
.mx_SSOButton_default.mx_SSOButton_primary {
|
||||||
|
color: $button-primary-fg-color;
|
||||||
|
background-color: $button-primary-bg-color;
|
||||||
|
}
|
||||||
|
|
||||||
.mx_SSOButton_mini {
|
.mx_SSOButton_mini {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
width: 50px; // 48px + 1px border on all sides
|
width: 50px; // 48px + 1px border on all sides
|
||||||
height: 50px; // 48px + 1px border on all sides
|
height: 50px; // 48px + 1px border on all sides
|
||||||
|
min-width: 50px; // prevent crushing by the flexbox
|
||||||
|
padding: 12px;
|
||||||
|
|
||||||
> img {
|
> img {
|
||||||
left: 12px;
|
left: 12px;
|
||||||
|
@ -43,7 +68,7 @@ limitations under the License.
|
||||||
}
|
}
|
||||||
|
|
||||||
& + .mx_SSOButton_mini {
|
& + .mx_SSOButton_mini {
|
||||||
margin-left: 24px;
|
margin-left: 16px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ limitations under the License.
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_ServerPicker_server {
|
.mx_ServerPicker_server {
|
||||||
color: $primary-fg-color;
|
color: $authpage-primary-color;
|
||||||
grid-column: 1;
|
grid-column: 1;
|
||||||
grid-row: 2;
|
grid-row: 2;
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
|
|
|
@ -30,7 +30,7 @@ limitations under the License.
|
||||||
mask-size: contain;
|
mask-size: contain;
|
||||||
content: '';
|
content: '';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 2px;
|
top: 1px;
|
||||||
left: 0;
|
left: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,13 +35,13 @@ limitations under the License.
|
||||||
mask-size: auto 12px;
|
mask-size: auto 12px;
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
background-color: $accent-color;
|
background-color: $accent-color;
|
||||||
mask-image: url('$(res)/img/feather-customised/widget/maximise.svg');
|
mask-image: url('$(res)/img/feather-customised/maximise.svg');
|
||||||
}
|
}
|
||||||
|
|
||||||
&.mx_ViewSourceEvent_expanded .mx_ViewSourceEvent_toggle {
|
&.mx_ViewSourceEvent_expanded .mx_ViewSourceEvent_toggle {
|
||||||
mask-position: 0 bottom;
|
mask-position: 0 bottom;
|
||||||
margin-bottom: 7px;
|
margin-bottom: 7px;
|
||||||
mask-image: url('$(res)/img/feather-customised/widget/minimise.svg');
|
mask-image: url('$(res)/img/feather-customised/minimise.svg');
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover .mx_ViewSourceEvent_toggle {
|
&:hover .mx_ViewSourceEvent_toggle {
|
||||||
|
|
|
@ -26,7 +26,7 @@ $left-gutter: 64px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_EventTile.mx_EventTile_info {
|
.mx_EventTile.mx_EventTile_info {
|
||||||
padding-top: 0px;
|
padding-top: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_EventTile_avatar {
|
.mx_EventTile_avatar {
|
||||||
|
@ -37,7 +37,7 @@ $left-gutter: 64px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_EventTile.mx_EventTile_info .mx_EventTile_avatar {
|
.mx_EventTile.mx_EventTile_info .mx_EventTile_avatar {
|
||||||
top: $font-8px;
|
top: $font-6px;
|
||||||
left: $left-gutter;
|
left: $left-gutter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,6 @@ $left-gutter: 64px;
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
height: 16px;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
|
|
||||||
|
@ -421,15 +420,15 @@ $left-gutter: 64px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_EventTile:hover.mx_EventTile_verified .mx_EventTile_line {
|
.mx_EventTile:hover.mx_EventTile_verified .mx_EventTile_line {
|
||||||
border-left: $e2e-verified-color 4px solid;
|
border-left: $e2e-verified-color $EventTile_e2e_state_indicator_width solid;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_EventTile:hover.mx_EventTile_unverified .mx_EventTile_line {
|
.mx_EventTile:hover.mx_EventTile_unverified .mx_EventTile_line {
|
||||||
border-left: $e2e-unverified-color 4px solid;
|
border-left: $e2e-unverified-color $EventTile_e2e_state_indicator_width solid;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_EventTile:hover.mx_EventTile_unknown .mx_EventTile_line {
|
.mx_EventTile:hover.mx_EventTile_unknown .mx_EventTile_line {
|
||||||
border-left: $e2e-unknown-color 4px solid;
|
border-left: $e2e-unknown-color $EventTile_e2e_state_indicator_width solid;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_EventTile:hover.mx_EventTile_verified.mx_EventTile_info .mx_EventTile_line,
|
.mx_EventTile:hover.mx_EventTile_verified.mx_EventTile_info .mx_EventTile_line,
|
||||||
|
@ -447,8 +446,7 @@ $left-gutter: 64px;
|
||||||
.mx_EventTile:hover.mx_EventTile_verified .mx_EventTile_line > a > .mx_MessageTimestamp,
|
.mx_EventTile:hover.mx_EventTile_verified .mx_EventTile_line > a > .mx_MessageTimestamp,
|
||||||
.mx_EventTile:hover.mx_EventTile_unverified .mx_EventTile_line > a > .mx_MessageTimestamp,
|
.mx_EventTile:hover.mx_EventTile_unverified .mx_EventTile_line > a > .mx_MessageTimestamp,
|
||||||
.mx_EventTile:hover.mx_EventTile_unknown .mx_EventTile_line > a > .mx_MessageTimestamp {
|
.mx_EventTile:hover.mx_EventTile_unknown .mx_EventTile_line > a > .mx_MessageTimestamp {
|
||||||
left: 3px;
|
width: $MessageTimestamp_width_hover;
|
||||||
width: auto;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Explicit relationships so that it doesn't apply to nested EventTile components (e.g in Replies)
|
// Explicit relationships so that it doesn't apply to nested EventTile components (e.g in Replies)
|
||||||
|
@ -493,7 +491,6 @@ $left-gutter: 64px;
|
||||||
// https://github.com/vector-im/vector-web/issues/754
|
// https://github.com/vector-im/vector-web/issues/754
|
||||||
overflow-x: overlay;
|
overflow-x: overlay;
|
||||||
overflow-y: visible;
|
overflow-y: visible;
|
||||||
max-height: 30vh;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
code {
|
code {
|
||||||
|
@ -502,6 +499,22 @@ $left-gutter: 64px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mx_EventTile_lineNumbers {
|
||||||
|
float: left;
|
||||||
|
margin: 0 0.5em 0 -1.5em;
|
||||||
|
color: gray;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_EventTile_lineNumber {
|
||||||
|
text-align: right;
|
||||||
|
display: block;
|
||||||
|
padding-left: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_EventTile_collapsedCodeBlock {
|
||||||
|
max-height: 30vh;
|
||||||
|
}
|
||||||
|
|
||||||
.mx_EventTile:hover .mx_EventTile_body pre,
|
.mx_EventTile:hover .mx_EventTile_body pre,
|
||||||
.mx_EventTile.focus-visible:focus-within .mx_EventTile_body pre {
|
.mx_EventTile.focus-visible:focus-within .mx_EventTile_body pre {
|
||||||
border: 1px solid #e5e5e5; // deliberate constant as we're behind an invert filter
|
border: 1px solid #e5e5e5; // deliberate constant as we're behind an invert filter
|
||||||
|
@ -513,21 +526,42 @@ $left-gutter: 64px;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inserted adjacent to <pre> blocks, (See TextualBody)
|
// Inserted adjacent to <pre> blocks, (See TextualBody)
|
||||||
.mx_EventTile_copyButton {
|
.mx_EventTile_button {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
top: 6px;
|
top: 6px;
|
||||||
right: 6px;
|
right: 12px;
|
||||||
width: 19px;
|
width: 19px;
|
||||||
height: 19px;
|
height: 19px;
|
||||||
mask-image: url($copy-button-url);
|
|
||||||
background-color: $message-action-bar-fg-color;
|
background-color: $message-action-bar-fg-color;
|
||||||
}
|
}
|
||||||
|
.mx_EventTile_buttonBottom {
|
||||||
|
top: 31px;
|
||||||
|
}
|
||||||
|
.mx_EventTile_copyButton {
|
||||||
|
mask-image: url($copy-button-url);
|
||||||
|
}
|
||||||
|
.mx_EventTile_collapseButton {
|
||||||
|
mask-size: 75%;
|
||||||
|
mask-position: center;
|
||||||
|
mask-repeat: no-repeat;
|
||||||
|
mask-image: url($collapse-button-url);
|
||||||
|
}
|
||||||
|
.mx_EventTile_expandButton {
|
||||||
|
mask-size: 75%;
|
||||||
|
mask-position: center;
|
||||||
|
mask-repeat: no-repeat;
|
||||||
|
mask-image: url($expand-button-url);
|
||||||
|
}
|
||||||
|
|
||||||
.mx_EventTile_body .mx_EventTile_pre_container:focus-within .mx_EventTile_copyButton,
|
.mx_EventTile_body .mx_EventTile_pre_container:focus-within .mx_EventTile_copyButton,
|
||||||
.mx_EventTile_body .mx_EventTile_pre_container:hover .mx_EventTile_copyButton {
|
.mx_EventTile_body .mx_EventTile_pre_container:hover .mx_EventTile_copyButton,
|
||||||
|
.mx_EventTile_body .mx_EventTile_pre_container:focus-within .mx_EventTile_collapseButton,
|
||||||
|
.mx_EventTile_body .mx_EventTile_pre_container:hover .mx_EventTile_collapseButton,
|
||||||
|
.mx_EventTile_body .mx_EventTile_pre_container:focus-within .mx_EventTile_expandButton,
|
||||||
|
.mx_EventTile_body .mx_EventTile_pre_container:hover .mx_EventTile_expandButton {
|
||||||
visibility: visible;
|
visibility: visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ $left-gutter: 64px;
|
||||||
.mx_GroupLayout {
|
.mx_GroupLayout {
|
||||||
.mx_EventTile {
|
.mx_EventTile {
|
||||||
> .mx_SenderProfile {
|
> .mx_SenderProfile {
|
||||||
line-height: $font-17px;
|
line-height: $font-20px;
|
||||||
padding-left: $left-gutter;
|
padding-left: $left-gutter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,11 +34,11 @@ $left-gutter: 64px;
|
||||||
|
|
||||||
.mx_MessageTimestamp {
|
.mx_MessageTimestamp {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 46px; /* 8 + 30 (avatar) + 8 */
|
width: $MessageTimestamp_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_EventTile_line, .mx_EventTile_reply {
|
.mx_EventTile_line, .mx_EventTile_reply {
|
||||||
padding-top: 3px;
|
padding-top: 1px;
|
||||||
padding-bottom: 3px;
|
padding-bottom: 3px;
|
||||||
line-height: $font-22px;
|
line-height: $font-22px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,6 +207,17 @@ $irc-line-height: $font-18px;
|
||||||
width: unset;
|
width: unset;
|
||||||
max-width: var(--name-width);
|
max-width: var(--name-width);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mx_SenderProfile_hover {
|
||||||
|
background: transparent;
|
||||||
|
|
||||||
|
> span {
|
||||||
|
> .mx_SenderProfile_name,
|
||||||
|
> .mx_SenderProfile_aux {
|
||||||
|
min-width: inherit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_ProfileResizer {
|
.mx_ProfileResizer {
|
||||||
|
|
|
@ -64,6 +64,7 @@ limitations under the License.
|
||||||
|
|
||||||
.mx_UserNotifSettings_notifTable {
|
.mx_UserNotifSettings_notifTable {
|
||||||
display: table;
|
display: table;
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_UserNotifSettings_notifTable .mx_Spinner {
|
.mx_UserNotifSettings_notifTable .mx_Spinner {
|
||||||
|
|
|
@ -14,6 +14,12 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
.mx_ProfileSettings_controls_topic {
|
||||||
|
& > textarea {
|
||||||
|
resize: vertical;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.mx_ProfileSettings_profile {
|
.mx_ProfileSettings_profile {
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
3
res/img/element-icons/brands/apple.svg
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<svg width="25" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M16.9803 1.2796C17.0771 2.54383 16.6773 3.79601 15.8657 4.77022C15.0784 5.74949 13.8854 6.31354 12.629 6.3006C12.5491 5.07276 12.9605 3.86352 13.7727 2.93921C14.5952 2.00238 15.7404 1.40982 16.9803 1.2796ZM20.9539 8.70795C19.5086 9.59652 18.6192 11.1635 18.5974 12.86C18.5994 14.7794 19.7489 16.5115 21.5166 17.2592C21.1766 18.3636 20.6642 19.4073 19.9982 20.3517C19.1038 21.6896 18.1661 22.9967 16.6777 23.0208C15.9698 23.0372 15.492 22.8336 14.9941 22.6215C14.4747 22.4003 13.9335 22.1697 13.0867 22.1697C12.1885 22.1697 11.6231 22.4077 11.0778 22.6372C10.6065 22.8355 10.1503 23.0275 9.50727 23.0542C8.08982 23.1067 7.00654 21.6263 6.07964 20.3009C4.22703 17.5943 2.78444 12.6733 4.71844 9.32483C5.62662 7.69286 7.32468 6.65727 9.19136 6.59696C9.99528 6.58042 10.7667 6.89028 11.443 7.16193C11.9602 7.36969 12.4219 7.5551 12.7999 7.5551C13.1321 7.5551 13.5809 7.37701 14.1038 7.16946C14.9276 6.84251 15.9356 6.44246 16.9628 6.55027C18.5589 6.60021 20.038 7.39984 20.9539 8.70795Z" fill="#17191C"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.1 KiB |
6
res/img/element-icons/brands/element.svg
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<svg width="17" height="17" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.12012 1.02C6.12012 0.45667 6.57679 0 7.14012 0C10.8957 0 13.9401 3.04446 13.9401 6.8C13.9401 7.36333 13.4834 7.82 12.9201 7.82C12.3568 7.82 11.9001 7.36333 11.9001 6.8C11.9001 4.17112 9.76899 2.04 7.14012 2.04C6.57679 2.04 6.12012 1.58333 6.12012 1.02Z" fill="#1E1E1E"/>
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.8799 15.98C10.8799 16.5433 10.4232 17 9.85988 17C6.10435 17 3.05989 13.9555 3.05989 10.2C3.05989 9.63667 3.51656 9.18 4.07989 9.18C4.64322 9.18 5.09989 9.63667 5.09989 10.2C5.09989 12.8289 7.23101 14.96 9.85988 14.96C10.4232 14.96 10.8799 15.4167 10.8799 15.98Z" fill="#1E1E1E"/>
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M1.02 10.88C0.45667 10.88 -1.99617e-08 10.4233 -4.45856e-08 9.86C-2.08745e-07 6.10447 3.04446 3.06 6.8 3.06C7.36333 3.06 7.82 3.51667 7.82 4.08C7.82 4.64334 7.36333 5.1 6.8 5.1C4.17113 5.1 2.04 7.23113 2.04 9.86C2.04 10.4233 1.58333 10.88 1.02 10.88Z" fill="#1E1E1E"/>
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M15.98 6.12C16.5433 6.12 17 6.57666 17 7.14C17 10.8955 13.9555 13.94 10.2 13.94C9.63667 13.94 9.18 13.4833 9.18 12.92C9.18 12.3567 9.63667 11.9 10.2 11.9C12.8289 11.9 14.96 9.76887 14.96 7.14C14.96 6.57666 15.4167 6.12 15.98 6.12Z" fill="#1E1E1E"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.3 KiB |
9
res/img/element-icons/brands/facebook.svg
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<svg width="25" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<mask id="mask0" mask-type="alpha" maskUnits="userSpaceOnUse" x="2" y="1" width="22" height="22">
|
||||||
|
<path d="M2.10154 1.5H23.1003V22.3716H2.10154V1.5Z" fill="white"/>
|
||||||
|
</mask>
|
||||||
|
<g mask="url(#mask0)">
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M23.1 11.999C23.1 6.20003 18.399 1.49902 12.6 1.49902C6.801 1.49902 2.1 6.20003 2.1 11.999C2.1 17.2399 5.9397 21.5838 10.9594 22.3715V15.0342H8.29336V11.999H10.9594V9.68574C10.9594 7.05418 12.5269 5.60059 14.9254 5.60059C16.0742 5.60059 17.2758 5.80566 17.2758 5.80566V8.38965H15.9518C14.6474 8.38965 14.2406 9.19903 14.2406 10.0294V11.999H17.1527L16.6872 15.0342H14.2406V22.3715C19.2603 21.5838 23.1 17.2399 23.1 11.999Z" fill="#1877F2"/>
|
||||||
|
</g>
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M16.6872 15.0342L17.1527 11.999H14.2406V10.0294C14.2406 9.19903 14.6474 8.38965 15.9518 8.38965H17.2758V5.80566C17.2758 5.80566 16.0742 5.60059 14.9254 5.60059C12.5269 5.60059 10.9594 7.05418 10.9594 9.68574V11.999H8.29336V15.0342H10.9594V22.3715C11.494 22.4553 12.0419 22.499 12.6 22.499C13.1581 22.499 13.706 22.4553 14.2406 22.3715V15.0342H16.6872Z" fill="white"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.2 KiB |
3
res/img/element-icons/brands/github.svg
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<svg width="25" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M20.8421 7.10595C19.9703 5.6121 18.7876 4.42942 17.2939 3.55764C15.8 2.68581 14.169 2.25001 12.3999 2.25001C10.6311 2.25001 8.9996 2.68594 7.50597 3.55764C6.01212 4.42938 4.82953 5.6121 3.95765 7.10595C3.08592 8.59976 2.65002 10.231 2.65002 11.9997C2.65002 14.1242 3.26987 16.0346 4.50987 17.7315C5.74973 19.4284 7.35145 20.6027 9.3149 21.2543C9.54345 21.2967 9.71264 21.2669 9.82265 21.1656C9.9327 21.0641 9.98766 20.937 9.98766 20.7848C9.98766 20.7595 9.98548 20.531 9.98126 20.0993C9.9769 19.6676 9.97485 19.291 9.97485 18.9696L9.68285 19.0202C9.49667 19.0543 9.26181 19.0687 8.97826 19.0646C8.69484 19.0607 8.40061 19.031 8.09598 18.9757C7.79121 18.921 7.50775 18.7941 7.24536 18.5952C6.98311 18.3963 6.79693 18.1359 6.68688 17.8145L6.55993 17.5224C6.47531 17.3279 6.3421 17.1119 6.1601 16.875C5.97811 16.638 5.79406 16.4773 5.60789 16.3927L5.519 16.329C5.45978 16.2868 5.40482 16.2358 5.35399 16.1766C5.30321 16.1174 5.2652 16.0582 5.23981 15.9988C5.21437 15.9395 5.23545 15.8908 5.30326 15.8526C5.37107 15.8144 5.49361 15.7959 5.67143 15.7959L5.92524 15.8338C6.09451 15.8677 6.3039 15.9691 6.55366 16.1384C6.80329 16.3077 7.0085 16.5277 7.16933 16.7984C7.36408 17.1455 7.59873 17.4099 7.87392 17.5919C8.14889 17.7739 8.42613 17.8648 8.70537 17.8648C8.98461 17.8648 9.22579 17.8436 9.429 17.8015C9.63198 17.7592 9.82243 17.6955 10.0002 17.611C10.0764 17.0437 10.2838 16.6079 10.6222 16.3033C10.1399 16.2526 9.70619 16.1762 9.32099 16.0747C8.93601 15.9731 8.53818 15.8081 8.12777 15.5794C7.71714 15.3509 7.37649 15.0673 7.10574 14.7289C6.83495 14.3904 6.61271 13.9459 6.43934 13.3959C6.26588 12.8457 6.17913 12.211 6.17913 11.4916C6.17913 10.4674 6.51351 9.59578 7.18213 8.87633C6.86892 8.10629 6.89849 7.24304 7.27093 6.28668C7.51638 6.21043 7.88037 6.26765 8.36273 6.45801C8.84517 6.64845 9.1984 6.8116 9.42277 6.94686C9.64714 7.08208 9.82692 7.19666 9.96236 7.2896C10.7496 7.06963 11.562 6.95962 12.3998 6.95962C13.2377 6.95962 14.0503 7.06963 14.8376 7.2896L15.32 6.98505C15.6498 6.78185 16.0394 6.59563 16.4877 6.42635C16.9363 6.25716 17.2793 6.21056 17.5164 6.28682C17.8971 7.24322 17.931 8.10642 17.6177 8.87647C18.2863 9.59591 18.6208 10.4677 18.6208 11.4918C18.6208 12.2111 18.5337 12.8478 18.3605 13.4023C18.1871 13.9568 17.963 14.4008 17.688 14.7353C17.4127 15.0697 17.0699 15.3511 16.6595 15.5795C16.249 15.808 15.851 15.973 15.466 16.0747C15.0809 16.1763 14.6472 16.2527 14.1648 16.3035C14.6048 16.6842 14.8248 17.2851 14.8248 18.106V20.7845C14.8248 20.9367 14.8777 21.0637 14.9836 21.1652C15.0894 21.2665 15.2565 21.2964 15.485 21.2539C17.4487 20.6024 19.0505 19.4281 20.2903 17.7311C21.53 16.0343 22.15 14.1238 22.15 11.9993C22.1496 10.2309 21.7135 8.59976 20.8421 7.10595Z" fill="black"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2.8 KiB |
9
res/img/element-icons/brands/gitlab.svg
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M12.0005 20.3296L15.3166 10.1293H8.68921L12.0005 20.3296Z" fill="#E24329"/>
|
||||||
|
<path d="M4.04348 10.1293L3.03364 13.2283C2.94226 13.5097 3.04095 13.8203 3.28214 13.9957L11.9996 20.3296L4.04348 10.1293Z" fill="#FCA326"/>
|
||||||
|
<path d="M4.04248 10.1289H8.68727L6.68828 3.98572C6.58597 3.67143 6.1401 3.67143 6.03411 3.98572L4.04248 10.1289Z" fill="#E24329"/>
|
||||||
|
<path d="M19.9602 10.1293L20.9664 13.2283C21.0577 13.5097 20.9591 13.8203 20.7179 13.9957L11.9991 20.3296L19.9602 10.1293Z" fill="#FCA326"/>
|
||||||
|
<path d="M19.9616 10.1289H15.3168L17.3121 3.98572C17.4144 3.67143 17.8603 3.67143 17.9663 3.98572L19.9616 10.1289Z" fill="#E24329"/>
|
||||||
|
<path d="M11.9991 20.3296L15.3153 10.1293H19.9601L11.9991 20.3296Z" fill="#FC6D26"/>
|
||||||
|
<path d="M11.9985 20.3296L4.04248 10.1293H8.68727L11.9985 20.3296Z" fill="#FC6D26"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 905 B |
6
res/img/element-icons/brands/google.svg
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M22.501 12.2333C22.501 11.37 22.4296 10.74 22.2748 10.0867H12.2153V13.9833H18.12C18.001 14.9517 17.3582 16.41 15.9296 17.3899L15.9096 17.5204L19.0902 19.9351L19.3106 19.9567C21.3343 18.125 22.501 15.43 22.501 12.2333Z" fill="#4285F4"/>
|
||||||
|
<path d="M12.2147 22.5001C15.1075 22.5001 17.5361 21.5667 19.3099 19.9567L15.929 17.39C15.0242 18.0083 13.8099 18.44 12.2147 18.44C9.38142 18.44 6.97669 16.6083 6.11947 14.0767L5.99382 14.0871L2.68656 16.5955L2.64331 16.7133C4.40519 20.1433 8.02423 22.5001 12.2147 22.5001Z" fill="#34A853"/>
|
||||||
|
<path d="M6.12022 14.0767C5.89403 13.4234 5.76313 12.7233 5.76313 12C5.76313 11.2767 5.89403 10.5767 6.10832 9.92337L6.10233 9.78423L2.75361 7.2356L2.64405 7.28667C1.91789 8.71002 1.50122 10.3084 1.50122 12C1.50122 13.6917 1.91789 15.29 2.64405 16.7133L6.12022 14.0767Z" fill="#FBBC05"/>
|
||||||
|
<path d="M12.2148 5.55997C14.2267 5.55997 15.5838 6.41163 16.3576 7.12335L19.3814 4.23C17.5243 2.53834 15.1076 1.5 12.2148 1.5C8.02426 1.5 4.4052 3.85665 2.64331 7.28662L6.10759 9.92332C6.97671 7.39166 9.38146 5.55997 12.2148 5.55997Z" fill="#EB4335"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.2 KiB |
3
res/img/element-icons/brands/twitter.svg
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<svg width="25" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M9.04155 21C6.6153 21 4.35363 20.2943 2.45 19.0767C4.06624 19.1813 6.91855 18.9308 8.69268 17.2386C6.0238 17.1161 4.82019 15.0692 4.6632 14.1945C4.88997 14.2819 5.97147 14.3869 6.582 14.142C3.51192 13.3722 3.04094 10.678 3.1456 9.85573C3.72124 10.2581 4.69809 10.3981 5.08185 10.3631C2.22109 8.31618 3.25027 5.23707 3.75613 4.57226C5.80911 7.4165 8.8859 9.01393 12.6923 9.10278C12.6205 8.78802 12.5826 8.46032 12.5826 8.12373C12.5826 5.70819 14.5351 3.75 16.9435 3.75C18.2019 3.75 19.3358 4.28457 20.1318 5.13963C20.9727 4.94258 22.2382 4.4813 22.8569 4.0824C22.5451 5.20208 21.5742 6.13612 20.9869 6.48231C20.9918 6.49408 20.9821 6.47048 20.9869 6.48231C21.5028 6.40428 22.8986 6.13603 23.45 5.76192C23.1773 6.39094 22.148 7.4368 21.3033 8.02232C21.4604 14.9535 16.1574 21 9.04155 21Z" fill="#1D9BF0"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 916 B |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
@ -258,6 +258,7 @@ $composer-shadow-color: rgba(0, 0, 0, 0.28);
|
||||||
// markdown overrides:
|
// markdown overrides:
|
||||||
.mx_EventTile_content .markdown-body pre:hover {
|
.mx_EventTile_content .markdown-body pre:hover {
|
||||||
border-color: #808080 !important; // inverted due to rules below
|
border-color: #808080 !important; // inverted due to rules below
|
||||||
|
scrollbar-color: rgba(0, 0, 0, 0.2) transparent; // copied from light theme due to inversion below
|
||||||
}
|
}
|
||||||
.mx_EventTile_content .markdown-body {
|
.mx_EventTile_content .markdown-body {
|
||||||
pre, code {
|
pre, code {
|
||||||
|
|
|
@ -237,7 +237,8 @@ $event-redacted-border-color: #cccccc;
|
||||||
$event-timestamp-color: #acacac;
|
$event-timestamp-color: #acacac;
|
||||||
|
|
||||||
$copy-button-url: "$(res)/img/feather-customised/clipboard.svg";
|
$copy-button-url: "$(res)/img/feather-customised/clipboard.svg";
|
||||||
|
$collapse-button-url: "$(res)/img/feather-customised/minimise.svg";
|
||||||
|
$expand-button-url: "$(res)/img/feather-customised/maximise.svg";
|
||||||
|
|
||||||
// e2e
|
// e2e
|
||||||
$e2e-verified-color: #76cfa5; // N.B. *NOT* the same as $accent-color
|
$e2e-verified-color: #76cfa5; // N.B. *NOT* the same as $accent-color
|
||||||
|
|
|
@ -237,6 +237,8 @@ $event-redacted-border-color: #cccccc;
|
||||||
$event-timestamp-color: #acacac;
|
$event-timestamp-color: #acacac;
|
||||||
|
|
||||||
$copy-button-url: "$(res)/img/feather-customised/clipboard.svg";
|
$copy-button-url: "$(res)/img/feather-customised/clipboard.svg";
|
||||||
|
$collapse-button-url: "$(res)/img/feather-customised/minimise.svg";
|
||||||
|
$expand-button-url: "$(res)/img/feather-customised/maximise.svg";
|
||||||
|
|
||||||
// e2e
|
// e2e
|
||||||
$e2e-verified-color: #76cfa5; // N.B. *NOT* the same as $accent-color
|
$e2e-verified-color: #76cfa5; // N.B. *NOT* the same as $accent-color
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
# Update on docker hub with the following commands in the directory of this file:
|
# Update on docker hub with the following commands in the directory of this file:
|
||||||
# docker build -t vectorim/element-web-ci-e2etests-env:latest .
|
# docker build -t vectorim/element-web-ci-e2etests-env:latest .
|
||||||
# docker log
|
|
||||||
# docker push vectorim/element-web-ci-e2etests-env:latest
|
# docker push vectorim/element-web-ci-e2etests-env:latest
|
||||||
FROM node:10
|
FROM node:14-buster
|
||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
RUN apt-get -y install build-essential python3-dev libffi-dev python-pip python-setuptools sqlite3 libssl-dev python-virtualenv libjpeg-dev libxslt1-dev uuid-runtime
|
RUN apt-get -y install build-essential python3-dev libffi-dev python-pip python-setuptools sqlite3 libssl-dev python-virtualenv libjpeg-dev libxslt1-dev uuid-runtime
|
||||||
# dependencies for chrome (installed by puppeteer)
|
# dependencies for chrome (installed by puppeteer)
|
||||||
|
|
2
src/@types/global.d.ts
vendored
|
@ -36,6 +36,7 @@ import {Analytics} from "../Analytics";
|
||||||
import CountlyAnalytics from "../CountlyAnalytics";
|
import CountlyAnalytics from "../CountlyAnalytics";
|
||||||
import UserActivity from "../UserActivity";
|
import UserActivity from "../UserActivity";
|
||||||
import {ModalWidgetStore} from "../stores/ModalWidgetStore";
|
import {ModalWidgetStore} from "../stores/ModalWidgetStore";
|
||||||
|
import { WidgetLayoutStore } from "../stores/widgets/WidgetLayoutStore";
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface Window {
|
interface Window {
|
||||||
|
@ -59,6 +60,7 @@ declare global {
|
||||||
mxNotifier: typeof Notifier;
|
mxNotifier: typeof Notifier;
|
||||||
mxRightPanelStore: RightPanelStore;
|
mxRightPanelStore: RightPanelStore;
|
||||||
mxWidgetStore: WidgetStore;
|
mxWidgetStore: WidgetStore;
|
||||||
|
mxWidgetLayoutStore: WidgetLayoutStore;
|
||||||
mxCallHandler: CallHandler;
|
mxCallHandler: CallHandler;
|
||||||
mxAnalytics: Analytics;
|
mxAnalytics: Analytics;
|
||||||
mxCountlyAnalytics: typeof CountlyAnalytics;
|
mxCountlyAnalytics: typeof CountlyAnalytics;
|
||||||
|
|
|
@ -30,6 +30,7 @@ import {idbLoad, idbSave, idbDelete} from "./utils/StorageManager";
|
||||||
|
|
||||||
export const SSO_HOMESERVER_URL_KEY = "mx_sso_hs_url";
|
export const SSO_HOMESERVER_URL_KEY = "mx_sso_hs_url";
|
||||||
export const SSO_ID_SERVER_URL_KEY = "mx_sso_is_url";
|
export const SSO_ID_SERVER_URL_KEY = "mx_sso_is_url";
|
||||||
|
export const SSO_IDP_ID_KEY = "mx_sso_idp_id";
|
||||||
|
|
||||||
export enum UpdateCheckStatus {
|
export enum UpdateCheckStatus {
|
||||||
Checking = "CHECKING",
|
Checking = "CHECKING",
|
||||||
|
@ -56,7 +57,7 @@ export default abstract class BasePlatform {
|
||||||
this.startUpdateCheck = this.startUpdateCheck.bind(this);
|
this.startUpdateCheck = this.startUpdateCheck.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract async getConfig(): Promise<{}>;
|
abstract getConfig(): Promise<{}>;
|
||||||
|
|
||||||
abstract getDefaultDeviceDisplayName(): string;
|
abstract getDefaultDeviceDisplayName(): string;
|
||||||
|
|
||||||
|
@ -258,6 +259,9 @@ export default abstract class BasePlatform {
|
||||||
if (mxClient.getIdentityServerUrl()) {
|
if (mxClient.getIdentityServerUrl()) {
|
||||||
localStorage.setItem(SSO_ID_SERVER_URL_KEY, mxClient.getIdentityServerUrl());
|
localStorage.setItem(SSO_ID_SERVER_URL_KEY, mxClient.getIdentityServerUrl());
|
||||||
}
|
}
|
||||||
|
if (idpId) {
|
||||||
|
localStorage.setItem(SSO_IDP_ID_KEY, idpId);
|
||||||
|
}
|
||||||
const callbackUrl = this.getSSOCallbackUrl(fragmentAfterLogin);
|
const callbackUrl = this.getSSOCallbackUrl(fragmentAfterLogin);
|
||||||
window.location.href = mxClient.getSsoLoginUrl(callbackUrl.toString(), loginType, idpId); // redirect to SSO
|
window.location.href = mxClient.getSsoLoginUrl(callbackUrl.toString(), loginType, idpId); // redirect to SSO
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,10 @@ import CountlyAnalytics from "./CountlyAnalytics";
|
||||||
import {UIFeature} from "./settings/UIFeature";
|
import {UIFeature} from "./settings/UIFeature";
|
||||||
import { CallError } from "matrix-js-sdk/src/webrtc/call";
|
import { CallError } from "matrix-js-sdk/src/webrtc/call";
|
||||||
import { logger } from 'matrix-js-sdk/src/logger';
|
import { logger } from 'matrix-js-sdk/src/logger';
|
||||||
|
import DesktopCapturerSourcePicker from "./components/views/elements/DesktopCapturerSourcePicker"
|
||||||
import { Action } from './dispatcher/actions';
|
import { Action } from './dispatcher/actions';
|
||||||
|
import { roomForVirtualRoom, getOrCreateVirtualRoomForRoom } from './VoipUserMapper';
|
||||||
|
import { addManagedHybridWidget, isManagedHybridWidgetEnabled } from './widgets/ManagedHybrid';
|
||||||
|
|
||||||
const CHECK_PSTN_SUPPORT_ATTEMPTS = 3;
|
const CHECK_PSTN_SUPPORT_ATTEMPTS = 3;
|
||||||
|
|
||||||
|
@ -133,6 +136,15 @@ export default class CallHandler {
|
||||||
return window.mxCallHandler;
|
return window.mxCallHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Gets the user-facing room associated with a call (call.roomId may be the call "virtual room"
|
||||||
|
* if a voip_mxid_translate_pattern is set in the config)
|
||||||
|
*/
|
||||||
|
public static roomIdForCall(call: MatrixCall) {
|
||||||
|
if (!call) return null;
|
||||||
|
return roomForVirtualRoom(call.roomId) || call.roomId;
|
||||||
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
this.dispatcherRef = dis.register(this.onAction);
|
this.dispatcherRef = dis.register(this.onAction);
|
||||||
// add empty handlers for media actions, otherwise the media keys
|
// add empty handlers for media actions, otherwise the media keys
|
||||||
|
@ -284,11 +296,15 @@ export default class CallHandler {
|
||||||
// We don't allow placing more than one call per room, but that doesn't mean there
|
// We don't allow placing more than one call per room, but that doesn't mean there
|
||||||
// can't be more than one, eg. in a glare situation. This checks that the given call
|
// can't be more than one, eg. in a glare situation. This checks that the given call
|
||||||
// is the call we consider 'the' call for its room.
|
// is the call we consider 'the' call for its room.
|
||||||
const callForThisRoom = this.getCallForRoom(call.roomId);
|
const mappedRoomId = CallHandler.roomIdForCall(call);
|
||||||
|
|
||||||
|
const callForThisRoom = this.getCallForRoom(mappedRoomId);
|
||||||
return callForThisRoom && call.callId === callForThisRoom.callId;
|
return callForThisRoom && call.callId === callForThisRoom.callId;
|
||||||
}
|
}
|
||||||
|
|
||||||
private setCallListeners(call: MatrixCall) {
|
private setCallListeners(call: MatrixCall) {
|
||||||
|
const mappedRoomId = CallHandler.roomIdForCall(call);
|
||||||
|
|
||||||
call.on(CallEvent.Error, (err: CallError) => {
|
call.on(CallEvent.Error, (err: CallError) => {
|
||||||
if (!this.matchesCallForThisRoom(call)) return;
|
if (!this.matchesCallForThisRoom(call)) return;
|
||||||
|
|
||||||
|
@ -318,7 +334,7 @@ export default class CallHandler {
|
||||||
|
|
||||||
Analytics.trackEvent('voip', 'callHangup');
|
Analytics.trackEvent('voip', 'callHangup');
|
||||||
|
|
||||||
this.removeCallForRoom(call.roomId);
|
this.removeCallForRoom(mappedRoomId);
|
||||||
});
|
});
|
||||||
call.on(CallEvent.State, (newState: CallState, oldState: CallState) => {
|
call.on(CallEvent.State, (newState: CallState, oldState: CallState) => {
|
||||||
if (!this.matchesCallForThisRoom(call)) return;
|
if (!this.matchesCallForThisRoom(call)) return;
|
||||||
|
@ -342,8 +358,9 @@ export default class CallHandler {
|
||||||
this.play(AudioID.Ringback);
|
this.play(AudioID.Ringback);
|
||||||
break;
|
break;
|
||||||
case CallState.Ended:
|
case CallState.Ended:
|
||||||
|
{
|
||||||
Analytics.trackEvent('voip', 'callEnded', 'hangupReason', call.hangupReason);
|
Analytics.trackEvent('voip', 'callEnded', 'hangupReason', call.hangupReason);
|
||||||
this.removeCallForRoom(call.roomId);
|
this.removeCallForRoom(mappedRoomId);
|
||||||
if (oldState === CallState.InviteSent && (
|
if (oldState === CallState.InviteSent && (
|
||||||
call.hangupParty === CallParty.Remote ||
|
call.hangupParty === CallParty.Remote ||
|
||||||
(call.hangupParty === CallParty.Local && call.hangupReason === CallErrorCode.InviteTimeout)
|
(call.hangupParty === CallParty.Local && call.hangupReason === CallErrorCode.InviteTimeout)
|
||||||
|
@ -375,10 +392,14 @@ export default class CallHandler {
|
||||||
title: _t("Answered Elsewhere"),
|
title: _t("Answered Elsewhere"),
|
||||||
description: _t("The call was answered on another device."),
|
description: _t("The call was answered on another device."),
|
||||||
});
|
});
|
||||||
} else if (oldState !== CallState.Fledgling) {
|
} else if (oldState !== CallState.Fledgling && oldState !== CallState.Ringing) {
|
||||||
// don't play the end-call sound for calls that never got off the ground
|
// don't play the end-call sound for calls that never got off the ground
|
||||||
this.play(AudioID.CallEnd);
|
this.play(AudioID.CallEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.logCallStats(call, mappedRoomId);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
call.on(CallEvent.Replaced, (newCall: MatrixCall) => {
|
call.on(CallEvent.Replaced, (newCall: MatrixCall) => {
|
||||||
|
@ -392,25 +413,70 @@ export default class CallHandler {
|
||||||
this.pause(AudioID.Ringback);
|
this.pause(AudioID.Ringback);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.calls.set(newCall.roomId, newCall);
|
this.calls.set(mappedRoomId, newCall);
|
||||||
this.setCallListeners(newCall);
|
this.setCallListeners(newCall);
|
||||||
this.setCallState(newCall, newCall.state);
|
this.setCallState(newCall, newCall.state);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async logCallStats(call: MatrixCall, mappedRoomId: string) {
|
||||||
|
const stats = await call.getCurrentCallStats();
|
||||||
|
logger.debug(
|
||||||
|
`Call completed. Call ID: ${call.callId}, virtual room ID: ${call.roomId}, ` +
|
||||||
|
`user-facing room ID: ${mappedRoomId}, direction: ${call.direction}, ` +
|
||||||
|
`our Party ID: ${call.ourPartyId}, hangup party: ${call.hangupParty}, ` +
|
||||||
|
`hangup reason: ${call.hangupReason}`,
|
||||||
|
);
|
||||||
|
if (!stats) {
|
||||||
|
logger.debug(
|
||||||
|
"Call statistics are undefined. The call has " +
|
||||||
|
"probably failed before a peerConn was established",
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
logger.debug("Local candidates:");
|
||||||
|
for (const cand of stats.filter(item => item.type === 'local-candidate')) {
|
||||||
|
const address = cand.address || cand.ip; // firefox uses 'address', chrome uses 'ip'
|
||||||
|
logger.debug(
|
||||||
|
`${cand.id} - type: ${cand.candidateType}, address: ${address}, port: ${cand.port}, ` +
|
||||||
|
`protocol: ${cand.protocol}, relay protocol: ${cand.relayProtocol}, network type: ${cand.networkType}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
logger.debug("Remote candidates:");
|
||||||
|
for (const cand of stats.filter(item => item.type === 'remote-candidate')) {
|
||||||
|
const address = cand.address || cand.ip; // firefox uses 'address', chrome uses 'ip'
|
||||||
|
logger.debug(
|
||||||
|
`${cand.id} - type: ${cand.candidateType}, address: ${address}, port: ${cand.port}, ` +
|
||||||
|
`protocol: ${cand.protocol}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
logger.debug("Candidate pairs:");
|
||||||
|
for (const pair of stats.filter(item => item.type === 'candidate-pair')) {
|
||||||
|
logger.debug(
|
||||||
|
`${pair.localCandidateId} / ${pair.remoteCandidateId} - state: ${pair.state}, ` +
|
||||||
|
`nominated: ${pair.nominated}, ` +
|
||||||
|
`requests sent ${pair.requestsSent}, requests received ${pair.requestsReceived}, ` +
|
||||||
|
`responses received: ${pair.responsesReceived}, responses sent: ${pair.responsesSent}, ` +
|
||||||
|
`bytes received: ${pair.bytesReceived}, bytes sent: ${pair.bytesSent}, `,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private setCallAudioElement(call: MatrixCall) {
|
private setCallAudioElement(call: MatrixCall) {
|
||||||
const audioElement = getRemoteAudioElement();
|
const audioElement = getRemoteAudioElement();
|
||||||
if (audioElement) call.setRemoteAudioElement(audioElement);
|
if (audioElement) call.setRemoteAudioElement(audioElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
private setCallState(call: MatrixCall, status: CallState) {
|
private setCallState(call: MatrixCall, status: CallState) {
|
||||||
|
const mappedRoomId = CallHandler.roomIdForCall(call);
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
`Call state in ${call.roomId} changed to ${status}`,
|
`Call state in ${mappedRoomId} changed to ${status}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
action: 'call_state',
|
action: 'call_state',
|
||||||
room_id: call.roomId,
|
room_id: mappedRoomId,
|
||||||
state: status,
|
state: status,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -477,14 +543,20 @@ export default class CallHandler {
|
||||||
}, null, true);
|
}, null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private placeCall(
|
private async placeCall(
|
||||||
roomId: string, type: PlaceCallType,
|
roomId: string, type: PlaceCallType,
|
||||||
localElement: HTMLVideoElement, remoteElement: HTMLVideoElement,
|
localElement: HTMLVideoElement, remoteElement: HTMLVideoElement,
|
||||||
) {
|
) {
|
||||||
Analytics.trackEvent('voip', 'placeCall', 'type', type);
|
Analytics.trackEvent('voip', 'placeCall', 'type', type);
|
||||||
CountlyAnalytics.instance.trackStartCall(roomId, type === PlaceCallType.Video, false);
|
CountlyAnalytics.instance.trackStartCall(roomId, type === PlaceCallType.Video, false);
|
||||||
const call = createNewMatrixCall(MatrixClientPeg.get(), roomId);
|
|
||||||
|
const mappedRoomId = (await getOrCreateVirtualRoomForRoom(roomId)) || roomId;
|
||||||
|
logger.debug("Mapped real room " + roomId + " to room ID " + mappedRoomId);
|
||||||
|
|
||||||
|
const call = createNewMatrixCall(MatrixClientPeg.get(), mappedRoomId);
|
||||||
|
|
||||||
this.calls.set(roomId, call);
|
this.calls.set(roomId, call);
|
||||||
|
|
||||||
this.setCallListeners(call);
|
this.setCallListeners(call);
|
||||||
this.setCallAudioElement(call);
|
this.setCallAudioElement(call);
|
||||||
|
|
||||||
|
@ -508,9 +580,17 @@ export default class CallHandler {
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
call.placeScreenSharingCall(remoteElement, localElement);
|
|
||||||
|
call.placeScreenSharingCall(
|
||||||
|
remoteElement,
|
||||||
|
localElement,
|
||||||
|
async () : Promise<DesktopCapturerSource> => {
|
||||||
|
const {finished} = Modal.createDialog(DesktopCapturerSourcePicker);
|
||||||
|
const [source] = await finished;
|
||||||
|
return source;
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
console.error("Unknown conf call type: %s", type);
|
console.error("Unknown conf call type: " + type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -518,6 +598,12 @@ export default class CallHandler {
|
||||||
switch (payload.action) {
|
switch (payload.action) {
|
||||||
case 'place_call':
|
case 'place_call':
|
||||||
{
|
{
|
||||||
|
// We might be using managed hybrid widgets
|
||||||
|
if (isManagedHybridWidgetEnabled()) {
|
||||||
|
addManagedHybridWidget(payload.room_id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// if the runtime env doesn't do VoIP, whine.
|
// if the runtime env doesn't do VoIP, whine.
|
||||||
if (!MatrixClientPeg.get().supportsVoip()) {
|
if (!MatrixClientPeg.get().supportsVoip()) {
|
||||||
Modal.createTrackedDialog('Call Handler', 'VoIP is unsupported', ErrorDialog, {
|
Modal.createTrackedDialog('Call Handler', 'VoIP is unsupported', ErrorDialog, {
|
||||||
|
@ -538,7 +624,7 @@ export default class CallHandler {
|
||||||
|
|
||||||
const room = MatrixClientPeg.get().getRoom(payload.room_id);
|
const room = MatrixClientPeg.get().getRoom(payload.room_id);
|
||||||
if (!room) {
|
if (!room) {
|
||||||
console.error("Room %s does not exist.", payload.room_id);
|
console.error(`Room ${payload.room_id} does not exist.`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -549,7 +635,7 @@ export default class CallHandler {
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
} else if (members.length === 2) {
|
} else if (members.length === 2) {
|
||||||
console.info("Place %s call in %s", payload.type, payload.room_id);
|
console.info(`Place ${payload.type} call in ${payload.room_id}`);
|
||||||
|
|
||||||
this.placeCall(payload.room_id, payload.type, payload.local_element, payload.remote_element);
|
this.placeCall(payload.room_id, payload.type, payload.local_element, payload.remote_element);
|
||||||
} else { // > 2
|
} else { // > 2
|
||||||
|
@ -564,17 +650,17 @@ export default class CallHandler {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'place_conference_call':
|
case 'place_conference_call':
|
||||||
console.info("Place conference call in %s", payload.room_id);
|
console.info("Place conference call in " + payload.room_id);
|
||||||
Analytics.trackEvent('voip', 'placeConferenceCall');
|
Analytics.trackEvent('voip', 'placeConferenceCall');
|
||||||
CountlyAnalytics.instance.trackStartCall(payload.room_id, payload.type === PlaceCallType.Video, true);
|
CountlyAnalytics.instance.trackStartCall(payload.room_id, payload.type === PlaceCallType.Video, true);
|
||||||
this.startCallApp(payload.room_id, payload.type);
|
this.startCallApp(payload.room_id, payload.type);
|
||||||
break;
|
break;
|
||||||
case 'end_conference':
|
case 'end_conference':
|
||||||
console.info("Terminating conference call in %s", payload.room_id);
|
console.info("Terminating conference call in " + payload.room_id);
|
||||||
this.terminateCallApp(payload.room_id);
|
this.terminateCallApp(payload.room_id);
|
||||||
break;
|
break;
|
||||||
case 'hangup_conference':
|
case 'hangup_conference':
|
||||||
console.info("Leaving conference call in %s", payload.room_id);
|
console.info("Leaving conference call in "+ payload.room_id);
|
||||||
this.hangupCallApp(payload.room_id);
|
this.hangupCallApp(payload.room_id);
|
||||||
break;
|
break;
|
||||||
case 'incoming_call':
|
case 'incoming_call':
|
||||||
|
@ -586,13 +672,14 @@ export default class CallHandler {
|
||||||
|
|
||||||
const call = payload.call as MatrixCall;
|
const call = payload.call as MatrixCall;
|
||||||
|
|
||||||
if (this.getCallForRoom(call.roomId)) {
|
const mappedRoomId = CallHandler.roomIdForCall(call);
|
||||||
|
if (this.getCallForRoom(mappedRoomId)) {
|
||||||
// ignore multiple incoming calls to the same room
|
// ignore multiple incoming calls to the same room
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Analytics.trackEvent('voip', 'receiveCall', 'type', call.type);
|
Analytics.trackEvent('voip', 'receiveCall', 'type', call.type);
|
||||||
this.calls.set(call.roomId, call)
|
this.calls.set(mappedRoomId, call)
|
||||||
this.setCallListeners(call);
|
this.setCallListeners(call);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -497,7 +497,7 @@ export default class ContentMessages {
|
||||||
content.info.mimetype = file.type;
|
content.info.mimetype = file.type;
|
||||||
}
|
}
|
||||||
|
|
||||||
const prom = new Promise((resolve) => {
|
const prom = new Promise<void>((resolve) => {
|
||||||
if (file.type.indexOf('image/') === 0) {
|
if (file.type.indexOf('image/') === 0) {
|
||||||
content.msgtype = 'm.image';
|
content.msgtype = 'm.image';
|
||||||
infoForImageFile(matrixClient, roomId, file).then((imageInfo) => {
|
infoForImageFile(matrixClient, roomId, file).then((imageInfo) => {
|
||||||
|
|
|
@ -840,7 +840,7 @@ export default class CountlyAnalytics {
|
||||||
let endTime = CountlyAnalytics.getTimestamp();
|
let endTime = CountlyAnalytics.getTimestamp();
|
||||||
const cli = MatrixClientPeg.get();
|
const cli = MatrixClientPeg.get();
|
||||||
if (!cli.getRoom(roomId)) {
|
if (!cli.getRoom(roomId)) {
|
||||||
await new Promise(resolve => {
|
await new Promise<void>(resolve => {
|
||||||
const handler = (room) => {
|
const handler = (room) => {
|
||||||
if (room.roomId === roomId) {
|
if (room.roomId === roomId) {
|
||||||
cli.off("Room", handler);
|
cli.off("Room", handler);
|
||||||
|
@ -880,7 +880,7 @@ export default class CountlyAnalytics {
|
||||||
let endTime = CountlyAnalytics.getTimestamp();
|
let endTime = CountlyAnalytics.getTimestamp();
|
||||||
|
|
||||||
if (!room.findEventById(eventId)) {
|
if (!room.findEventById(eventId)) {
|
||||||
await new Promise(resolve => {
|
await new Promise<void>(resolve => {
|
||||||
const handler = (ev) => {
|
const handler = (ev) => {
|
||||||
if (ev.getId() === eventId) {
|
if (ev.getId() === eventId) {
|
||||||
room.off("Room.localEchoUpdated", handler);
|
room.off("Room.localEchoUpdated", handler);
|
||||||
|
|
|
@ -422,6 +422,8 @@ export function bodyToHtml(content: IContent, highlights: string[], opts: IOpts
|
||||||
if (SettingsStore.getValue("feature_latex_maths")) {
|
if (SettingsStore.getValue("feature_latex_maths")) {
|
||||||
const phtml = cheerio.load(safeBody,
|
const phtml = cheerio.load(safeBody,
|
||||||
{ _useHtmlParser2: true, decodeEntities: false })
|
{ _useHtmlParser2: true, decodeEntities: false })
|
||||||
|
// @ts-ignore - The types for `replaceWith` wrongly expect
|
||||||
|
// Cheerio instance to be returned.
|
||||||
phtml('div, span[data-mx-maths!=""]').replaceWith(function(i, e) {
|
phtml('div, span[data-mx-maths!=""]').replaceWith(function(i, e) {
|
||||||
return katex.renderToString(
|
return katex.renderToString(
|
||||||
AllHtmlEntities.decode(phtml(e).attr('data-mx-maths')),
|
AllHtmlEntities.decode(phtml(e).attr('data-mx-maths')),
|
||||||
|
|
|
@ -165,6 +165,7 @@ export default class IdentityAuthClient {
|
||||||
});
|
});
|
||||||
const [confirmed] = await finished;
|
const [confirmed] = await finished;
|
||||||
if (confirmed) {
|
if (confirmed) {
|
||||||
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||||
useDefaultIdentityServer();
|
useDefaultIdentityServer();
|
||||||
} else {
|
} else {
|
||||||
throw new AbortedIdentityActionError(
|
throw new AbortedIdentityActionError(
|
||||||
|
|
|
@ -46,11 +46,13 @@ import {IntegrationManagers} from "./integrations/IntegrationManagers";
|
||||||
import {Mjolnir} from "./mjolnir/Mjolnir";
|
import {Mjolnir} from "./mjolnir/Mjolnir";
|
||||||
import DeviceListener from "./DeviceListener";
|
import DeviceListener from "./DeviceListener";
|
||||||
import {Jitsi} from "./widgets/Jitsi";
|
import {Jitsi} from "./widgets/Jitsi";
|
||||||
import {SSO_HOMESERVER_URL_KEY, SSO_ID_SERVER_URL_KEY} from "./BasePlatform";
|
import {SSO_HOMESERVER_URL_KEY, SSO_ID_SERVER_URL_KEY, SSO_IDP_ID_KEY} from "./BasePlatform";
|
||||||
import ThreepidInviteStore from "./stores/ThreepidInviteStore";
|
import ThreepidInviteStore from "./stores/ThreepidInviteStore";
|
||||||
import CountlyAnalytics from "./CountlyAnalytics";
|
import CountlyAnalytics from "./CountlyAnalytics";
|
||||||
import CallHandler from './CallHandler';
|
import CallHandler from './CallHandler';
|
||||||
import LifecycleCustomisations from "./customisations/Lifecycle";
|
import LifecycleCustomisations from "./customisations/Lifecycle";
|
||||||
|
import ErrorDialog from "./components/views/dialogs/ErrorDialog";
|
||||||
|
import {_t} from "./languageHandler";
|
||||||
|
|
||||||
const HOMESERVER_URL_KEY = "mx_hs_url";
|
const HOMESERVER_URL_KEY = "mx_hs_url";
|
||||||
const ID_SERVER_URL_KEY = "mx_is_url";
|
const ID_SERVER_URL_KEY = "mx_is_url";
|
||||||
|
@ -162,7 +164,8 @@ export async function getStoredSessionOwner(): Promise<[string, boolean]> {
|
||||||
* query-parameters extracted from the real query-string of the starting
|
* query-parameters extracted from the real query-string of the starting
|
||||||
* URI.
|
* URI.
|
||||||
*
|
*
|
||||||
* @param {String} defaultDeviceDisplayName
|
* @param {string} defaultDeviceDisplayName
|
||||||
|
* @param {string} fragmentAfterLogin path to go to after a successful login, only used for "Try again"
|
||||||
*
|
*
|
||||||
* @returns {Promise} promise which resolves to true if we completed the token
|
* @returns {Promise} promise which resolves to true if we completed the token
|
||||||
* login, else false
|
* login, else false
|
||||||
|
@ -170,6 +173,7 @@ export async function getStoredSessionOwner(): Promise<[string, boolean]> {
|
||||||
export function attemptTokenLogin(
|
export function attemptTokenLogin(
|
||||||
queryParams: Record<string, string>,
|
queryParams: Record<string, string>,
|
||||||
defaultDeviceDisplayName?: string,
|
defaultDeviceDisplayName?: string,
|
||||||
|
fragmentAfterLogin?: string,
|
||||||
): Promise<boolean> {
|
): Promise<boolean> {
|
||||||
if (!queryParams.loginToken) {
|
if (!queryParams.loginToken) {
|
||||||
return Promise.resolve(false);
|
return Promise.resolve(false);
|
||||||
|
@ -179,6 +183,12 @@ export function attemptTokenLogin(
|
||||||
const identityServer = localStorage.getItem(SSO_ID_SERVER_URL_KEY);
|
const identityServer = localStorage.getItem(SSO_ID_SERVER_URL_KEY);
|
||||||
if (!homeserver) {
|
if (!homeserver) {
|
||||||
console.warn("Cannot log in with token: can't determine HS URL to use");
|
console.warn("Cannot log in with token: can't determine HS URL to use");
|
||||||
|
Modal.createTrackedDialog("SSO", "Unknown HS", ErrorDialog, {
|
||||||
|
title: _t("We couldn't log you in"),
|
||||||
|
description: _t("We asked the browser to remember which homeserver you use to let you sign in, " +
|
||||||
|
"but unfortunately your browser has forgotten it. Go to the sign in page and try again."),
|
||||||
|
button: _t("Try again"),
|
||||||
|
});
|
||||||
return Promise.resolve(false);
|
return Promise.resolve(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,8 +208,28 @@ export function attemptTokenLogin(
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.error("Failed to log in with login token: " + err + " " +
|
Modal.createTrackedDialog("SSO", "Token Rejected", ErrorDialog, {
|
||||||
err.data);
|
title: _t("We couldn't log you in"),
|
||||||
|
description: err.name === "ConnectionError"
|
||||||
|
? _t("Your homeserver was unreachable and was not able to log you in. Please try again. " +
|
||||||
|
"If this continues, please contact your homeserver administrator.")
|
||||||
|
: _t("Your homeserver rejected your log in attempt. " +
|
||||||
|
"This could be due to things just taking too long. Please try again. " +
|
||||||
|
"If this continues, please contact your homeserver administrator."),
|
||||||
|
button: _t("Try again"),
|
||||||
|
onFinished: tryAgain => {
|
||||||
|
if (tryAgain) {
|
||||||
|
const cli = Matrix.createClient({
|
||||||
|
baseUrl: homeserver,
|
||||||
|
idBaseUrl: identityServer,
|
||||||
|
});
|
||||||
|
const idpId = localStorage.getItem(SSO_IDP_ID_KEY) || undefined;
|
||||||
|
PlatformPeg.get().startSingleSignOn(cli, "sso", fragmentAfterLogin, idpId);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.error("Failed to log in with login token:");
|
||||||
|
console.error(err);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -366,7 +396,7 @@ async function abortLogin() {
|
||||||
// The plan is to gradually move the localStorage access done here into
|
// The plan is to gradually move the localStorage access done here into
|
||||||
// SessionStore to avoid bugs where the view becomes out-of-sync with
|
// SessionStore to avoid bugs where the view becomes out-of-sync with
|
||||||
// localStorage (e.g. isGuest etc.)
|
// localStorage (e.g. isGuest etc.)
|
||||||
async function restoreFromLocalStorage(opts?: { ignoreGuest?: boolean }): Promise<boolean> {
|
export async function restoreFromLocalStorage(opts?: { ignoreGuest?: boolean }): Promise<boolean> {
|
||||||
const ignoreGuest = opts?.ignoreGuest;
|
const ignoreGuest = opts?.ignoreGuest;
|
||||||
|
|
||||||
if (!localStorage) {
|
if (!localStorage) {
|
||||||
|
|
10
src/Login.ts
|
@ -33,10 +33,20 @@ interface IPasswordFlow {
|
||||||
type: "m.login.password";
|
type: "m.login.password";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum IdentityProviderBrand {
|
||||||
|
Gitlab = "org.matrix.gitlab",
|
||||||
|
Github = "org.matrix.github",
|
||||||
|
Apple = "org.matrix.apple",
|
||||||
|
Google = "org.matrix.google",
|
||||||
|
Facebook = "org.matrix.facebook",
|
||||||
|
Twitter = "org.matrix.twitter",
|
||||||
|
}
|
||||||
|
|
||||||
export interface IIdentityProvider {
|
export interface IIdentityProvider {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
icon?: string;
|
icon?: string;
|
||||||
|
brand?: IdentityProviderBrand | string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ISSOFlow {
|
export interface ISSOFlow {
|
||||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import commonmark from 'commonmark';
|
import * as commonmark from 'commonmark';
|
||||||
import {escape} from "lodash";
|
import {escape} from "lodash";
|
||||||
|
|
||||||
const ALLOWED_HTML_TAGS = ['sub', 'sup', 'del', 'u'];
|
const ALLOWED_HTML_TAGS = ['sub', 'sup', 'del', 'u'];
|
||||||
|
|
|
@ -202,12 +202,13 @@ function setRoomNotifsStateUnmuted(roomId, newState) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function findOverrideMuteRule(roomId) {
|
function findOverrideMuteRule(roomId) {
|
||||||
if (!MatrixClientPeg.get().pushRules ||
|
const cli = MatrixClientPeg.get();
|
||||||
!MatrixClientPeg.get().pushRules['global'] ||
|
if (!cli.pushRules ||
|
||||||
!MatrixClientPeg.get().pushRules['global'].override) {
|
!cli.pushRules['global'] ||
|
||||||
|
!cli.pushRules['global'].override) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
for (const rule of MatrixClientPeg.get().pushRules['global'].override) {
|
for (const rule of cli.pushRules['global'].override) {
|
||||||
if (isRuleForRoom(roomId, rule)) {
|
if (isRuleForRoom(roomId, rule)) {
|
||||||
if (isMuteRule(rule) && rule.enabled) {
|
if (isMuteRule(rule) && rule.enabled) {
|
||||||
return rule;
|
return rule;
|
||||||
|
|
|
@ -48,6 +48,7 @@ import SettingsStore from "./settings/SettingsStore";
|
||||||
import {UIFeature} from "./settings/UIFeature";
|
import {UIFeature} from "./settings/UIFeature";
|
||||||
import {CHAT_EFFECTS} from "./effects"
|
import {CHAT_EFFECTS} from "./effects"
|
||||||
import CallHandler from "./CallHandler";
|
import CallHandler from "./CallHandler";
|
||||||
|
import {guessAndSetDMRoom} from "./Rooms";
|
||||||
|
|
||||||
// XXX: workaround for https://github.com/microsoft/TypeScript/issues/31816
|
// XXX: workaround for https://github.com/microsoft/TypeScript/issues/31816
|
||||||
interface HTMLInputEvent extends Event {
|
interface HTMLInputEvent extends Event {
|
||||||
|
@ -1112,6 +1113,24 @@ export const Commands = [
|
||||||
return success();
|
return success();
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
new Command({
|
||||||
|
command: "converttodm",
|
||||||
|
description: _td("Converts the room to a DM"),
|
||||||
|
category: CommandCategories.other,
|
||||||
|
runFn: function(roomId, args) {
|
||||||
|
const room = MatrixClientPeg.get().getRoom(roomId);
|
||||||
|
return success(guessAndSetDMRoom(room, true));
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
new Command({
|
||||||
|
command: "converttoroom",
|
||||||
|
description: _td("Converts the DM to a room"),
|
||||||
|
category: CommandCategories.other,
|
||||||
|
runFn: function(roomId, args) {
|
||||||
|
const room = MatrixClientPeg.get().getRoom(roomId);
|
||||||
|
return success(guessAndSetDMRoom(room, false));
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
|
||||||
// Command definitions for autocompletion ONLY:
|
// Command definitions for autocompletion ONLY:
|
||||||
// /me is special because its not handled by SlashCommands.js and is instead done inside the Composer classes
|
// /me is special because its not handled by SlashCommands.js and is instead done inside the Composer classes
|
||||||
|
|
|
@ -19,6 +19,7 @@ import * as Roles from './Roles';
|
||||||
import {isValid3pidInvite} from "./RoomInvite";
|
import {isValid3pidInvite} from "./RoomInvite";
|
||||||
import SettingsStore from "./settings/SettingsStore";
|
import SettingsStore from "./settings/SettingsStore";
|
||||||
import {ALL_RULE_TYPES, ROOM_RULE_TYPES, SERVER_RULE_TYPES, USER_RULE_TYPES} from "./mjolnir/BanList";
|
import {ALL_RULE_TYPES, ROOM_RULE_TYPES, SERVER_RULE_TYPES, USER_RULE_TYPES} from "./mjolnir/BanList";
|
||||||
|
import {WIDGET_LAYOUT_EVENT_TYPE} from "./stores/widgets/WidgetLayoutStore";
|
||||||
|
|
||||||
function textForMemberEvent(ev) {
|
function textForMemberEvent(ev) {
|
||||||
// XXX: SYJS-16 "sender is sometimes null for join messages"
|
// XXX: SYJS-16 "sender is sometimes null for join messages"
|
||||||
|
@ -477,6 +478,11 @@ function textForWidgetEvent(event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function textForWidgetLayoutEvent(event) {
|
||||||
|
const senderName = event.sender?.name || event.getSender();
|
||||||
|
return _t("%(senderName)s has updated the widget layout", {senderName});
|
||||||
|
}
|
||||||
|
|
||||||
function textForMjolnirEvent(event) {
|
function textForMjolnirEvent(event) {
|
||||||
const senderName = event.getSender();
|
const senderName = event.getSender();
|
||||||
const {entity: prevEntity} = event.getPrevContent();
|
const {entity: prevEntity} = event.getPrevContent();
|
||||||
|
@ -583,6 +589,7 @@ const stateHandlers = {
|
||||||
|
|
||||||
// TODO: Enable support for m.widget event type (https://github.com/vector-im/element-web/issues/13111)
|
// TODO: Enable support for m.widget event type (https://github.com/vector-im/element-web/issues/13111)
|
||||||
'im.vector.modular.widgets': textForWidgetEvent,
|
'im.vector.modular.widgets': textForWidgetEvent,
|
||||||
|
[WIDGET_LAYOUT_EVENT_TYPE]: textForWidgetLayoutEvent,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Add all the Mjolnir stuff to the renderer
|
// Add all the Mjolnir stuff to the renderer
|
||||||
|
|
79
src/VoipUserMapper.ts
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
/*
|
||||||
|
Copyright 2021 The Matrix.org Foundation C.I.C.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { ensureDMExists, findDMForUser } from './createRoom';
|
||||||
|
import { MatrixClientPeg } from "./MatrixClientPeg";
|
||||||
|
import DMRoomMap from "./utils/DMRoomMap";
|
||||||
|
import SdkConfig from "./SdkConfig";
|
||||||
|
|
||||||
|
// Functions for mapping users & rooms for the voip_mxid_translate_pattern
|
||||||
|
// config option
|
||||||
|
|
||||||
|
export function voipUserMapperEnabled(): boolean {
|
||||||
|
return SdkConfig.get()['voip_mxid_translate_pattern'] !== undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
// only exported for tests
|
||||||
|
export function userToVirtualUser(userId: string, templateString?: string): string {
|
||||||
|
if (templateString === undefined) templateString = SdkConfig.get()['voip_mxid_translate_pattern'];
|
||||||
|
if (!templateString) return null;
|
||||||
|
return templateString.replace('${mxid}', encodeURIComponent(userId).replace(/%/g, '=').toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
// only exported for tests
|
||||||
|
export function virtualUserToUser(userId: string, templateString?: string): string {
|
||||||
|
if (templateString === undefined) templateString = SdkConfig.get()['voip_mxid_translate_pattern'];
|
||||||
|
if (!templateString) return null;
|
||||||
|
|
||||||
|
const regexString = templateString.replace('${mxid}', '(.+)');
|
||||||
|
|
||||||
|
const match = userId.match('^' + regexString + '$');
|
||||||
|
if (!match) return null;
|
||||||
|
|
||||||
|
return decodeURIComponent(match[1].replace(/=/g, '%'));
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getOrCreateVirtualRoomForUser(userId: string):Promise<string> {
|
||||||
|
const virtualUser = userToVirtualUser(userId);
|
||||||
|
if (!virtualUser) return null;
|
||||||
|
|
||||||
|
return await ensureDMExists(MatrixClientPeg.get(), virtualUser);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getOrCreateVirtualRoomForRoom(roomId: string):Promise<string> {
|
||||||
|
const user = DMRoomMap.shared().getUserIdForRoomId(roomId);
|
||||||
|
if (!user) return null;
|
||||||
|
return getOrCreateVirtualRoomForUser(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function roomForVirtualRoom(roomId: string):string {
|
||||||
|
const virtualUser = DMRoomMap.shared().getUserIdForRoomId(roomId);
|
||||||
|
if (!virtualUser) return null;
|
||||||
|
const realUser = virtualUserToUser(virtualUser);
|
||||||
|
const room = findDMForUser(MatrixClientPeg.get(), realUser);
|
||||||
|
if (room) {
|
||||||
|
return room.roomId;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isVirtualRoom(roomId: string):boolean {
|
||||||
|
const virtualUser = DMRoomMap.shared().getUserIdForRoomId(roomId);
|
||||||
|
if (!virtualUser) return null;
|
||||||
|
const realUser = virtualUserToUser(virtualUser);
|
||||||
|
return Boolean(realUser);
|
||||||
|
}
|
|
@ -168,6 +168,12 @@ const shortcuts: Record<Categories, IShortcut[]> = {
|
||||||
key: Key.U,
|
key: Key.U,
|
||||||
}],
|
}],
|
||||||
description: _td("Upload a file"),
|
description: _td("Upload a file"),
|
||||||
|
}, {
|
||||||
|
keybinds: [{
|
||||||
|
modifiers: [CMD_OR_CTRL],
|
||||||
|
key: Key.F,
|
||||||
|
}],
|
||||||
|
description: _td("Search (must be enabled)"),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ export default class CreateKeyBackupDialog extends React.PureComponent {
|
||||||
const blob = new Blob([this._keyBackupInfo.recovery_key], {
|
const blob = new Blob([this._keyBackupInfo.recovery_key], {
|
||||||
type: 'text/plain;charset=us-ascii',
|
type: 'text/plain;charset=us-ascii',
|
||||||
});
|
});
|
||||||
FileSaver.saveAs(blob, 'recovery-key.txt');
|
FileSaver.saveAs(blob, 'security-key.txt');
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
downloaded: true,
|
downloaded: true,
|
||||||
|
@ -238,7 +238,7 @@ export default class CreateKeyBackupDialog extends React.PureComponent {
|
||||||
)}</p>
|
)}</p>
|
||||||
<p>{_t(
|
<p>{_t(
|
||||||
"We'll store an encrypted copy of your keys on our server. " +
|
"We'll store an encrypted copy of your keys on our server. " +
|
||||||
"Secure your backup with a recovery passphrase.",
|
"Secure your backup with a Security Phrase.",
|
||||||
)}</p>
|
)}</p>
|
||||||
<p>{_t("For maximum security, this should be different from your account password.")}</p>
|
<p>{_t("For maximum security, this should be different from your account password.")}</p>
|
||||||
|
|
||||||
|
@ -252,10 +252,10 @@ export default class CreateKeyBackupDialog extends React.PureComponent {
|
||||||
onValidate={this._onPassPhraseValidate}
|
onValidate={this._onPassPhraseValidate}
|
||||||
fieldRef={this._passphraseField}
|
fieldRef={this._passphraseField}
|
||||||
autoFocus={true}
|
autoFocus={true}
|
||||||
label={_td("Enter a recovery passphrase")}
|
label={_td("Enter a Security Phrase")}
|
||||||
labelEnterPassword={_td("Enter a recovery passphrase")}
|
labelEnterPassword={_td("Enter a Security Phrase")}
|
||||||
labelStrongPassword={_td("Great! This recovery passphrase looks strong enough.")}
|
labelStrongPassword={_td("Great! This Security Phrase looks strong enough.")}
|
||||||
labelAllowedButUnsafe={_td("Great! This recovery passphrase looks strong enough.")}
|
labelAllowedButUnsafe={_td("Great! This Security Phrase looks strong enough.")}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -270,7 +270,7 @@ export default class CreateKeyBackupDialog extends React.PureComponent {
|
||||||
<details>
|
<details>
|
||||||
<summary>{_t("Advanced")}</summary>
|
<summary>{_t("Advanced")}</summary>
|
||||||
<AccessibleButton kind='primary' onClick={this._onSkipPassPhraseClick} >
|
<AccessibleButton kind='primary' onClick={this._onSkipPassPhraseClick} >
|
||||||
{_t("Set up with a recovery key")}
|
{_t("Set up with a Security Key")}
|
||||||
</AccessibleButton>
|
</AccessibleButton>
|
||||||
</details>
|
</details>
|
||||||
</form>;
|
</form>;
|
||||||
|
@ -310,7 +310,7 @@ export default class CreateKeyBackupDialog extends React.PureComponent {
|
||||||
const DialogButtons = sdk.getComponent('views.elements.DialogButtons');
|
const DialogButtons = sdk.getComponent('views.elements.DialogButtons');
|
||||||
return <form onSubmit={this._onPassPhraseConfirmNextClick}>
|
return <form onSubmit={this._onPassPhraseConfirmNextClick}>
|
||||||
<p>{_t(
|
<p>{_t(
|
||||||
"Please enter your recovery passphrase a second time to confirm.",
|
"Please enter your Security Phrase a second time to confirm.",
|
||||||
)}</p>
|
)}</p>
|
||||||
<div className="mx_CreateKeyBackupDialog_primaryContainer">
|
<div className="mx_CreateKeyBackupDialog_primaryContainer">
|
||||||
<div className="mx_CreateKeyBackupDialog_passPhraseContainer">
|
<div className="mx_CreateKeyBackupDialog_passPhraseContainer">
|
||||||
|
@ -319,7 +319,7 @@ export default class CreateKeyBackupDialog extends React.PureComponent {
|
||||||
onChange={this._onPassPhraseConfirmChange}
|
onChange={this._onPassPhraseConfirmChange}
|
||||||
value={this.state.passPhraseConfirm}
|
value={this.state.passPhraseConfirm}
|
||||||
className="mx_CreateKeyBackupDialog_passPhraseInput"
|
className="mx_CreateKeyBackupDialog_passPhraseInput"
|
||||||
placeholder={_t("Repeat your recovery passphrase...")}
|
placeholder={_t("Repeat your Security Phrase...")}
|
||||||
autoFocus={true}
|
autoFocus={true}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -338,15 +338,15 @@ export default class CreateKeyBackupDialog extends React.PureComponent {
|
||||||
_renderPhaseShowKey() {
|
_renderPhaseShowKey() {
|
||||||
return <div>
|
return <div>
|
||||||
<p>{_t(
|
<p>{_t(
|
||||||
"Your recovery key is a safety net - you can use it to restore " +
|
"Your Security Key is a safety net - you can use it to restore " +
|
||||||
"access to your encrypted messages if you forget your recovery passphrase.",
|
"access to your encrypted messages if you forget your Security Phrase.",
|
||||||
)}</p>
|
)}</p>
|
||||||
<p>{_t(
|
<p>{_t(
|
||||||
"Keep a copy of it somewhere secure, like a password manager or even a safe.",
|
"Keep a copy of it somewhere secure, like a password manager or even a safe.",
|
||||||
)}</p>
|
)}</p>
|
||||||
<div className="mx_CreateKeyBackupDialog_primaryContainer">
|
<div className="mx_CreateKeyBackupDialog_primaryContainer">
|
||||||
<div className="mx_CreateKeyBackupDialog_recoveryKeyHeader">
|
<div className="mx_CreateKeyBackupDialog_recoveryKeyHeader">
|
||||||
{_t("Your recovery key")}
|
{_t("Your Security Key")}
|
||||||
</div>
|
</div>
|
||||||
<div className="mx_CreateKeyBackupDialog_recoveryKeyContainer">
|
<div className="mx_CreateKeyBackupDialog_recoveryKeyContainer">
|
||||||
<div className="mx_CreateKeyBackupDialog_recoveryKey">
|
<div className="mx_CreateKeyBackupDialog_recoveryKey">
|
||||||
|
@ -369,12 +369,12 @@ export default class CreateKeyBackupDialog extends React.PureComponent {
|
||||||
let introText;
|
let introText;
|
||||||
if (this.state.copied) {
|
if (this.state.copied) {
|
||||||
introText = _t(
|
introText = _t(
|
||||||
"Your recovery key has been <b>copied to your clipboard</b>, paste it to:",
|
"Your Security Key has been <b>copied to your clipboard</b>, paste it to:",
|
||||||
{}, {b: s => <b>{s}</b>},
|
{}, {b: s => <b>{s}</b>},
|
||||||
);
|
);
|
||||||
} else if (this.state.downloaded) {
|
} else if (this.state.downloaded) {
|
||||||
introText = _t(
|
introText = _t(
|
||||||
"Your recovery key is in your <b>Downloads</b> folder.",
|
"Your Security Key is in your <b>Downloads</b> folder.",
|
||||||
{}, {b: s => <b>{s}</b>},
|
{}, {b: s => <b>{s}</b>},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -433,14 +433,14 @@ export default class CreateKeyBackupDialog extends React.PureComponent {
|
||||||
_titleForPhase(phase) {
|
_titleForPhase(phase) {
|
||||||
switch (phase) {
|
switch (phase) {
|
||||||
case PHASE_PASSPHRASE:
|
case PHASE_PASSPHRASE:
|
||||||
return _t('Secure your backup with a recovery passphrase');
|
return _t('Secure your backup with a Security Phrase');
|
||||||
case PHASE_PASSPHRASE_CONFIRM:
|
case PHASE_PASSPHRASE_CONFIRM:
|
||||||
return _t('Confirm your recovery passphrase');
|
return _t('Confirm your Security Phrase');
|
||||||
case PHASE_OPTOUT_CONFIRM:
|
case PHASE_OPTOUT_CONFIRM:
|
||||||
return _t('Warning!');
|
return _t('Warning!');
|
||||||
case PHASE_SHOWKEY:
|
case PHASE_SHOWKEY:
|
||||||
case PHASE_KEEPITSAFE:
|
case PHASE_KEEPITSAFE:
|
||||||
return _t('Make a copy of your recovery key');
|
return _t('Make a copy of your Security Key');
|
||||||
case PHASE_BACKINGUP:
|
case PHASE_BACKINGUP:
|
||||||
return _t('Starting backup...');
|
return _t('Starting backup...');
|
||||||
case PHASE_DONE:
|
case PHASE_DONE:
|
||||||
|
|
|
@ -235,7 +235,7 @@ export default class CreateSecretStorageDialog extends React.PureComponent {
|
||||||
const blob = new Blob([this._recoveryKey.encodedPrivateKey], {
|
const blob = new Blob([this._recoveryKey.encodedPrivateKey], {
|
||||||
type: 'text/plain;charset=us-ascii',
|
type: 'text/plain;charset=us-ascii',
|
||||||
});
|
});
|
||||||
FileSaver.saveAs(blob, 'recovery-key.txt');
|
FileSaver.saveAs(blob, 'security-key.txt');
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
downloaded: true,
|
downloaded: true,
|
||||||
|
@ -593,10 +593,10 @@ export default class CreateSecretStorageDialog extends React.PureComponent {
|
||||||
onValidate={this._onPassPhraseValidate}
|
onValidate={this._onPassPhraseValidate}
|
||||||
fieldRef={this._passphraseField}
|
fieldRef={this._passphraseField}
|
||||||
autoFocus={true}
|
autoFocus={true}
|
||||||
label={_td("Enter a recovery passphrase")}
|
label={_td("Enter a Security Phrase")}
|
||||||
labelEnterPassword={_td("Enter a recovery passphrase")}
|
labelEnterPassword={_td("Enter a Security Phrase")}
|
||||||
labelStrongPassword={_td("Great! This recovery passphrase looks strong enough.")}
|
labelStrongPassword={_td("Great! This Security Phrase looks strong enough.")}
|
||||||
labelAllowedButUnsafe={_td("Great! This recovery passphrase looks strong enough.")}
|
labelAllowedButUnsafe={_td("Great! This Security Phrase looks strong enough.")}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ export default class NewRecoveryMethodDialog extends React.PureComponent {
|
||||||
</span>;
|
</span>;
|
||||||
|
|
||||||
const newMethodDetected = <p>{_t(
|
const newMethodDetected = <p>{_t(
|
||||||
"A new recovery passphrase and key for Secure Messages have been detected.",
|
"A new Security Phrase and key for Secure Messages have been detected.",
|
||||||
)}</p>;
|
)}</p>;
|
||||||
|
|
||||||
const hackWarning = <p className="warning">{_t(
|
const hackWarning = <p className="warning">{_t(
|
||||||
|
|
|
@ -56,7 +56,7 @@ export default class RecoveryMethodRemovedDialog extends React.PureComponent {
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<p>{_t(
|
<p>{_t(
|
||||||
"This session has detected that your recovery passphrase and key " +
|
"This session has detected that your Security Phrase and key " +
|
||||||
"for Secure Messages have been removed.",
|
"for Secure Messages have been removed.",
|
||||||
)}</p>
|
)}</p>
|
||||||
<p>{_t(
|
<p>{_t(
|
||||||
|
|
|
@ -45,7 +45,7 @@ class FilePanel extends React.Component {
|
||||||
};
|
};
|
||||||
|
|
||||||
onRoomTimeline = (ev, room, toStartOfTimeline, removed, data) => {
|
onRoomTimeline = (ev, room, toStartOfTimeline, removed, data) => {
|
||||||
if (room.roomId !== this.props.roomId) return;
|
if (room?.roomId !== this.props?.roomId) return;
|
||||||
if (toStartOfTimeline || !data || !data.liveEvent || ev.isRedacted()) return;
|
if (toStartOfTimeline || !data || !data.liveEvent || ev.isRedacted()) return;
|
||||||
|
|
||||||
if (ev.isBeingDecrypted()) {
|
if (ev.isBeingDecrypted()) {
|
||||||
|
|
45
src/components/structures/HostSignupAction.tsx
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
/*
|
||||||
|
Copyright 2021 The Matrix.org Foundation C.I.C.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import React from "react";
|
||||||
|
import {
|
||||||
|
IconizedContextMenuOption,
|
||||||
|
IconizedContextMenuOptionList,
|
||||||
|
} from "../views/context_menus/IconizedContextMenu";
|
||||||
|
import { _t } from "../../languageHandler";
|
||||||
|
import { HostSignupStore } from "../../stores/HostSignupStore";
|
||||||
|
|
||||||
|
interface IProps {}
|
||||||
|
|
||||||
|
interface IState {}
|
||||||
|
|
||||||
|
export default class HostSignupAction extends React.PureComponent<IProps, IState> {
|
||||||
|
private openDialog = async () => {
|
||||||
|
await HostSignupStore.instance.setHostSignupActive(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public render(): React.ReactNode {
|
||||||
|
return (
|
||||||
|
<IconizedContextMenuOptionList>
|
||||||
|
<IconizedContextMenuOption
|
||||||
|
iconClassName="mx_UserMenu_iconHosting"
|
||||||
|
label={_t("Upgrade to pro")}
|
||||||
|
onClick={this.openDialog}
|
||||||
|
/>
|
||||||
|
</IconizedContextMenuOptionList>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -177,7 +177,14 @@ export default class InteractiveAuthComponent extends React.Component {
|
||||||
stageState: stageState,
|
stageState: stageState,
|
||||||
errorText: stageState.error,
|
errorText: stageState.error,
|
||||||
}, () => {
|
}, () => {
|
||||||
if (oldStage != stageType) this._setFocus();
|
if (oldStage !== stageType) {
|
||||||
|
this._setFocus();
|
||||||
|
} else if (
|
||||||
|
!stageState.error && this._stageComponent.current &&
|
||||||
|
this._stageComponent.current.attemptFailed
|
||||||
|
) {
|
||||||
|
this._stageComponent.current.attemptFailed();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ const LeftPanelWidget: React.FC<IProps> = ({ onResize }) => {
|
||||||
|
|
||||||
const [height, setHeight] = useLocalStorageState("left-panel-widget-height", INITIAL_HEIGHT);
|
const [height, setHeight] = useLocalStorageState("left-panel-widget-height", INITIAL_HEIGHT);
|
||||||
const [expanded, setExpanded] = useLocalStorageState("left-panel-widget-expanded", true);
|
const [expanded, setExpanded] = useLocalStorageState("left-panel-widget-expanded", true);
|
||||||
useEffect(onResize, [expanded]);
|
useEffect(onResize, [expanded, onResize]);
|
||||||
|
|
||||||
const [onFocus, isActive, ref] = useRovingTabIndex();
|
const [onFocus, isActive, ref] = useRovingTabIndex();
|
||||||
const tabIndex = isActive ? 0 : -1;
|
const tabIndex = isActive ? 0 : -1;
|
||||||
|
|
|
@ -54,6 +54,7 @@ import { ToggleRightPanelPayload } from "../../dispatcher/payloads/ToggleRightPa
|
||||||
import { IThreepidInvite } from "../../stores/ThreepidInviteStore";
|
import { IThreepidInvite } from "../../stores/ThreepidInviteStore";
|
||||||
import Modal from "../../Modal";
|
import Modal from "../../Modal";
|
||||||
import { ICollapseConfig } from "../../resizer/distributors/collapse";
|
import { ICollapseConfig } from "../../resizer/distributors/collapse";
|
||||||
|
import HostSignupContainer from '../views/host_signup/HostSignupContainer';
|
||||||
|
|
||||||
// We need to fetch each pinned message individually (if we don't already have it)
|
// We need to fetch each pinned message individually (if we don't already have it)
|
||||||
// so each pinned message may trigger a request. Limit the number per room for sanity.
|
// so each pinned message may trigger a request. Limit the number per room for sanity.
|
||||||
|
@ -215,10 +216,12 @@ class LoggedInView extends React.Component<IProps, IState> {
|
||||||
|
|
||||||
_createResizer() {
|
_createResizer() {
|
||||||
let size;
|
let size;
|
||||||
|
let collapsed;
|
||||||
const collapseConfig: ICollapseConfig = {
|
const collapseConfig: ICollapseConfig = {
|
||||||
toggleSize: 260 - 50,
|
toggleSize: 260 - 50,
|
||||||
onCollapsed: (collapsed) => {
|
onCollapsed: (_collapsed) => {
|
||||||
if (collapsed) {
|
collapsed = _collapsed;
|
||||||
|
if (_collapsed) {
|
||||||
dis.dispatch({action: "hide_left_panel"}, true);
|
dis.dispatch({action: "hide_left_panel"}, true);
|
||||||
window.localStorage.setItem("mx_lhs_size", '0');
|
window.localStorage.setItem("mx_lhs_size", '0');
|
||||||
} else {
|
} else {
|
||||||
|
@ -233,7 +236,7 @@ class LoggedInView extends React.Component<IProps, IState> {
|
||||||
this.props.resizeNotifier.startResizing();
|
this.props.resizeNotifier.startResizing();
|
||||||
},
|
},
|
||||||
onResizeStop: () => {
|
onResizeStop: () => {
|
||||||
window.localStorage.setItem("mx_lhs_size", '' + size);
|
if (!collapsed) window.localStorage.setItem("mx_lhs_size", '' + size);
|
||||||
this.props.resizeNotifier.stopResizing();
|
this.props.resizeNotifier.stopResizing();
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -425,6 +428,14 @@ class LoggedInView extends React.Component<IProps, IState> {
|
||||||
handled = true;
|
handled = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case Key.F:
|
||||||
|
if (ctrlCmdOnly && SettingsStore.getValue("ctrlFForSearch")) {
|
||||||
|
dis.dispatch({
|
||||||
|
action: 'focus_search',
|
||||||
|
});
|
||||||
|
handled = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case Key.BACKTICK:
|
case Key.BACKTICK:
|
||||||
// Ideally this would be CTRL+P for "Profile", but that's
|
// Ideally this would be CTRL+P for "Profile", but that's
|
||||||
// taken by the print dialog. CTRL+I for "Information"
|
// taken by the print dialog. CTRL+I for "Information"
|
||||||
|
@ -638,6 +649,7 @@ class LoggedInView extends React.Component<IProps, IState> {
|
||||||
</div>
|
</div>
|
||||||
<CallContainer />
|
<CallContainer />
|
||||||
<NonUrgentToastContainer />
|
<NonUrgentToastContainer />
|
||||||
|
<HostSignupContainer />
|
||||||
</MatrixClientContext.Provider>
|
</MatrixClientContext.Provider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,6 +81,7 @@ import ThreepidInviteStore, { IThreepidInvite, IThreepidInviteWireFormat } from
|
||||||
import {UIFeature} from "../../settings/UIFeature";
|
import {UIFeature} from "../../settings/UIFeature";
|
||||||
import { CommunityPrototypeStore } from "../../stores/CommunityPrototypeStore";
|
import { CommunityPrototypeStore } from "../../stores/CommunityPrototypeStore";
|
||||||
import DialPadModal from "../views/voip/DialPadModal";
|
import DialPadModal from "../views/voip/DialPadModal";
|
||||||
|
import { showToast as showMobileGuideToast } from '../../toasts/MobileGuideToast';
|
||||||
|
|
||||||
/** constants for MatrixChat.state.view */
|
/** constants for MatrixChat.state.view */
|
||||||
export enum Views {
|
export enum Views {
|
||||||
|
@ -218,6 +219,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||||
private screenAfterLogin?: IScreen;
|
private screenAfterLogin?: IScreen;
|
||||||
private windowWidth: number;
|
private windowWidth: number;
|
||||||
private pageChanging: boolean;
|
private pageChanging: boolean;
|
||||||
|
private tokenLogin?: boolean;
|
||||||
private accountPassword?: string;
|
private accountPassword?: string;
|
||||||
private accountPasswordTimer?: NodeJS.Timeout;
|
private accountPasswordTimer?: NodeJS.Timeout;
|
||||||
private focusComposer: boolean;
|
private focusComposer: boolean;
|
||||||
|
@ -323,13 +325,21 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||||
Lifecycle.attemptTokenLogin(
|
Lifecycle.attemptTokenLogin(
|
||||||
this.props.realQueryParams,
|
this.props.realQueryParams,
|
||||||
this.props.defaultDeviceDisplayName,
|
this.props.defaultDeviceDisplayName,
|
||||||
).then((loggedIn) => {
|
this.getFragmentAfterLogin(),
|
||||||
if (loggedIn) {
|
).then(async (loggedIn) => {
|
||||||
|
if (this.props.realQueryParams?.loginToken) {
|
||||||
|
// remove the loginToken from the URL regardless
|
||||||
this.props.onTokenLoginCompleted();
|
this.props.onTokenLoginCompleted();
|
||||||
|
}
|
||||||
|
|
||||||
// don't do anything else until the page reloads - just stay in
|
if (loggedIn) {
|
||||||
// the 'loading' state.
|
this.tokenLogin = true;
|
||||||
return;
|
|
||||||
|
// Create and start the client
|
||||||
|
await Lifecycle.restoreFromLocalStorage({
|
||||||
|
ignoreGuest: true,
|
||||||
|
});
|
||||||
|
return this.postLoginSetup();
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the user has followed a login or register link, don't reanimate
|
// if the user has followed a login or register link, don't reanimate
|
||||||
|
@ -353,6 +363,42 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||||
CountlyAnalytics.instance.enable(/* anonymous = */ true);
|
CountlyAnalytics.instance.enable(/* anonymous = */ true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async postLoginSetup() {
|
||||||
|
const cli = MatrixClientPeg.get();
|
||||||
|
const cryptoEnabled = cli.isCryptoEnabled();
|
||||||
|
if (!cryptoEnabled) {
|
||||||
|
this.onLoggedIn();
|
||||||
|
}
|
||||||
|
|
||||||
|
const promisesList = [this.firstSyncPromise.promise];
|
||||||
|
if (cryptoEnabled) {
|
||||||
|
// wait for the client to finish downloading cross-signing keys for us so we
|
||||||
|
// know whether or not we have keys set up on this account
|
||||||
|
promisesList.push(cli.downloadKeys([cli.getUserId()]));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now update the state to say we're waiting for the first sync to complete rather
|
||||||
|
// than for the login to finish.
|
||||||
|
this.setState({ pendingInitialSync: true });
|
||||||
|
|
||||||
|
await Promise.all(promisesList);
|
||||||
|
|
||||||
|
if (!cryptoEnabled) {
|
||||||
|
this.setState({ pendingInitialSync: false });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const crossSigningIsSetUp = cli.getStoredCrossSigningForUser(cli.getUserId());
|
||||||
|
if (crossSigningIsSetUp) {
|
||||||
|
this.setStateForNewView({ view: Views.COMPLETE_SECURITY });
|
||||||
|
} else if (await cli.doesServerSupportUnstableFeature("org.matrix.e2e_cross_signing")) {
|
||||||
|
this.setStateForNewView({ view: Views.E2E_SETUP });
|
||||||
|
} else {
|
||||||
|
this.onLoggedIn();
|
||||||
|
}
|
||||||
|
this.setState({ pendingInitialSync: false });
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: [REACT-WARNING] Replace with appropriate lifecycle stage
|
// TODO: [REACT-WARNING] Replace with appropriate lifecycle stage
|
||||||
// eslint-disable-next-line camelcase
|
// eslint-disable-next-line camelcase
|
||||||
UNSAFE_componentWillUpdate(props, state) {
|
UNSAFE_componentWillUpdate(props, state) {
|
||||||
|
@ -709,6 +755,8 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||||
break;
|
break;
|
||||||
case 'on_logged_in':
|
case 'on_logged_in':
|
||||||
if (
|
if (
|
||||||
|
// Skip this handling for token login as that always calls onLoggedIn itself
|
||||||
|
!this.tokenLogin &&
|
||||||
!Lifecycle.isSoftLogout() &&
|
!Lifecycle.isSoftLogout() &&
|
||||||
this.state.view !== Views.LOGIN &&
|
this.state.view !== Views.LOGIN &&
|
||||||
this.state.view !== Views.REGISTER &&
|
this.state.view !== Views.REGISTER &&
|
||||||
|
@ -1186,6 +1234,11 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||||
) {
|
) {
|
||||||
showAnalyticsToast(this.props.config.piwik?.policyUrl);
|
showAnalyticsToast(this.props.config.piwik?.policyUrl);
|
||||||
}
|
}
|
||||||
|
if (SdkConfig.get().mobileGuideToast) {
|
||||||
|
// The toast contains further logic to detect mobile platforms,
|
||||||
|
// check if it has been dismissed before, etc.
|
||||||
|
showMobileGuideToast();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private showScreenAfterLogin() {
|
private showScreenAfterLogin() {
|
||||||
|
@ -1322,6 +1375,9 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||||
cli.on('Session.logged_out', function(errObj) {
|
cli.on('Session.logged_out', function(errObj) {
|
||||||
if (Lifecycle.isLoggingOut()) return;
|
if (Lifecycle.isLoggingOut()) return;
|
||||||
|
|
||||||
|
// A modal might have been open when we were logged out by the server
|
||||||
|
Modal.closeCurrentModal('Session.logged_out');
|
||||||
|
|
||||||
if (errObj.httpStatus === 401 && errObj.data && errObj.data['soft_logout']) {
|
if (errObj.httpStatus === 401 && errObj.data && errObj.data['soft_logout']) {
|
||||||
console.warn("Soft logout issued by server - avoiding data deletion");
|
console.warn("Soft logout issued by server - avoiding data deletion");
|
||||||
Lifecycle.softLogout();
|
Lifecycle.softLogout();
|
||||||
|
@ -1332,6 +1388,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||||
title: _t('Signed Out'),
|
title: _t('Signed Out'),
|
||||||
description: _t('For security, this session has been signed out. Please sign in again.'),
|
description: _t('For security, this session has been signed out. Please sign in again.'),
|
||||||
});
|
});
|
||||||
|
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
action: 'logout',
|
action: 'logout',
|
||||||
});
|
});
|
||||||
|
@ -1601,10 +1658,16 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||||
// TODO: Handle encoded room/event IDs: https://github.com/vector-im/element-web/issues/9149
|
// TODO: Handle encoded room/event IDs: https://github.com/vector-im/element-web/issues/9149
|
||||||
|
|
||||||
let threepidInvite: IThreepidInvite;
|
let threepidInvite: IThreepidInvite;
|
||||||
|
// if we landed here from a 3PID invite, persist it
|
||||||
if (params.signurl && params.email) {
|
if (params.signurl && params.email) {
|
||||||
threepidInvite = ThreepidInviteStore.instance
|
threepidInvite = ThreepidInviteStore.instance
|
||||||
.storeInvite(roomString, params as IThreepidInviteWireFormat);
|
.storeInvite(roomString, params as IThreepidInviteWireFormat);
|
||||||
}
|
}
|
||||||
|
// otherwise check that this room doesn't already have a known invite
|
||||||
|
if (!threepidInvite) {
|
||||||
|
const invites = ThreepidInviteStore.instance.getInvites();
|
||||||
|
threepidInvite = invites.find(invite => invite.roomId === roomString);
|
||||||
|
}
|
||||||
|
|
||||||
// on our URLs there might be a ?via=matrix.org or similar to help
|
// on our URLs there might be a ?via=matrix.org or similar to help
|
||||||
// joins to the room succeed. We'll pass these through as an array
|
// joins to the room succeed. We'll pass these through as an array
|
||||||
|
@ -1833,40 +1896,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||||
|
|
||||||
// Create and start the client
|
// Create and start the client
|
||||||
await Lifecycle.setLoggedIn(credentials);
|
await Lifecycle.setLoggedIn(credentials);
|
||||||
|
await this.postLoginSetup();
|
||||||
const cli = MatrixClientPeg.get();
|
|
||||||
const cryptoEnabled = cli.isCryptoEnabled();
|
|
||||||
if (!cryptoEnabled) {
|
|
||||||
this.onLoggedIn();
|
|
||||||
}
|
|
||||||
|
|
||||||
const promisesList = [this.firstSyncPromise.promise];
|
|
||||||
if (cryptoEnabled) {
|
|
||||||
// wait for the client to finish downloading cross-signing keys for us so we
|
|
||||||
// know whether or not we have keys set up on this account
|
|
||||||
promisesList.push(cli.downloadKeys([cli.getUserId()]));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now update the state to say we're waiting for the first sync to complete rather
|
|
||||||
// than for the login to finish.
|
|
||||||
this.setState({ pendingInitialSync: true });
|
|
||||||
|
|
||||||
await Promise.all(promisesList);
|
|
||||||
|
|
||||||
if (!cryptoEnabled) {
|
|
||||||
this.setState({ pendingInitialSync: false });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const crossSigningIsSetUp = cli.getStoredCrossSigningForUser(cli.getUserId());
|
|
||||||
if (crossSigningIsSetUp) {
|
|
||||||
this.setStateForNewView({ view: Views.COMPLETE_SECURITY });
|
|
||||||
} else if (await cli.doesServerSupportUnstableFeature("org.matrix.e2e_cross_signing")) {
|
|
||||||
this.setStateForNewView({ view: Views.E2E_SETUP });
|
|
||||||
} else {
|
|
||||||
this.onLoggedIn();
|
|
||||||
}
|
|
||||||
this.setState({ pendingInitialSync: false });
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// complete security / e2e setup has finished
|
// complete security / e2e setup has finished
|
||||||
|
@ -1910,6 +1940,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||||
<E2eSetup
|
<E2eSetup
|
||||||
onFinished={this.onCompleteSecurityE2eSetupFinished}
|
onFinished={this.onCompleteSecurityE2eSetupFinished}
|
||||||
accountPassword={this.accountPassword}
|
accountPassword={this.accountPassword}
|
||||||
|
tokenLogin={!!this.tokenLogin}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
} else if (this.state.view === Views.LOGGED_IN) {
|
} else if (this.state.view === Views.LOGGED_IN) {
|
||||||
|
|
|
@ -23,6 +23,7 @@ import classNames from 'classnames';
|
||||||
import shouldHideEvent from '../../shouldHideEvent';
|
import shouldHideEvent from '../../shouldHideEvent';
|
||||||
import {wantsDateSeparator} from '../../DateUtils';
|
import {wantsDateSeparator} from '../../DateUtils';
|
||||||
import * as sdk from '../../index';
|
import * as sdk from '../../index';
|
||||||
|
import dis from "../../dispatcher/dispatcher";
|
||||||
|
|
||||||
import {MatrixClientPeg} from '../../MatrixClientPeg';
|
import {MatrixClientPeg} from '../../MatrixClientPeg';
|
||||||
import SettingsStore from '../../settings/SettingsStore';
|
import SettingsStore from '../../settings/SettingsStore';
|
||||||
|
@ -207,11 +208,13 @@ export default class MessagePanel extends React.Component {
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this._isMounted = true;
|
this._isMounted = true;
|
||||||
|
this.dispatcherRef = dis.register(this.onAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
this._isMounted = false;
|
this._isMounted = false;
|
||||||
SettingsStore.unwatchSetting(this._showTypingNotificationsWatcherRef);
|
SettingsStore.unwatchSetting(this._showTypingNotificationsWatcherRef);
|
||||||
|
dis.unregister(this.dispatcherRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate(prevProps, prevState) {
|
componentDidUpdate(prevProps, prevState) {
|
||||||
|
@ -224,6 +227,14 @@ export default class MessagePanel extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onAction = (payload) => {
|
||||||
|
switch (payload.action) {
|
||||||
|
case "scroll_to_bottom":
|
||||||
|
this.scrollToBottom();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onShowTypingNotificationsChange = () => {
|
onShowTypingNotificationsChange = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
showTypingNotifications: SettingsStore.getValue("showTypingNotifications"),
|
showTypingNotifications: SettingsStore.getValue("showTypingNotifications"),
|
||||||
|
|
|
@ -30,7 +30,6 @@ import MatrixClientContext from "../../contexts/MatrixClientContext";
|
||||||
import {Action} from "../../dispatcher/actions";
|
import {Action} from "../../dispatcher/actions";
|
||||||
import RoomSummaryCard from "../views/right_panel/RoomSummaryCard";
|
import RoomSummaryCard from "../views/right_panel/RoomSummaryCard";
|
||||||
import WidgetCard from "../views/right_panel/WidgetCard";
|
import WidgetCard from "../views/right_panel/WidgetCard";
|
||||||
import defaultDispatcher from "../../dispatcher/dispatcher";
|
|
||||||
|
|
||||||
export default class RightPanel extends React.Component {
|
export default class RightPanel extends React.Component {
|
||||||
static get propTypes() {
|
static get propTypes() {
|
||||||
|
@ -186,7 +185,7 @@ export default class RightPanel extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onCloseUserInfo = () => {
|
onClose = () => {
|
||||||
// XXX: There are three different ways of 'closing' this panel depending on what state
|
// XXX: There are three different ways of 'closing' this panel depending on what state
|
||||||
// things are in... this knows far more than it should do about the state of the rest
|
// things are in... this knows far more than it should do about the state of the rest
|
||||||
// of the app and is generally a bit silly.
|
// of the app and is generally a bit silly.
|
||||||
|
@ -198,29 +197,19 @@ export default class RightPanel extends React.Component {
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
action: "view_home_page",
|
action: "view_home_page",
|
||||||
});
|
});
|
||||||
} else if (this.state.phase === RightPanelPhases.EncryptionPanel &&
|
} else if (
|
||||||
|
this.state.phase === RightPanelPhases.EncryptionPanel &&
|
||||||
this.state.verificationRequest && this.state.verificationRequest.pending
|
this.state.verificationRequest && this.state.verificationRequest.pending
|
||||||
) {
|
) {
|
||||||
// When the user clicks close on the encryption panel cancel the pending request first if any
|
// When the user clicks close on the encryption panel cancel the pending request first if any
|
||||||
this.state.verificationRequest.cancel();
|
this.state.verificationRequest.cancel();
|
||||||
} else {
|
} else {
|
||||||
// Otherwise we have got our user from RoomViewStore which means we're being shown
|
|
||||||
// within a room/group, so go back to the member panel if we were in the encryption panel,
|
|
||||||
// or the member list if we were in the member panel... phew.
|
|
||||||
const isEncryptionPhase = this.state.phase === RightPanelPhases.EncryptionPanel;
|
|
||||||
dis.dispatch({
|
|
||||||
action: Action.ViewUser,
|
|
||||||
member: isEncryptionPhase ? this.state.member : null,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
onClose = () => {
|
|
||||||
// the RightPanelStore has no way of knowing which mode room/group it is in, so we handle closing here
|
// the RightPanelStore has no way of knowing which mode room/group it is in, so we handle closing here
|
||||||
defaultDispatcher.dispatch({
|
dis.dispatch({
|
||||||
action: Action.ToggleRightPanel,
|
action: Action.ToggleRightPanel,
|
||||||
type: this.props.groupId ? "group" : "room",
|
type: this.props.groupId ? "group" : "room",
|
||||||
});
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -260,7 +249,7 @@ export default class RightPanel extends React.Component {
|
||||||
user={this.state.member}
|
user={this.state.member}
|
||||||
room={this.props.room}
|
room={this.props.room}
|
||||||
key={roomId || this.state.member.userId}
|
key={roomId || this.state.member.userId}
|
||||||
onClose={this.onCloseUserInfo}
|
onClose={this.onClose}
|
||||||
phase={this.state.phase}
|
phase={this.state.phase}
|
||||||
verificationRequest={this.state.verificationRequest}
|
verificationRequest={this.state.verificationRequest}
|
||||||
verificationRequestPromise={this.state.verificationRequestPromise}
|
verificationRequestPromise={this.state.verificationRequestPromise}
|
||||||
|
@ -276,7 +265,7 @@ export default class RightPanel extends React.Component {
|
||||||
user={this.state.member}
|
user={this.state.member}
|
||||||
groupId={this.props.groupId}
|
groupId={this.props.groupId}
|
||||||
key={this.state.member.userId}
|
key={this.state.member.userId}
|
||||||
onClose={this.onCloseUserInfo} />;
|
onClose={this.onClose} />;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RightPanelPhases.GroupRoomInfo:
|
case RightPanelPhases.GroupRoomInfo:
|
||||||
|
|
|
@ -477,7 +477,7 @@ export default class RoomDirectory extends React.Component {
|
||||||
dis.dispatch(payload);
|
dis.dispatch(payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
getRow(room) {
|
createRoomCells(room) {
|
||||||
const client = MatrixClientPeg.get();
|
const client = MatrixClientPeg.get();
|
||||||
const clientRoom = client.getRoom(room.room_id);
|
const clientRoom = client.getRoom(room.room_id);
|
||||||
const hasJoinedRoom = clientRoom && clientRoom.getMyMembership() === "join";
|
const hasJoinedRoom = clientRoom && clientRoom.getMyMembership() === "join";
|
||||||
|
@ -523,31 +523,56 @@ export default class RoomDirectory extends React.Component {
|
||||||
MatrixClientPeg.get().getHomeserverUrl(),
|
MatrixClientPeg.get().getHomeserverUrl(),
|
||||||
room.avatar_url, 32, 32, "crop",
|
room.avatar_url, 32, 32, "crop",
|
||||||
);
|
);
|
||||||
return (
|
return [
|
||||||
<tr key={ room.room_id }
|
<div key={ `${room.room_id}_avatar` }
|
||||||
onClick={(ev) => this.onRoomClicked(room, ev)}
|
onClick={(ev) => this.onRoomClicked(room, ev)}
|
||||||
// cancel onMouseDown otherwise shift-clicking highlights text
|
// cancel onMouseDown otherwise shift-clicking highlights text
|
||||||
onMouseDown={(ev) => {ev.preventDefault();}}
|
onMouseDown={(ev) => {ev.preventDefault();}}
|
||||||
|
className="mx_RoomDirectory_roomAvatar"
|
||||||
>
|
>
|
||||||
<td className="mx_RoomDirectory_roomAvatar">
|
|
||||||
<BaseAvatar width={32} height={32} resizeMethod='crop'
|
<BaseAvatar width={32} height={32} resizeMethod='crop'
|
||||||
name={ name } idName={ name }
|
name={ name } idName={ name }
|
||||||
url={ avatarUrl } />
|
url={ avatarUrl }
|
||||||
</td>
|
/>
|
||||||
<td className="mx_RoomDirectory_roomDescription">
|
</div>,
|
||||||
|
<div key={ `${room.room_id}_description` }
|
||||||
|
onClick={(ev) => this.onRoomClicked(room, ev)}
|
||||||
|
// cancel onMouseDown otherwise shift-clicking highlights text
|
||||||
|
onMouseDown={(ev) => {ev.preventDefault();}}
|
||||||
|
className="mx_RoomDirectory_roomDescription"
|
||||||
|
>
|
||||||
<div className="mx_RoomDirectory_name">{ name }</div>
|
<div className="mx_RoomDirectory_name">{ name }</div>
|
||||||
<div className="mx_RoomDirectory_topic"
|
<div className="mx_RoomDirectory_topic"
|
||||||
onClick={ (ev) => { ev.stopPropagation(); } }
|
onClick={ (ev) => { ev.stopPropagation(); } }
|
||||||
dangerouslySetInnerHTML={{ __html: topic }} />
|
dangerouslySetInnerHTML={{ __html: topic }}
|
||||||
|
/>
|
||||||
<div className="mx_RoomDirectory_alias">{ get_display_alias_for_room(room) }</div>
|
<div className="mx_RoomDirectory_alias">{ get_display_alias_for_room(room) }</div>
|
||||||
</td>
|
</div>,
|
||||||
<td className="mx_RoomDirectory_roomMemberCount">
|
<div key={ `${room.room_id}_memberCount` }
|
||||||
|
onClick={(ev) => this.onRoomClicked(room, ev)}
|
||||||
|
// cancel onMouseDown otherwise shift-clicking highlights text
|
||||||
|
onMouseDown={(ev) => {ev.preventDefault();}}
|
||||||
|
className="mx_RoomDirectory_roomMemberCount"
|
||||||
|
>
|
||||||
{ room.num_joined_members }
|
{ room.num_joined_members }
|
||||||
</td>
|
</div>,
|
||||||
<td className="mx_RoomDirectory_preview">{previewButton}</td>
|
<div key={ `${room.room_id}_preview` }
|
||||||
<td className="mx_RoomDirectory_join">{joinOrViewButton}</td>
|
onClick={(ev) => this.onRoomClicked(room, ev)}
|
||||||
</tr>
|
// cancel onMouseDown otherwise shift-clicking highlights text
|
||||||
);
|
onMouseDown={(ev) => {ev.preventDefault();}}
|
||||||
|
className="mx_RoomDirectory_preview"
|
||||||
|
>
|
||||||
|
{previewButton}
|
||||||
|
</div>,
|
||||||
|
<div key={ `${room.room_id}_join` }
|
||||||
|
onClick={(ev) => this.onRoomClicked(room, ev)}
|
||||||
|
// cancel onMouseDown otherwise shift-clicking highlights text
|
||||||
|
onMouseDown={(ev) => {ev.preventDefault();}}
|
||||||
|
className="mx_RoomDirectory_join"
|
||||||
|
>
|
||||||
|
{joinOrViewButton}
|
||||||
|
</div>,
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
collectScrollPanel = (element) => {
|
collectScrollPanel = (element) => {
|
||||||
|
@ -606,7 +631,8 @@ export default class RoomDirectory extends React.Component {
|
||||||
} else if (this.state.protocolsLoading) {
|
} else if (this.state.protocolsLoading) {
|
||||||
content = <Loader />;
|
content = <Loader />;
|
||||||
} else {
|
} else {
|
||||||
const rows = (this.state.publicRooms || []).map(room => this.getRow(room));
|
const cells = (this.state.publicRooms || [])
|
||||||
|
.reduce((cells, room) => cells.concat(this.createRoomCells(room)), [],);
|
||||||
// we still show the scrollpanel, at least for now, because
|
// we still show the scrollpanel, at least for now, because
|
||||||
// otherwise we don't fetch more because we don't get a fill
|
// otherwise we don't fetch more because we don't get a fill
|
||||||
// request from the scrollpanel because there isn't one
|
// request from the scrollpanel because there isn't one
|
||||||
|
@ -617,14 +643,12 @@ export default class RoomDirectory extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
let scrollpanel_content;
|
let scrollpanel_content;
|
||||||
if (rows.length === 0 && !this.state.loading) {
|
if (cells.length === 0 && !this.state.loading) {
|
||||||
scrollpanel_content = <i>{ _t('No rooms to show') }</i>;
|
scrollpanel_content = <i>{ _t('No rooms to show') }</i>;
|
||||||
} else {
|
} else {
|
||||||
scrollpanel_content = <table className="mx_RoomDirectory_table">
|
scrollpanel_content = <div className="mx_RoomDirectory_table">
|
||||||
<tbody>
|
{ cells }
|
||||||
{ rows }
|
</div>;
|
||||||
</tbody>
|
|
||||||
</table>;
|
|
||||||
}
|
}
|
||||||
const ScrollPanel = sdk.getComponent("structures.ScrollPanel");
|
const ScrollPanel = sdk.getComponent("structures.ScrollPanel");
|
||||||
content = <ScrollPanel ref={this.collectScrollPanel}
|
content = <ScrollPanel ref={this.collectScrollPanel}
|
||||||
|
|
|
@ -79,6 +79,7 @@ import {UPDATE_EVENT} from "../../stores/AsyncStore";
|
||||||
import Notifier from "../../Notifier";
|
import Notifier from "../../Notifier";
|
||||||
import { showToast as showNotificationsToast } from "../../toasts/DesktopNotificationsToast";
|
import { showToast as showNotificationsToast } from "../../toasts/DesktopNotificationsToast";
|
||||||
import { RoomNotificationStateStore } from "../../stores/notifications/RoomNotificationStateStore";
|
import { RoomNotificationStateStore } from "../../stores/notifications/RoomNotificationStateStore";
|
||||||
|
import { Container, WidgetLayoutStore } from "../../stores/widgets/WidgetLayoutStore";
|
||||||
|
|
||||||
const DEBUG = false;
|
const DEBUG = false;
|
||||||
let debuglog = function(msg: string) {};
|
let debuglog = function(msg: string) {};
|
||||||
|
@ -267,12 +268,6 @@ export default class RoomView extends React.Component<IProps, IState> {
|
||||||
this.layoutWatcherRef = SettingsStore.watchSetting("layout", null, this.onLayoutChange);
|
this.layoutWatcherRef = SettingsStore.watchSetting("layout", null, this.onLayoutChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: [REACT-WARNING] Move into constructor
|
|
||||||
// eslint-disable-next-line camelcase
|
|
||||||
UNSAFE_componentWillMount() {
|
|
||||||
this.onRoomViewStoreUpdate(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private onWidgetStoreUpdate = () => {
|
private onWidgetStoreUpdate = () => {
|
||||||
if (this.state.room) {
|
if (this.state.room) {
|
||||||
this.checkWidgets(this.state.room);
|
this.checkWidgets(this.state.room);
|
||||||
|
@ -281,8 +276,9 @@ export default class RoomView extends React.Component<IProps, IState> {
|
||||||
|
|
||||||
private checkWidgets = (room) => {
|
private checkWidgets = (room) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
hasPinnedWidgets: WidgetStore.instance.getPinnedApps(room.roomId).length > 0,
|
hasPinnedWidgets: WidgetLayoutStore.instance.getContainerWidgets(room, Container.Top).length > 0,
|
||||||
})
|
showApps: this.shouldShowApps(room),
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
private onReadReceiptsChange = () => {
|
private onReadReceiptsChange = () => {
|
||||||
|
@ -419,11 +415,17 @@ export default class RoomView extends React.Component<IProps, IState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private onWidgetEchoStoreUpdate = () => {
|
private onWidgetEchoStoreUpdate = () => {
|
||||||
|
if (!this.state.room) return;
|
||||||
this.setState({
|
this.setState({
|
||||||
|
hasPinnedWidgets: WidgetLayoutStore.instance.getContainerWidgets(this.state.room, Container.Top).length > 0,
|
||||||
showApps: this.shouldShowApps(this.state.room),
|
showApps: this.shouldShowApps(this.state.room),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private onWidgetLayoutChange = () => {
|
||||||
|
this.onWidgetEchoStoreUpdate(); // we cheat here by calling the thing that matters
|
||||||
|
};
|
||||||
|
|
||||||
private setupRoom(room: Room, roomId: string, joining: boolean, shouldPeek: boolean) {
|
private setupRoom(room: Room, roomId: string, joining: boolean, shouldPeek: boolean) {
|
||||||
// if this is an unknown room then we're in one of three states:
|
// if this is an unknown room then we're in one of three states:
|
||||||
// - This is a room we can peek into (search engine) (we can /peek)
|
// - This is a room we can peek into (search engine) (we can /peek)
|
||||||
|
@ -489,7 +491,7 @@ export default class RoomView extends React.Component<IProps, IState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private shouldShowApps(room: Room) {
|
private shouldShowApps(room: Room) {
|
||||||
if (!BROWSER_SUPPORTS_SANDBOX) return false;
|
if (!BROWSER_SUPPORTS_SANDBOX || !room) return false;
|
||||||
|
|
||||||
// Check if user has previously chosen to hide the app drawer for this
|
// Check if user has previously chosen to hide the app drawer for this
|
||||||
// room. If so, do not show apps
|
// room. If so, do not show apps
|
||||||
|
@ -498,10 +500,15 @@ export default class RoomView extends React.Component<IProps, IState> {
|
||||||
|
|
||||||
// This is confusing, but it means to say that we default to the tray being
|
// This is confusing, but it means to say that we default to the tray being
|
||||||
// hidden unless the user clicked to open it.
|
// hidden unless the user clicked to open it.
|
||||||
return hideWidgetDrawer === "false";
|
const isManuallyShown = hideWidgetDrawer === "false";
|
||||||
|
|
||||||
|
const widgets = WidgetLayoutStore.instance.getContainerWidgets(room, Container.Top);
|
||||||
|
return widgets.length > 0 || isManuallyShown;
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
this.onRoomViewStoreUpdate(true);
|
||||||
|
|
||||||
const call = this.getCallForRoom();
|
const call = this.getCallForRoom();
|
||||||
const callState = call ? call.state : null;
|
const callState = call ? call.state : null;
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -609,6 +616,13 @@ export default class RoomView extends React.Component<IProps, IState> {
|
||||||
WidgetEchoStore.removeListener(UPDATE_EVENT, this.onWidgetEchoStoreUpdate);
|
WidgetEchoStore.removeListener(UPDATE_EVENT, this.onWidgetEchoStoreUpdate);
|
||||||
WidgetStore.instance.removeListener(UPDATE_EVENT, this.onWidgetStoreUpdate);
|
WidgetStore.instance.removeListener(UPDATE_EVENT, this.onWidgetStoreUpdate);
|
||||||
|
|
||||||
|
if (this.state.room) {
|
||||||
|
WidgetLayoutStore.instance.off(
|
||||||
|
WidgetLayoutStore.emissionForRoom(this.state.room),
|
||||||
|
this.onWidgetLayoutChange,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (this.showReadReceiptsWatchRef) {
|
if (this.showReadReceiptsWatchRef) {
|
||||||
SettingsStore.unwatchSetting(this.showReadReceiptsWatchRef);
|
SettingsStore.unwatchSetting(this.showReadReceiptsWatchRef);
|
||||||
}
|
}
|
||||||
|
@ -749,6 +763,9 @@ export default class RoomView extends React.Component<IProps, IState> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'focus_search':
|
||||||
|
this.onSearchClick();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -836,6 +853,10 @@ export default class RoomView extends React.Component<IProps, IState> {
|
||||||
// called when state.room is first initialised (either at initial load,
|
// called when state.room is first initialised (either at initial load,
|
||||||
// after a successful peek, or after we join the room).
|
// after a successful peek, or after we join the room).
|
||||||
private onRoomLoaded = (room: Room) => {
|
private onRoomLoaded = (room: Room) => {
|
||||||
|
// Attach a widget store listener only when we get a room
|
||||||
|
WidgetLayoutStore.instance.on(WidgetLayoutStore.emissionForRoom(room), this.onWidgetLayoutChange);
|
||||||
|
this.onWidgetLayoutChange(); // provoke an update
|
||||||
|
|
||||||
this.calculatePeekRules(room);
|
this.calculatePeekRules(room);
|
||||||
this.updatePreviewUrlVisibility(room);
|
this.updatePreviewUrlVisibility(room);
|
||||||
this.loadMembersIfJoined(room);
|
this.loadMembersIfJoined(room);
|
||||||
|
@ -898,6 +919,15 @@ export default class RoomView extends React.Component<IProps, IState> {
|
||||||
if (!room || room.roomId !== this.state.roomId) {
|
if (!room || room.roomId !== this.state.roomId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Detach the listener if the room is changing for some reason
|
||||||
|
if (this.state.room) {
|
||||||
|
WidgetLayoutStore.instance.off(
|
||||||
|
WidgetLayoutStore.emissionForRoom(this.state.room),
|
||||||
|
this.onWidgetLayoutChange,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
room: room,
|
room: room,
|
||||||
}, () => {
|
}, () => {
|
||||||
|
|
|
@ -20,7 +20,6 @@ import * as React from "react";
|
||||||
import {_t} from '../../languageHandler';
|
import {_t} from '../../languageHandler';
|
||||||
import * as sdk from "../../index";
|
import * as sdk from "../../index";
|
||||||
import AutoHideScrollbar from './AutoHideScrollbar';
|
import AutoHideScrollbar from './AutoHideScrollbar';
|
||||||
import { ReactNode } from "react";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a tab for the TabbedView.
|
* Represents a tab for the TabbedView.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright 2020 The Matrix.org Foundation C.I.C.
|
Copyright 2020, 2021 The Matrix.org Foundation C.I.C.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
@ -28,7 +28,6 @@ import Modal from "../../Modal";
|
||||||
import LogoutDialog from "../views/dialogs/LogoutDialog";
|
import LogoutDialog from "../views/dialogs/LogoutDialog";
|
||||||
import SettingsStore from "../../settings/SettingsStore";
|
import SettingsStore from "../../settings/SettingsStore";
|
||||||
import {getCustomTheme} from "../../theme";
|
import {getCustomTheme} from "../../theme";
|
||||||
import {getHostingLink} from "../../utils/HostingLink";
|
|
||||||
import AccessibleButton, {ButtonEvent} from "../views/elements/AccessibleButton";
|
import AccessibleButton, {ButtonEvent} from "../views/elements/AccessibleButton";
|
||||||
import SdkConfig from "../../SdkConfig";
|
import SdkConfig from "../../SdkConfig";
|
||||||
import {getHomePageUrl} from "../../utils/pages";
|
import {getHomePageUrl} from "../../utils/pages";
|
||||||
|
@ -51,6 +50,8 @@ import { RightPanelPhases } from "../../stores/RightPanelStorePhases";
|
||||||
import ErrorDialog from "../views/dialogs/ErrorDialog";
|
import ErrorDialog from "../views/dialogs/ErrorDialog";
|
||||||
import EditCommunityPrototypeDialog from "../views/dialogs/EditCommunityPrototypeDialog";
|
import EditCommunityPrototypeDialog from "../views/dialogs/EditCommunityPrototypeDialog";
|
||||||
import {UIFeature} from "../../settings/UIFeature";
|
import {UIFeature} from "../../settings/UIFeature";
|
||||||
|
import HostSignupAction from "./HostSignupAction";
|
||||||
|
import {IHostSignupConfig} from "../views/dialogs/HostSignupDialogTypes";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
isMinimized: boolean;
|
isMinimized: boolean;
|
||||||
|
@ -272,7 +273,7 @@ export default class UserMenu extends React.Component<IProps, IState> {
|
||||||
const prototypeCommunityName = CommunityPrototypeStore.instance.getSelectedCommunityName();
|
const prototypeCommunityName = CommunityPrototypeStore.instance.getSelectedCommunityName();
|
||||||
|
|
||||||
let topSection;
|
let topSection;
|
||||||
const signupLink = getHostingLink("user-context-menu");
|
const hostSignupConfig: IHostSignupConfig = SdkConfig.get().hostSignup;
|
||||||
if (MatrixClientPeg.get().isGuest()) {
|
if (MatrixClientPeg.get().isGuest()) {
|
||||||
topSection = (
|
topSection = (
|
||||||
<div className="mx_UserMenu_contextMenu_header mx_UserMenu_contextMenu_guestPrompts">
|
<div className="mx_UserMenu_contextMenu_header mx_UserMenu_contextMenu_guestPrompts">
|
||||||
|
@ -292,24 +293,19 @@ export default class UserMenu extends React.Component<IProps, IState> {
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
} else if (signupLink) {
|
} else if (hostSignupConfig) {
|
||||||
topSection = (
|
if (hostSignupConfig && hostSignupConfig.url) {
|
||||||
<div className="mx_UserMenu_contextMenu_header mx_UserMenu_contextMenu_hostingLink">
|
// If hostSignup.domains is set to a non-empty array, only show
|
||||||
{_t(
|
// dialog if the user is on the domain or a subdomain.
|
||||||
"<a>Upgrade</a> to your own domain", {},
|
const hostSignupDomains = hostSignupConfig.domains || [];
|
||||||
{
|
const mxDomain = MatrixClientPeg.get().getDomain();
|
||||||
a: sub => (
|
const validDomains = hostSignupDomains.filter(d => (d === mxDomain || mxDomain.endsWith(`.${d}`)));
|
||||||
<a
|
if (!hostSignupDomains || validDomains.length > 0) {
|
||||||
href={signupLink}
|
topSection = <div onClick={this.onCloseMenu}>
|
||||||
target="_blank"
|
<HostSignupAction />
|
||||||
rel="noreferrer noopener"
|
</div>;
|
||||||
tabIndex={-1}
|
}
|
||||||
>{sub}</a>
|
}
|
||||||
),
|
|
||||||
},
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let homeButton = null;
|
let homeButton = null;
|
||||||
|
|
|
@ -24,6 +24,7 @@ export default class E2eSetup extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
onFinished: PropTypes.func.isRequired,
|
onFinished: PropTypes.func.isRequired,
|
||||||
accountPassword: PropTypes.string,
|
accountPassword: PropTypes.string,
|
||||||
|
tokenLogin: PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -33,6 +34,7 @@ export default class E2eSetup extends React.Component {
|
||||||
<CreateCrossSigningDialog
|
<CreateCrossSigningDialog
|
||||||
onFinished={this.props.onFinished}
|
onFinished={this.props.onFinished}
|
||||||
accountPassword={this.props.accountPassword}
|
accountPassword={this.props.accountPassword}
|
||||||
|
tokenLogin={this.props.tokenLogin}
|
||||||
/>
|
/>
|
||||||
</CompleteSecurityBody>
|
</CompleteSecurityBody>
|
||||||
</AuthPage>
|
</AuthPage>
|
||||||
|
|
|
@ -340,8 +340,8 @@ export default class LoginComponent extends React.PureComponent<IProps, IState>
|
||||||
};
|
};
|
||||||
|
|
||||||
onTryRegisterClick = ev => {
|
onTryRegisterClick = ev => {
|
||||||
const hasPasswordFlow = this.state.flows.find(flow => flow.type === "m.login.password");
|
const hasPasswordFlow = this.state.flows?.find(flow => flow.type === "m.login.password");
|
||||||
const ssoFlow = this.state.flows.find(flow => flow.type === "m.login.sso" || flow.type === "m.login.cas");
|
const ssoFlow = this.state.flows?.find(flow => flow.type === "m.login.sso" || flow.type === "m.login.cas");
|
||||||
// If has no password flow but an SSO flow guess that the user wants to register with SSO.
|
// If has no password flow but an SSO flow guess that the user wants to register with SSO.
|
||||||
// TODO: instead hide the Register button if registration is disabled by checking with the server,
|
// TODO: instead hide the Register button if registration is disabled by checking with the server,
|
||||||
// has no specific errCode currently and uses M_FORBIDDEN.
|
// has no specific errCode currently and uses M_FORBIDDEN.
|
||||||
|
|
|
@ -120,9 +120,9 @@ export default class SetupEncryptionBody extends React.Component {
|
||||||
const store = SetupEncryptionStore.sharedInstance();
|
const store = SetupEncryptionStore.sharedInstance();
|
||||||
let recoveryKeyPrompt;
|
let recoveryKeyPrompt;
|
||||||
if (store.keyInfo && keyHasPassphrase(store.keyInfo)) {
|
if (store.keyInfo && keyHasPassphrase(store.keyInfo)) {
|
||||||
recoveryKeyPrompt = _t("Use Recovery Key or Passphrase");
|
recoveryKeyPrompt = _t("Use Security Key or Phrase");
|
||||||
} else if (store.keyInfo) {
|
} else if (store.keyInfo) {
|
||||||
recoveryKeyPrompt = _t("Use Recovery Key");
|
recoveryKeyPrompt = _t("Use Security Key");
|
||||||
}
|
}
|
||||||
|
|
||||||
let useRecoveryKeyButton;
|
let useRecoveryKeyButton;
|
||||||
|
|
|
@ -609,8 +609,12 @@ export class SSOAuthEntry extends React.Component {
|
||||||
this.props.authSessionId,
|
this.props.authSessionId,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this._popupWindow = null;
|
||||||
|
window.addEventListener("message", this._onReceiveMessage);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
phase: SSOAuthEntry.PHASE_PREAUTH,
|
phase: SSOAuthEntry.PHASE_PREAUTH,
|
||||||
|
attemptFailed: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -618,12 +622,35 @@ export class SSOAuthEntry extends React.Component {
|
||||||
this.props.onPhaseChange(SSOAuthEntry.PHASE_PREAUTH);
|
this.props.onPhaseChange(SSOAuthEntry.PHASE_PREAUTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
window.removeEventListener("message", this._onReceiveMessage);
|
||||||
|
if (this._popupWindow) {
|
||||||
|
this._popupWindow.close();
|
||||||
|
this._popupWindow = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
attemptFailed = () => {
|
||||||
|
this.setState({
|
||||||
|
attemptFailed: true,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
_onReceiveMessage = event => {
|
||||||
|
if (event.data === "authDone" && event.origin === this.props.matrixClient.getHomeserverUrl()) {
|
||||||
|
if (this._popupWindow) {
|
||||||
|
this._popupWindow.close();
|
||||||
|
this._popupWindow = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
onStartAuthClick = () => {
|
onStartAuthClick = () => {
|
||||||
// Note: We don't use PlatformPeg's startSsoAuth functions because we almost
|
// Note: We don't use PlatformPeg's startSsoAuth functions because we almost
|
||||||
// certainly will need to open the thing in a new tab to avoid losing application
|
// certainly will need to open the thing in a new tab to avoid losing application
|
||||||
// context.
|
// context.
|
||||||
|
|
||||||
window.open(this._ssoUrl, '_blank');
|
this._popupWindow = window.open(this._ssoUrl, "_blank");
|
||||||
this.setState({phase: SSOAuthEntry.PHASE_POSTAUTH});
|
this.setState({phase: SSOAuthEntry.PHASE_POSTAUTH});
|
||||||
this.props.onPhaseChange(SSOAuthEntry.PHASE_POSTAUTH);
|
this.props.onPhaseChange(SSOAuthEntry.PHASE_POSTAUTH);
|
||||||
};
|
};
|
||||||
|
@ -656,10 +683,28 @@ export class SSOAuthEntry extends React.Component {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return <div className='mx_InteractiveAuthEntryComponents_sso_buttons'>
|
let errorSection;
|
||||||
|
if (this.props.errorText) {
|
||||||
|
errorSection = (
|
||||||
|
<div className="error" role="alert">
|
||||||
|
{ this.props.errorText }
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
} else if (this.state.attemptFailed) {
|
||||||
|
errorSection = (
|
||||||
|
<div className="error" role="alert">
|
||||||
|
{ _t("Something went wrong in confirming your identity. Cancel and try again.") }
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return <React.Fragment>
|
||||||
|
{ errorSection }
|
||||||
|
<div className="mx_InteractiveAuthEntryComponents_sso_buttons">
|
||||||
{cancelButton}
|
{cancelButton}
|
||||||
{continueButton}
|
{continueButton}
|
||||||
</div>;
|
</div>
|
||||||
|
</React.Fragment>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -710,8 +755,7 @@ export class FallbackAuthEntry extends React.Component {
|
||||||
this.props.loginType,
|
this.props.loginType,
|
||||||
this.props.authSessionId,
|
this.props.authSessionId,
|
||||||
);
|
);
|
||||||
this._popupWindow = window.open(url);
|
this._popupWindow = window.open(url, "_blank");
|
||||||
this._popupWindow.opener = null;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
_onReceiveMessage = event => {
|
_onReceiveMessage = event => {
|
||||||
|
|
|
@ -196,7 +196,7 @@ export default class PasswordLogin extends React.PureComponent<IProps, IState> {
|
||||||
|
|
||||||
// Validation and state updates are async, so we need to wait for them to complete
|
// Validation and state updates are async, so we need to wait for them to complete
|
||||||
// first. Queue a `setState` callback and wait for it to resolve.
|
// first. Queue a `setState` callback and wait for it to resolve.
|
||||||
await new Promise(resolve => this.setState({}, resolve));
|
await new Promise<void>(resolve => this.setState({}, resolve));
|
||||||
|
|
||||||
if (this.allFieldsValid()) {
|
if (this.allFieldsValid()) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -194,7 +194,7 @@ export default class RegistrationForm extends React.PureComponent<IProps, IState
|
||||||
|
|
||||||
// Validation and state updates are async, so we need to wait for them to complete
|
// Validation and state updates are async, so we need to wait for them to complete
|
||||||
// first. Queue a `setState` callback and wait for it to resolve.
|
// first. Queue a `setState` callback and wait for it to resolve.
|
||||||
await new Promise(resolve => this.setState({}, resolve));
|
await new Promise<void>(resolve => this.setState({}, resolve));
|
||||||
|
|
||||||
if (this.allFieldsValid()) {
|
if (this.allFieldsValid()) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -20,7 +20,7 @@ import {MatrixCapabilities} from "matrix-widget-api";
|
||||||
import IconizedContextMenu, {IconizedContextMenuOption, IconizedContextMenuOptionList} from "./IconizedContextMenu";
|
import IconizedContextMenu, {IconizedContextMenuOption, IconizedContextMenuOptionList} from "./IconizedContextMenu";
|
||||||
import {ChevronFace} from "../../structures/ContextMenu";
|
import {ChevronFace} from "../../structures/ContextMenu";
|
||||||
import {_t} from "../../../languageHandler";
|
import {_t} from "../../../languageHandler";
|
||||||
import WidgetStore, {IApp} from "../../../stores/WidgetStore";
|
import {IApp} from "../../../stores/WidgetStore";
|
||||||
import WidgetUtils from "../../../utils/WidgetUtils";
|
import WidgetUtils from "../../../utils/WidgetUtils";
|
||||||
import {WidgetMessagingStore} from "../../../stores/widgets/WidgetMessagingStore";
|
import {WidgetMessagingStore} from "../../../stores/widgets/WidgetMessagingStore";
|
||||||
import RoomContext from "../../../contexts/RoomContext";
|
import RoomContext from "../../../contexts/RoomContext";
|
||||||
|
@ -30,6 +30,7 @@ import Modal from "../../../Modal";
|
||||||
import QuestionDialog from "../dialogs/QuestionDialog";
|
import QuestionDialog from "../dialogs/QuestionDialog";
|
||||||
import {WidgetType} from "../../../widgets/WidgetType";
|
import {WidgetType} from "../../../widgets/WidgetType";
|
||||||
import MatrixClientContext from "../../../contexts/MatrixClientContext";
|
import MatrixClientContext from "../../../contexts/MatrixClientContext";
|
||||||
|
import { Container, WidgetLayoutStore } from "../../../stores/widgets/WidgetLayoutStore";
|
||||||
|
|
||||||
interface IProps extends React.ComponentProps<typeof IconizedContextMenu> {
|
interface IProps extends React.ComponentProps<typeof IconizedContextMenu> {
|
||||||
app: IApp;
|
app: IApp;
|
||||||
|
@ -56,7 +57,7 @@ const WidgetContextMenu: React.FC<IProps> = ({
|
||||||
let unpinButton;
|
let unpinButton;
|
||||||
if (showUnpin) {
|
if (showUnpin) {
|
||||||
const onUnpinClick = () => {
|
const onUnpinClick = () => {
|
||||||
WidgetStore.instance.unpinWidget(room.roomId, app.id);
|
WidgetLayoutStore.instance.moveToContainer(room, app, Container.Right);
|
||||||
onFinished();
|
onFinished();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -137,13 +138,13 @@ const WidgetContextMenu: React.FC<IProps> = ({
|
||||||
revokeButton = <IconizedContextMenuOption onClick={onRevokeClick} label={_t("Revoke permissions")} />;
|
revokeButton = <IconizedContextMenuOption onClick={onRevokeClick} label={_t("Revoke permissions")} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
const pinnedWidgets = WidgetStore.instance.getPinnedApps(roomId);
|
const pinnedWidgets = WidgetLayoutStore.instance.getContainerWidgets(room, Container.Top);
|
||||||
const widgetIndex = pinnedWidgets.findIndex(widget => widget.id === app.id);
|
const widgetIndex = pinnedWidgets.findIndex(widget => widget.id === app.id);
|
||||||
|
|
||||||
let moveLeftButton;
|
let moveLeftButton;
|
||||||
if (showUnpin && widgetIndex > 0) {
|
if (showUnpin && widgetIndex > 0) {
|
||||||
const onClick = () => {
|
const onClick = () => {
|
||||||
WidgetStore.instance.movePinnedWidget(roomId, app.id, -1);
|
WidgetLayoutStore.instance.moveWithinContainer(room, Container.Top, app, -1);
|
||||||
onFinished();
|
onFinished();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -153,7 +154,7 @@ const WidgetContextMenu: React.FC<IProps> = ({
|
||||||
let moveRightButton;
|
let moveRightButton;
|
||||||
if (showUnpin && widgetIndex < pinnedWidgets.length - 1) {
|
if (showUnpin && widgetIndex < pinnedWidgets.length - 1) {
|
||||||
const onClick = () => {
|
const onClick = () => {
|
||||||
WidgetStore.instance.movePinnedWidget(roomId, app.id, 1);
|
WidgetLayoutStore.instance.moveWithinContainer(room, Container.Top, app, 1);
|
||||||
onFinished();
|
onFinished();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,10 @@ export default class ErrorDialog extends React.Component {
|
||||||
button: null,
|
button: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
onClick = () => {
|
||||||
|
this.props.onFinished(true);
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');
|
const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');
|
||||||
return (
|
return (
|
||||||
|
@ -64,7 +68,7 @@ export default class ErrorDialog extends React.Component {
|
||||||
{ this.props.description || _t('An error has occurred.') }
|
{ this.props.description || _t('An error has occurred.') }
|
||||||
</div>
|
</div>
|
||||||
<div className="mx_Dialog_buttons">
|
<div className="mx_Dialog_buttons">
|
||||||
<button className="mx_Dialog_primary" onClick={this.props.onFinished} autoFocus={this.props.focus}>
|
<button className="mx_Dialog_primary" onClick={this.onClick} autoFocus={this.props.focus}>
|
||||||
{ this.props.button || _t('OK') }
|
{ this.props.button || _t('OK') }
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
291
src/components/views/dialogs/HostSignupDialog.tsx
Normal file
|
@ -0,0 +1,291 @@
|
||||||
|
/*
|
||||||
|
Copyright 2021 The Matrix.org Foundation C.I.C.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import React from "react";
|
||||||
|
import AccessibleButton from "../elements/AccessibleButton";
|
||||||
|
import Modal from "../../../Modal";
|
||||||
|
import PersistedElement from "../elements/PersistedElement";
|
||||||
|
import QuestionDialog from './QuestionDialog';
|
||||||
|
import SdkConfig from "../../../SdkConfig";
|
||||||
|
import classNames from "classnames";
|
||||||
|
import { _t } from "../../../languageHandler";
|
||||||
|
import { MatrixClientPeg } from "../../../MatrixClientPeg";
|
||||||
|
import { HostSignupStore } from "../../../stores/HostSignupStore";
|
||||||
|
import { OwnProfileStore } from "../../../stores/OwnProfileStore";
|
||||||
|
import {
|
||||||
|
IHostSignupConfig,
|
||||||
|
IPostmessage,
|
||||||
|
IPostmessageResponseData,
|
||||||
|
PostmessageAction,
|
||||||
|
} from "./HostSignupDialogTypes";
|
||||||
|
|
||||||
|
const HOST_SIGNUP_KEY = "host_signup";
|
||||||
|
|
||||||
|
interface IProps {}
|
||||||
|
|
||||||
|
interface IState {
|
||||||
|
completed: boolean;
|
||||||
|
error: string;
|
||||||
|
minimized: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default class HostSignupDialog extends React.PureComponent<IProps, IState> {
|
||||||
|
private iframeRef: React.RefObject<HTMLIFrameElement> = React.createRef();
|
||||||
|
private readonly config: IHostSignupConfig;
|
||||||
|
|
||||||
|
constructor(props: IProps) {
|
||||||
|
super(props);
|
||||||
|
|
||||||
|
this.state = {
|
||||||
|
completed: false,
|
||||||
|
error: null,
|
||||||
|
minimized: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
this.config = SdkConfig.get().hostSignup;
|
||||||
|
}
|
||||||
|
|
||||||
|
private messageHandler = async (message: IPostmessage) => {
|
||||||
|
if (!this.config.url.startsWith(message.origin)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (message.data.action) {
|
||||||
|
case PostmessageAction.HostSignupAccountDetailsRequest:
|
||||||
|
this.onAccountDetailsRequest();
|
||||||
|
break;
|
||||||
|
case PostmessageAction.Maximize:
|
||||||
|
this.setState({
|
||||||
|
minimized: false,
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case PostmessageAction.Minimize:
|
||||||
|
this.setState({
|
||||||
|
minimized: true,
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case PostmessageAction.SetupComplete:
|
||||||
|
this.setState({
|
||||||
|
completed: true,
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case PostmessageAction.CloseDialog:
|
||||||
|
return this.closeDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private maximizeDialog = () => {
|
||||||
|
this.setState({
|
||||||
|
minimized: false,
|
||||||
|
});
|
||||||
|
// Send this action to the iframe so it can act accordingly
|
||||||
|
this.sendMessage({
|
||||||
|
action: PostmessageAction.Maximize,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private minimizeDialog = () => {
|
||||||
|
this.setState({
|
||||||
|
minimized: true,
|
||||||
|
});
|
||||||
|
// Send this action to the iframe so it can act accordingly
|
||||||
|
this.sendMessage({
|
||||||
|
action: PostmessageAction.Minimize,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private closeDialog = async () => {
|
||||||
|
window.removeEventListener("message", this.messageHandler);
|
||||||
|
// Ensure we destroy the host signup persisted element
|
||||||
|
PersistedElement.destroyElement("host_signup");
|
||||||
|
// Finally clear the flag in
|
||||||
|
return HostSignupStore.instance.setHostSignupActive(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private onCloseClick = async () => {
|
||||||
|
if (this.state.completed) {
|
||||||
|
// We're done, close
|
||||||
|
return this.closeDialog();
|
||||||
|
} else {
|
||||||
|
Modal.createDialog(
|
||||||
|
QuestionDialog,
|
||||||
|
{
|
||||||
|
title: _t("Confirm abort of host creation"),
|
||||||
|
description: _t(
|
||||||
|
"Are you sure you wish to abort creation of the host? The process cannot be continued.",
|
||||||
|
),
|
||||||
|
button: _t("Abort"),
|
||||||
|
onFinished: result => {
|
||||||
|
if (result) {
|
||||||
|
return this.closeDialog();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private sendMessage = (message: IPostmessageResponseData) => {
|
||||||
|
this.iframeRef.current.contentWindow.postMessage(message, this.config.url);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async sendAccountDetails() {
|
||||||
|
const openIdToken = await MatrixClientPeg.get().getOpenIdToken();
|
||||||
|
if (!openIdToken || !openIdToken.access_token) {
|
||||||
|
console.warn("Failed to connect to homeserver for OpenID token.")
|
||||||
|
this.setState({
|
||||||
|
completed: true,
|
||||||
|
error: _t("Failed to connect to your homeserver. Please close this dialog and try again."),
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.sendMessage({
|
||||||
|
action: PostmessageAction.HostSignupAccountDetails,
|
||||||
|
account: {
|
||||||
|
accessToken: await MatrixClientPeg.get().getAccessToken(),
|
||||||
|
name: OwnProfileStore.instance.displayName,
|
||||||
|
openIdToken: openIdToken.access_token,
|
||||||
|
serverName: await MatrixClientPeg.get().getDomain(),
|
||||||
|
userLocalpart: await MatrixClientPeg.get().getUserIdLocalpart(),
|
||||||
|
termsAccepted: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private onAccountDetailsDialogFinished = async (result) => {
|
||||||
|
if (result) {
|
||||||
|
return this.sendAccountDetails();
|
||||||
|
}
|
||||||
|
return this.closeDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
private onAccountDetailsRequest = () => {
|
||||||
|
const textComponent = (
|
||||||
|
<>
|
||||||
|
<p>
|
||||||
|
{_t("Continuing temporarily allows the %(hostSignupBrand)s setup process to access your " +
|
||||||
|
"account to fetch verified email addresses. This data is not stored.", {
|
||||||
|
hostSignupBrand: this.config.brand,
|
||||||
|
})}
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
{_t("Learn more in our <privacyPolicyLink />, <termsOfServiceLink /> and <cookiePolicyLink />.",
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
cookiePolicyLink: () => (
|
||||||
|
<a href={this.config.cookiePolicyUrl} target="_blank" rel="noreferrer noopener">
|
||||||
|
{_t("Cookie Policy")}
|
||||||
|
</a>
|
||||||
|
),
|
||||||
|
privacyPolicyLink: () => (
|
||||||
|
<a href={this.config.privacyPolicyUrl} target="_blank" rel="noreferrer noopener">
|
||||||
|
{_t("Privacy Policy")}
|
||||||
|
</a>
|
||||||
|
),
|
||||||
|
termsOfServiceLink: () => (
|
||||||
|
<a href={this.config.termsOfServiceUrl} target="_blank" rel="noreferrer noopener">
|
||||||
|
{_t("Terms of Service")}
|
||||||
|
</a>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
)}
|
||||||
|
</p>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
Modal.createDialog(
|
||||||
|
QuestionDialog,
|
||||||
|
{
|
||||||
|
title: _t("You should know"),
|
||||||
|
description: textComponent,
|
||||||
|
button: _t("Continue"),
|
||||||
|
onFinished: this.onAccountDetailsDialogFinished,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public componentDidMount() {
|
||||||
|
window.addEventListener("message", this.messageHandler);
|
||||||
|
}
|
||||||
|
|
||||||
|
public componentWillUnmount() {
|
||||||
|
if (HostSignupStore.instance.isHostSignupActive) {
|
||||||
|
// Run the close dialog actions if we're still active, otherwise good to go
|
||||||
|
return this.closeDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public render(): React.ReactNode {
|
||||||
|
return (
|
||||||
|
<div className="mx_HostSignup_persisted">
|
||||||
|
<PersistedElement key={HOST_SIGNUP_KEY} persistKey={HOST_SIGNUP_KEY}>
|
||||||
|
<div className={classNames({ "mx_Dialog_wrapper": !this.state.minimized })}>
|
||||||
|
<div
|
||||||
|
className={classNames("mx_Dialog",
|
||||||
|
{
|
||||||
|
"mx_HostSignupDialog_minimized": this.state.minimized,
|
||||||
|
"mx_HostSignupDialog": !this.state.minimized,
|
||||||
|
},
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{this.state.minimized &&
|
||||||
|
<div className="mx_Dialog_header mx_Dialog_headerWithButton">
|
||||||
|
<div className="mx_Dialog_title">
|
||||||
|
{_t("%(hostSignupBrand)s Setup", {
|
||||||
|
hostSignupBrand: this.config.brand,
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
<AccessibleButton
|
||||||
|
className="mx_HostSignup_maximize_button"
|
||||||
|
onClick={this.maximizeDialog}
|
||||||
|
aria-label={_t("Maximize dialog")}
|
||||||
|
title={_t("Maximize dialog")}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
{!this.state.minimized &&
|
||||||
|
<div className="mx_Dialog_header mx_Dialog_headerWithCancel">
|
||||||
|
<AccessibleButton
|
||||||
|
onClick={this.minimizeDialog}
|
||||||
|
className="mx_HostSignup_minimize_button"
|
||||||
|
aria-label={_t("Minimize dialog")}
|
||||||
|
title={_t("Minimize dialog")}
|
||||||
|
/>
|
||||||
|
<AccessibleButton
|
||||||
|
onClick={this.onCloseClick}
|
||||||
|
className="mx_Dialog_cancelButton"
|
||||||
|
aria-label={_t("Close dialog")}
|
||||||
|
title={_t("Close dialog")}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
{this.state.error &&
|
||||||
|
<div>
|
||||||
|
{this.state.error}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
{!this.state.error &&
|
||||||
|
<iframe
|
||||||
|
src={this.config.url}
|
||||||
|
ref={this.iframeRef}
|
||||||
|
sandbox="allow-forms allow-scripts allow-same-origin allow-popups"
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</PersistedElement>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
56
src/components/views/dialogs/HostSignupDialogTypes.ts
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
/*
|
||||||
|
Copyright 2021 The Matrix.org Foundation C.I.C.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export enum PostmessageAction {
|
||||||
|
CloseDialog = "close_dialog",
|
||||||
|
HostSignupAccountDetails = "host_signup_account_details",
|
||||||
|
HostSignupAccountDetailsRequest = "host_signup_account_details_request",
|
||||||
|
Minimize = "host_signup_minimize",
|
||||||
|
Maximize = "host_signup_maximize",
|
||||||
|
SetupComplete = "setup_complete",
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IAccountData {
|
||||||
|
accessToken: string;
|
||||||
|
name: string;
|
||||||
|
openIdToken: string;
|
||||||
|
serverName: string;
|
||||||
|
userLocalpart: string;
|
||||||
|
termsAccepted: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IPostmessageRequestData {
|
||||||
|
action: PostmessageAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IPostmessageResponseData {
|
||||||
|
action: PostmessageAction;
|
||||||
|
account?: IAccountData;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IPostmessage {
|
||||||
|
data: IPostmessageRequestData;
|
||||||
|
origin: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IHostSignupConfig {
|
||||||
|
brand: string;
|
||||||
|
cookiePolicyUrl: string;
|
||||||
|
domains: Array<string>;
|
||||||
|
privacyPolicyUrl: string;
|
||||||
|
termsOfServiceUrl: string;
|
||||||
|
url: string;
|
||||||
|
}
|
|
@ -35,13 +35,13 @@ import {
|
||||||
} from "matrix-widget-api";
|
} from "matrix-widget-api";
|
||||||
import {StopGapWidgetDriver} from "../../../stores/widgets/StopGapWidgetDriver";
|
import {StopGapWidgetDriver} from "../../../stores/widgets/StopGapWidgetDriver";
|
||||||
import {MatrixClientPeg} from "../../../MatrixClientPeg";
|
import {MatrixClientPeg} from "../../../MatrixClientPeg";
|
||||||
import RoomViewStore from "../../../stores/RoomViewStore";
|
|
||||||
import {OwnProfileStore} from "../../../stores/OwnProfileStore";
|
import {OwnProfileStore} from "../../../stores/OwnProfileStore";
|
||||||
import { arrayFastClone } from "../../../utils/arrays";
|
import { arrayFastClone } from "../../../utils/arrays";
|
||||||
import { ElementWidget } from "../../../stores/widgets/StopGapWidget";
|
import { ElementWidget } from "../../../stores/widgets/StopGapWidget";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
widgetDefinition: IModalWidgetOpenRequestData;
|
widgetDefinition: IModalWidgetOpenRequestData;
|
||||||
|
widgetRoomId?: string;
|
||||||
sourceWidgetId: string;
|
sourceWidgetId: string;
|
||||||
onFinished(success: boolean, data?: IModalWidgetReturnData): void;
|
onFinished(success: boolean, data?: IModalWidgetReturnData): void;
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ export default class ModalWidgetDialog extends React.PureComponent<IProps, IStat
|
||||||
|
|
||||||
public render() {
|
public render() {
|
||||||
const templated = this.widget.getCompleteUrl({
|
const templated = this.widget.getCompleteUrl({
|
||||||
currentRoomId: RoomViewStore.getRoomId(),
|
widgetRoomId: this.props.widgetRoomId,
|
||||||
currentUserId: MatrixClientPeg.get().getUserId(),
|
currentUserId: MatrixClientPeg.get().getUserId(),
|
||||||
userDisplayName: OwnProfileStore.instance.displayName,
|
userDisplayName: OwnProfileStore.instance.displayName,
|
||||||
userHttpAvatarUrl: OwnProfileStore.instance.getHttpAvatarUrl(),
|
userHttpAvatarUrl: OwnProfileStore.instance.getHttpAvatarUrl(),
|
||||||
|
|
|
@ -47,7 +47,7 @@ export default class NewSessionReviewDialog extends React.PureComponent {
|
||||||
<li>{_t("The internet connection either session is using")}</li>
|
<li>{_t("The internet connection either session is using")}</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div>
|
<div>
|
||||||
{_t("We recommend you change your password and recovery key in Settings immediately")}
|
{_t("We recommend you change your password and Security Key in Settings immediately")}
|
||||||
</div>
|
</div>
|
||||||
</div>,
|
</div>,
|
||||||
onFinished: () => this.props.onFinished(false),
|
onFinished: () => this.props.onFinished(false),
|
||||||
|
|
|
@ -44,7 +44,8 @@ const RegistrationEmailPromptDialog: React.FC<IProps> = ({onFinished}) => {
|
||||||
const [email, setEmail] = useState("");
|
const [email, setEmail] = useState("");
|
||||||
const fieldRef = useRef<Field>();
|
const fieldRef = useRef<Field>();
|
||||||
|
|
||||||
const onSubmit = async () => {
|
const onSubmit = async (e) => {
|
||||||
|
e.preventDefault();
|
||||||
if (email) {
|
if (email) {
|
||||||
const valid = await fieldRef.current.validate({ allowEmpty: false });
|
const valid = await fieldRef.current.validate({ allowEmpty: false });
|
||||||
|
|
||||||
|
@ -73,6 +74,7 @@ const RegistrationEmailPromptDialog: React.FC<IProps> = ({onFinished}) => {
|
||||||
<form onSubmit={onSubmit}>
|
<form onSubmit={onSubmit}>
|
||||||
<Field
|
<Field
|
||||||
ref={fieldRef}
|
ref={fieldRef}
|
||||||
|
autoFocus={true}
|
||||||
type="text"
|
type="text"
|
||||||
label={_t("Email (optional)")}
|
label={_t("Email (optional)")}
|
||||||
value={email}
|
value={email}
|
||||||
|
|
|
@ -157,7 +157,7 @@ export default class ServerPickerDialog extends React.PureComponent<IProps, ISta
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.props.onFinished(this.validatedConf);
|
this.props.onFinished(this.state.defaultChosen ? this.defaultServer : this.validatedConf);
|
||||||
};
|
};
|
||||||
|
|
||||||
public render() {
|
public render() {
|
||||||
|
|
|
@ -18,6 +18,7 @@ import React, {createRef} from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import * as sdk from '../../../index';
|
import * as sdk from '../../../index';
|
||||||
import Field from "../elements/Field";
|
import Field from "../elements/Field";
|
||||||
|
import { _t, _td } from '../../../languageHandler';
|
||||||
|
|
||||||
export default class TextInputDialog extends React.Component {
|
export default class TextInputDialog extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
|
@ -29,6 +30,7 @@ export default class TextInputDialog extends React.Component {
|
||||||
value: PropTypes.string,
|
value: PropTypes.string,
|
||||||
placeholder: PropTypes.string,
|
placeholder: PropTypes.string,
|
||||||
button: PropTypes.string,
|
button: PropTypes.string,
|
||||||
|
busyMessage: PropTypes.string, // pass _td string
|
||||||
focus: PropTypes.bool,
|
focus: PropTypes.bool,
|
||||||
onFinished: PropTypes.func.isRequired,
|
onFinished: PropTypes.func.isRequired,
|
||||||
hasCancel: PropTypes.bool,
|
hasCancel: PropTypes.bool,
|
||||||
|
@ -40,6 +42,7 @@ export default class TextInputDialog extends React.Component {
|
||||||
title: "",
|
title: "",
|
||||||
value: "",
|
value: "",
|
||||||
description: "",
|
description: "",
|
||||||
|
busyMessage: _td("Loading..."),
|
||||||
focus: true,
|
focus: true,
|
||||||
hasCancel: true,
|
hasCancel: true,
|
||||||
};
|
};
|
||||||
|
@ -51,6 +54,7 @@ export default class TextInputDialog extends React.Component {
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
value: this.props.value,
|
value: this.props.value,
|
||||||
|
busy: false,
|
||||||
valid: false,
|
valid: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -66,11 +70,13 @@ export default class TextInputDialog extends React.Component {
|
||||||
onOk = async ev => {
|
onOk = async ev => {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
if (this.props.validator) {
|
if (this.props.validator) {
|
||||||
|
this.setState({ busy: true });
|
||||||
await this._field.current.validate({ allowEmpty: false });
|
await this._field.current.validate({ allowEmpty: false });
|
||||||
|
|
||||||
if (!this._field.current.state.valid) {
|
if (!this._field.current.state.valid) {
|
||||||
this._field.current.focus();
|
this._field.current.focus();
|
||||||
this._field.current.validate({ allowEmpty: false, focused: true });
|
this._field.current.validate({ allowEmpty: false, focused: true });
|
||||||
|
this.setState({ busy: false });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,7 +131,8 @@ export default class TextInputDialog extends React.Component {
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<DialogButtons
|
<DialogButtons
|
||||||
primaryButton={this.props.button}
|
primaryButton={this.state.busy ? _t(this.props.busyMessage) : this.props.button}
|
||||||
|
disabled={this.state.busy}
|
||||||
onPrimaryButtonClick={this.onOk}
|
onPrimaryButtonClick={this.onOk}
|
||||||
onCancel={this.onCancel}
|
onCancel={this.onCancel}
|
||||||
hasCancel={this.props.hasCancel}
|
hasCancel={this.props.hasCancel}
|
||||||
|
|
|
@ -70,26 +70,26 @@ export default class WidgetOpenIDPermissionsDialog extends React.Component {
|
||||||
return (
|
return (
|
||||||
<BaseDialog className='mx_WidgetOpenIDPermissionsDialog' hasCancel={true}
|
<BaseDialog className='mx_WidgetOpenIDPermissionsDialog' hasCancel={true}
|
||||||
onFinished={this.props.onFinished}
|
onFinished={this.props.onFinished}
|
||||||
title={_t("A widget would like to verify your identity")}>
|
title={_t("Allow this widget to verify your identity")}>
|
||||||
<div className='mx_WidgetOpenIDPermissionsDialog_content'>
|
<div className='mx_WidgetOpenIDPermissionsDialog_content'>
|
||||||
<p>
|
<p>
|
||||||
{_t(
|
{_t("The widget will verify your user ID, but won't be able to perform actions for you:")}
|
||||||
"A widget located at %(widgetUrl)s would like to verify your identity. " +
|
</p>
|
||||||
"By allowing this, the widget will be able to verify your user ID, but not " +
|
<p className="text-muted">
|
||||||
"perform actions as you.", {
|
{/* cheap trim to just get the path */}
|
||||||
widgetUrl: this.props.widget.templateUrl.split("?")[0],
|
{this.props.widget.templateUrl.split("?")[0].split("#")[0]}
|
||||||
},
|
|
||||||
)}
|
|
||||||
</p>
|
</p>
|
||||||
<LabelledToggleSwitch value={this.state.rememberSelection} toggleInFront={true}
|
|
||||||
onChange={this._onRememberSelectionChange}
|
|
||||||
label={_t("Remember my selection for this widget")} />
|
|
||||||
</div>
|
</div>
|
||||||
<DialogButtons
|
<DialogButtons
|
||||||
primaryButton={_t("Allow")}
|
primaryButton={_t("Continue")}
|
||||||
onPrimaryButtonClick={this._onAllow}
|
onPrimaryButtonClick={this._onAllow}
|
||||||
cancelButton={_t("Deny")}
|
|
||||||
onCancel={this._onDeny}
|
onCancel={this._onDeny}
|
||||||
|
additive={
|
||||||
|
<LabelledToggleSwitch
|
||||||
|
value={this.state.rememberSelection}
|
||||||
|
toggleInFront={true}
|
||||||
|
onChange={this._onRememberSelectionChange}
|
||||||
|
label={_t("Remember this")} />}
|
||||||
/>
|
/>
|
||||||
</BaseDialog>
|
</BaseDialog>
|
||||||
);
|
);
|
||||||
|
|
|
@ -199,11 +199,11 @@ export default class AccessSecretStorageDialog extends React.PureComponent {
|
||||||
} else if (this.state.recoveryKeyCorrect) {
|
} else if (this.state.recoveryKeyCorrect) {
|
||||||
return _t("Looks good!");
|
return _t("Looks good!");
|
||||||
} else if (this.state.recoveryKeyValid) {
|
} else if (this.state.recoveryKeyValid) {
|
||||||
return _t("Wrong Recovery Key");
|
return _t("Wrong Security Key");
|
||||||
} else if (this.state.recoveryKeyValid === null) {
|
} else if (this.state.recoveryKeyValid === null) {
|
||||||
return '';
|
return '';
|
||||||
} else {
|
} else {
|
||||||
return _t("Invalid Recovery Key");
|
return _t("Invalid Security Key");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ export default class AccessSecretStorageDialog extends React.PureComponent {
|
||||||
keyStatus = <div className="mx_AccessSecretStorageDialog_keyStatus">
|
keyStatus = <div className="mx_AccessSecretStorageDialog_keyStatus">
|
||||||
{"\uD83D\uDC4E "}{_t(
|
{"\uD83D\uDC4E "}{_t(
|
||||||
"Unable to access secret storage. " +
|
"Unable to access secret storage. " +
|
||||||
"Please verify that you entered the correct recovery passphrase.",
|
"Please verify that you entered the correct Security Phrase.",
|
||||||
)}
|
)}
|
||||||
</div>;
|
</div>;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -34,6 +34,7 @@ import InteractiveAuthDialog from '../InteractiveAuthDialog';
|
||||||
export default class CreateCrossSigningDialog extends React.PureComponent {
|
export default class CreateCrossSigningDialog extends React.PureComponent {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
accountPassword: PropTypes.string,
|
accountPassword: PropTypes.string,
|
||||||
|
tokenLogin: PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
@ -96,6 +97,9 @@ export default class CreateCrossSigningDialog extends React.PureComponent {
|
||||||
user: MatrixClientPeg.get().getUserId(),
|
user: MatrixClientPeg.get().getUserId(),
|
||||||
password: this.state.accountPassword,
|
password: this.state.accountPassword,
|
||||||
});
|
});
|
||||||
|
} else if (this.props.tokenLogin) {
|
||||||
|
// We are hoping the grace period is active
|
||||||
|
await makeRequest({});
|
||||||
} else {
|
} else {
|
||||||
const dialogAesthetics = {
|
const dialogAesthetics = {
|
||||||
[SSOAuthEntry.PHASE_PREAUTH]: {
|
[SSOAuthEntry.PHASE_PREAUTH]: {
|
||||||
|
@ -144,6 +148,12 @@ export default class CreateCrossSigningDialog extends React.PureComponent {
|
||||||
});
|
});
|
||||||
this.props.onFinished(true);
|
this.props.onFinished(true);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
if (this.props.tokenLogin) {
|
||||||
|
// ignore any failures, we are relying on grace period here
|
||||||
|
this.props.onFinished();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({ error: e });
|
this.setState({ error: e });
|
||||||
console.error("Error bootstrapping cross-signing", e);
|
console.error("Error bootstrapping cross-signing", e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -297,19 +297,19 @@ export default class RestoreKeyBackupDialog extends React.PureComponent {
|
||||||
} else if (this.state.restoreError) {
|
} else if (this.state.restoreError) {
|
||||||
if (this.state.restoreError.errcode === MatrixClient.RESTORE_BACKUP_ERROR_BAD_KEY) {
|
if (this.state.restoreError.errcode === MatrixClient.RESTORE_BACKUP_ERROR_BAD_KEY) {
|
||||||
if (this.state.restoreType === RESTORE_TYPE_RECOVERYKEY) {
|
if (this.state.restoreType === RESTORE_TYPE_RECOVERYKEY) {
|
||||||
title = _t("Recovery key mismatch");
|
title = _t("Security Key mismatch");
|
||||||
content = <div>
|
content = <div>
|
||||||
<p>{_t(
|
<p>{_t(
|
||||||
"Backup could not be decrypted with this recovery key: " +
|
"Backup could not be decrypted with this Security Key: " +
|
||||||
"please verify that you entered the correct recovery key.",
|
"please verify that you entered the correct Security Key.",
|
||||||
)}</p>
|
)}</p>
|
||||||
</div>;
|
</div>;
|
||||||
} else {
|
} else {
|
||||||
title = _t("Incorrect recovery passphrase");
|
title = _t("Incorrect Security Phrase");
|
||||||
content = <div>
|
content = <div>
|
||||||
<p>{_t(
|
<p>{_t(
|
||||||
"Backup could not be decrypted with this recovery passphrase: " +
|
"Backup could not be decrypted with this Security Phrase: " +
|
||||||
"please verify that you entered the correct recovery passphrase.",
|
"please verify that you entered the correct Security Phrase.",
|
||||||
)}</p>
|
)}</p>
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
|
@ -342,7 +342,7 @@ export default class RestoreKeyBackupDialog extends React.PureComponent {
|
||||||
} else if (backupHasPassphrase && !this.state.forceRecoveryKey) {
|
} else if (backupHasPassphrase && !this.state.forceRecoveryKey) {
|
||||||
const DialogButtons = sdk.getComponent('views.elements.DialogButtons');
|
const DialogButtons = sdk.getComponent('views.elements.DialogButtons');
|
||||||
const AccessibleButton = sdk.getComponent('elements.AccessibleButton');
|
const AccessibleButton = sdk.getComponent('elements.AccessibleButton');
|
||||||
title = _t("Enter recovery passphrase");
|
title = _t("Enter Security Phrase");
|
||||||
content = <div>
|
content = <div>
|
||||||
<p>{_t(
|
<p>{_t(
|
||||||
"<b>Warning</b>: you should only set up key backup " +
|
"<b>Warning</b>: you should only set up key backup " +
|
||||||
|
@ -351,7 +351,7 @@ export default class RestoreKeyBackupDialog extends React.PureComponent {
|
||||||
)}</p>
|
)}</p>
|
||||||
<p>{_t(
|
<p>{_t(
|
||||||
"Access your secure message history and set up secure " +
|
"Access your secure message history and set up secure " +
|
||||||
"messaging by entering your recovery passphrase.",
|
"messaging by entering your Security Phrase.",
|
||||||
)}</p>
|
)}</p>
|
||||||
|
|
||||||
<form className="mx_RestoreKeyBackupDialog_primaryContainer">
|
<form className="mx_RestoreKeyBackupDialog_primaryContainer">
|
||||||
|
@ -371,8 +371,8 @@ export default class RestoreKeyBackupDialog extends React.PureComponent {
|
||||||
/>
|
/>
|
||||||
</form>
|
</form>
|
||||||
{_t(
|
{_t(
|
||||||
"If you've forgotten your recovery passphrase you can "+
|
"If you've forgotten your Security Phrase you can "+
|
||||||
"<button1>use your recovery key</button1> or " +
|
"<button1>use your Security Key</button1> or " +
|
||||||
"<button2>set up new recovery options</button2>"
|
"<button2>set up new recovery options</button2>"
|
||||||
, {}, {
|
, {}, {
|
||||||
button1: s => <AccessibleButton className="mx_linkButton"
|
button1: s => <AccessibleButton className="mx_linkButton"
|
||||||
|
@ -390,7 +390,7 @@ export default class RestoreKeyBackupDialog extends React.PureComponent {
|
||||||
})}
|
})}
|
||||||
</div>;
|
</div>;
|
||||||
} else {
|
} else {
|
||||||
title = _t("Enter recovery key");
|
title = _t("Enter Security Key");
|
||||||
const DialogButtons = sdk.getComponent('views.elements.DialogButtons');
|
const DialogButtons = sdk.getComponent('views.elements.DialogButtons');
|
||||||
const AccessibleButton = sdk.getComponent('elements.AccessibleButton');
|
const AccessibleButton = sdk.getComponent('elements.AccessibleButton');
|
||||||
|
|
||||||
|
@ -399,11 +399,11 @@ export default class RestoreKeyBackupDialog extends React.PureComponent {
|
||||||
keyStatus = <div className="mx_RestoreKeyBackupDialog_keyStatus"></div>;
|
keyStatus = <div className="mx_RestoreKeyBackupDialog_keyStatus"></div>;
|
||||||
} else if (this.state.recoveryKeyValid) {
|
} else if (this.state.recoveryKeyValid) {
|
||||||
keyStatus = <div className="mx_RestoreKeyBackupDialog_keyStatus">
|
keyStatus = <div className="mx_RestoreKeyBackupDialog_keyStatus">
|
||||||
{"\uD83D\uDC4D "}{_t("This looks like a valid recovery key!")}
|
{"\uD83D\uDC4D "}{_t("This looks like a valid Security Key!")}
|
||||||
</div>;
|
</div>;
|
||||||
} else {
|
} else {
|
||||||
keyStatus = <div className="mx_RestoreKeyBackupDialog_keyStatus">
|
keyStatus = <div className="mx_RestoreKeyBackupDialog_keyStatus">
|
||||||
{"\uD83D\uDC4E "}{_t("Not a valid recovery key")}
|
{"\uD83D\uDC4E "}{_t("Not a valid Security Key")}
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -415,7 +415,7 @@ export default class RestoreKeyBackupDialog extends React.PureComponent {
|
||||||
)}</p>
|
)}</p>
|
||||||
<p>{_t(
|
<p>{_t(
|
||||||
"Access your secure message history and set up secure " +
|
"Access your secure message history and set up secure " +
|
||||||
"messaging by entering your recovery key.",
|
"messaging by entering your Security Key.",
|
||||||
)}</p>
|
)}</p>
|
||||||
|
|
||||||
<div className="mx_RestoreKeyBackupDialog_primaryContainer">
|
<div className="mx_RestoreKeyBackupDialog_primaryContainer">
|
||||||
|
@ -434,7 +434,7 @@ export default class RestoreKeyBackupDialog extends React.PureComponent {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{_t(
|
{_t(
|
||||||
"If you've forgotten your recovery key you can "+
|
"If you've forgotten your Security Key you can "+
|
||||||
"<button>set up new recovery options</button>"
|
"<button>set up new recovery options</button>"
|
||||||
, {}, {
|
, {}, {
|
||||||
button: s => <AccessibleButton className="mx_linkButton"
|
button: s => <AccessibleButton className="mx_linkButton"
|
||||||
|
|
173
src/components/views/elements/DesktopCapturerSourcePicker.tsx
Normal file
|
@ -0,0 +1,173 @@
|
||||||
|
/*
|
||||||
|
Copyright 2021 Šimon Brandner <simon.bra.ag@gmail.com>
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
import { _t } from '../../../languageHandler';
|
||||||
|
import BaseDialog from "..//dialogs/BaseDialog"
|
||||||
|
import AccessibleButton from './AccessibleButton';
|
||||||
|
import {getDesktopCapturerSources} from "matrix-js-sdk/src/webrtc/call";
|
||||||
|
|
||||||
|
export interface DesktopCapturerSource {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
thumbnailURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum Tabs {
|
||||||
|
Screens = "screens",
|
||||||
|
Windows = "windows",
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DesktopCapturerSourceIProps {
|
||||||
|
source: DesktopCapturerSource;
|
||||||
|
onSelect(source: DesktopCapturerSource): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class ExistingSource extends React.Component<DesktopCapturerSourceIProps> {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
}
|
||||||
|
|
||||||
|
onClick = (ev) => {
|
||||||
|
this.props.onSelect(this.props.source);
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<AccessibleButton
|
||||||
|
className="mx_desktopCapturerSourcePicker_stream_button"
|
||||||
|
title={this.props.source.name}
|
||||||
|
onClick={this.onClick} >
|
||||||
|
<img
|
||||||
|
className="mx_desktopCapturerSourcePicker_stream_thumbnail"
|
||||||
|
src={this.props.source.thumbnailURL}
|
||||||
|
/>
|
||||||
|
<span className="mx_desktopCapturerSourcePicker_stream_name">{this.props.source.name}</span>
|
||||||
|
</AccessibleButton>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DesktopCapturerSourcePickerIState {
|
||||||
|
selectedTab: Tabs;
|
||||||
|
sources: Array<DesktopCapturerSource>;
|
||||||
|
}
|
||||||
|
export interface DesktopCapturerSourcePickerIProps {
|
||||||
|
onFinished(source: DesktopCapturerSource): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default class DesktopCapturerSourcePicker extends React.Component<
|
||||||
|
DesktopCapturerSourcePickerIProps,
|
||||||
|
DesktopCapturerSourcePickerIState
|
||||||
|
> {
|
||||||
|
interval;
|
||||||
|
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
|
||||||
|
this.state = {
|
||||||
|
selectedTab: Tabs.Screens,
|
||||||
|
sources: [],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
async componentDidMount() {
|
||||||
|
// setInterval() first waits and then executes, therefore
|
||||||
|
// we call getDesktopCapturerSources() here without any delay.
|
||||||
|
// Otherwise the dialog would be left empty for some time.
|
||||||
|
this.setState({
|
||||||
|
sources: await getDesktopCapturerSources(),
|
||||||
|
});
|
||||||
|
|
||||||
|
// We update the sources every 500ms to get newer thumbnails
|
||||||
|
this.interval = setInterval(async () => {
|
||||||
|
this.setState({
|
||||||
|
sources: await getDesktopCapturerSources(),
|
||||||
|
});
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
clearInterval(this.interval);
|
||||||
|
}
|
||||||
|
|
||||||
|
onSelect = (source) => {
|
||||||
|
this.props.onFinished(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
onScreensClick = (ev) => {
|
||||||
|
this.setState({selectedTab: Tabs.Screens});
|
||||||
|
}
|
||||||
|
|
||||||
|
onWindowsClick = (ev) => {
|
||||||
|
this.setState({selectedTab: Tabs.Windows});
|
||||||
|
}
|
||||||
|
|
||||||
|
onCloseClick = (ev) => {
|
||||||
|
this.props.onFinished(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
let sources;
|
||||||
|
if (this.state.selectedTab === Tabs.Screens) {
|
||||||
|
sources = this.state.sources
|
||||||
|
.filter((source) => {
|
||||||
|
return source.id.startsWith("screen");
|
||||||
|
})
|
||||||
|
.map((source) => {
|
||||||
|
return <ExistingSource source={source} onSelect={this.onSelect} key={source.id} />;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
sources = this.state.sources
|
||||||
|
.filter((source) => {
|
||||||
|
return source.id.startsWith("window");
|
||||||
|
})
|
||||||
|
.map((source) => {
|
||||||
|
return <ExistingSource source={source} onSelect={this.onSelect} key={source.id} />;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const buttonStyle = "mx_desktopCapturerSourcePicker_tabLabel";
|
||||||
|
const screensButtonStyle = buttonStyle + ((this.state.selectedTab === Tabs.Screens) ? "_selected" : "");
|
||||||
|
const windowsButtonStyle = buttonStyle + ((this.state.selectedTab === Tabs.Windows) ? "_selected" : "");
|
||||||
|
|
||||||
|
return (
|
||||||
|
<BaseDialog
|
||||||
|
className="mx_desktopCapturerSourcePicker"
|
||||||
|
onFinished={this.onCloseClick}
|
||||||
|
title={_t("Share your screen")}
|
||||||
|
>
|
||||||
|
<div className="mx_desktopCapturerSourcePicker_tabLabels">
|
||||||
|
<AccessibleButton
|
||||||
|
className={screensButtonStyle}
|
||||||
|
onClick={this.onScreensClick}
|
||||||
|
>
|
||||||
|
{_t("Screens")}
|
||||||
|
</AccessibleButton>
|
||||||
|
<AccessibleButton
|
||||||
|
className={windowsButtonStyle}
|
||||||
|
onClick={this.onWindowsClick}
|
||||||
|
>
|
||||||
|
{_t("Windows")}
|
||||||
|
</AccessibleButton>
|
||||||
|
</div>
|
||||||
|
<div className="mx_desktopCapturerSourcePicker_panel">
|
||||||
|
{ sources }
|
||||||
|
</div>
|
||||||
|
</BaseDialog>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -124,7 +124,7 @@ export default class EditableItemList extends React.Component {
|
||||||
<Field label={this.props.placeholder} type="text"
|
<Field label={this.props.placeholder} type="text"
|
||||||
autoComplete="off" value={this.props.newItem || ""} onChange={this._onNewItemChanged}
|
autoComplete="off" value={this.props.newItem || ""} onChange={this._onNewItemChanged}
|
||||||
list={this.props.suggestionsListId} />
|
list={this.props.suggestionsListId} />
|
||||||
<AccessibleButton onClick={this._onItemAdded} kind="primary" type="submit">
|
<AccessibleButton onClick={this._onItemAdded} kind="primary" type="submit" disabled={!this.props.newItem}>
|
||||||
{_t("Add")}
|
{_t("Add")}
|
||||||
</AccessibleButton>
|
</AccessibleButton>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -23,6 +23,7 @@ import ResizeObserver from 'resize-observer-polyfill';
|
||||||
import dis from '../../../dispatcher/dispatcher';
|
import dis from '../../../dispatcher/dispatcher';
|
||||||
import MatrixClientContext from "../../../contexts/MatrixClientContext";
|
import MatrixClientContext from "../../../contexts/MatrixClientContext";
|
||||||
import {MatrixClientPeg} from "../../../MatrixClientPeg";
|
import {MatrixClientPeg} from "../../../MatrixClientPeg";
|
||||||
|
import {isNullOrUndefined} from "matrix-js-sdk/src/utils";
|
||||||
|
|
||||||
// Shamelessly ripped off Modal.js. There's probably a better way
|
// Shamelessly ripped off Modal.js. There's probably a better way
|
||||||
// of doing reusable widgets like dialog boxes & menus where we go and
|
// of doing reusable widgets like dialog boxes & menus where we go and
|
||||||
|
@ -61,6 +62,9 @@ export default class PersistedElement extends React.Component {
|
||||||
// Any PersistedElements with the same persistKey will use
|
// Any PersistedElements with the same persistKey will use
|
||||||
// the same DOM container.
|
// the same DOM container.
|
||||||
persistKey: PropTypes.string.isRequired,
|
persistKey: PropTypes.string.isRequired,
|
||||||
|
|
||||||
|
// z-index for the element. Defaults to 9.
|
||||||
|
zIndex: PropTypes.number,
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -165,6 +169,7 @@ export default class PersistedElement extends React.Component {
|
||||||
|
|
||||||
const parentRect = parent.getBoundingClientRect();
|
const parentRect = parent.getBoundingClientRect();
|
||||||
Object.assign(child.style, {
|
Object.assign(child.style, {
|
||||||
|
zIndex: isNullOrUndefined(this.props.zIndex) ? 9 : this.props.zIndex,
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
top: parentRect.top + 'px',
|
top: parentRect.top + 'px',
|
||||||
left: parentRect.left + 'px',
|
left: parentRect.left + 'px',
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
Copyright 2017 Vector Creations Ltd
|
Copyright 2017 Vector Creations Ltd
|
||||||
Copyright 2018 New Vector Ltd
|
Copyright 2018 New Vector Ltd
|
||||||
Copyright 2019 The Matrix.org Foundation C.I.C.
|
Copyright 2019, 2021 The Matrix.org Foundation C.I.C.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
@ -23,23 +23,11 @@ import { Room, RoomMember } from 'matrix-js-sdk';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import {MatrixClientPeg} from '../../../MatrixClientPeg';
|
import {MatrixClientPeg} from '../../../MatrixClientPeg';
|
||||||
import FlairStore from "../../../stores/FlairStore";
|
import FlairStore from "../../../stores/FlairStore";
|
||||||
import {getPrimaryPermalinkEntity} from "../../../utils/permalinks/Permalinks";
|
import {getPrimaryPermalinkEntity, parseAppLocalLink} from "../../../utils/permalinks/Permalinks";
|
||||||
import MatrixClientContext from "../../../contexts/MatrixClientContext";
|
import MatrixClientContext from "../../../contexts/MatrixClientContext";
|
||||||
import {Action} from "../../../dispatcher/actions";
|
import {Action} from "../../../dispatcher/actions";
|
||||||
|
|
||||||
// For URLs of matrix.to links in the timeline which have been reformatted by
|
|
||||||
// HttpUtils transformTags to relative links. This excludes event URLs (with `[^\/]*`)
|
|
||||||
const REGEX_LOCAL_PERMALINK = /^#\/(?:user|room|group)\/(([#!@+]).*?)(?=\/|\?|$)/;
|
|
||||||
|
|
||||||
class Pill extends React.Component {
|
class Pill extends React.Component {
|
||||||
static isPillUrl(url) {
|
|
||||||
return !!getPrimaryPermalinkEntity(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
static isMessagePillUrl(url) {
|
|
||||||
return !!REGEX_LOCAL_PERMALINK.exec(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
static roomNotifPos(text) {
|
static roomNotifPos(text) {
|
||||||
return text.indexOf("@room");
|
return text.indexOf("@room");
|
||||||
}
|
}
|
||||||
|
@ -56,7 +44,7 @@ class Pill extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
// The Type of this Pill. If url is given, this is auto-detected.
|
// The Type of this Pill. If url is given, this is auto-detected.
|
||||||
type: PropTypes.string,
|
type: PropTypes.string,
|
||||||
// The URL to pillify (no validation is done, see isPillUrl and isMessagePillUrl)
|
// The URL to pillify (no validation is done)
|
||||||
url: PropTypes.string,
|
url: PropTypes.string,
|
||||||
// Whether the pill is in a message
|
// Whether the pill is in a message
|
||||||
inMessage: PropTypes.bool,
|
inMessage: PropTypes.bool,
|
||||||
|
@ -90,12 +78,9 @@ class Pill extends React.Component {
|
||||||
|
|
||||||
if (nextProps.url) {
|
if (nextProps.url) {
|
||||||
if (nextProps.inMessage) {
|
if (nextProps.inMessage) {
|
||||||
// Default to the empty array if no match for simplicity
|
const parts = parseAppLocalLink(nextProps.url);
|
||||||
// resource and prefix will be undefined instead of throwing
|
resourceId = parts.primaryEntityId; // The room/user ID
|
||||||
const matrixToMatch = REGEX_LOCAL_PERMALINK.exec(nextProps.url) || [];
|
prefix = parts.sigil; // The first character of prefix
|
||||||
|
|
||||||
resourceId = matrixToMatch[1]; // The room/user ID
|
|
||||||
prefix = matrixToMatch[2]; // The first character of prefix
|
|
||||||
} else {
|
} else {
|
||||||
resourceId = getPrimaryPermalinkEntity(nextProps.url);
|
resourceId = getPrimaryPermalinkEntity(nextProps.url);
|
||||||
prefix = resourceId ? resourceId[0] : undefined;
|
prefix = resourceId ? resourceId[0] : undefined;
|
||||||
|
|
|
@ -15,19 +15,40 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
import { chunk } from "lodash";
|
||||||
|
import classNames from "classnames";
|
||||||
import {MatrixClient} from "matrix-js-sdk/src/client";
|
import {MatrixClient} from "matrix-js-sdk/src/client";
|
||||||
|
|
||||||
import PlatformPeg from "../../../PlatformPeg";
|
import PlatformPeg from "../../../PlatformPeg";
|
||||||
import AccessibleButton from "./AccessibleButton";
|
import AccessibleButton from "./AccessibleButton";
|
||||||
import {_t} from "../../../languageHandler";
|
import {_t} from "../../../languageHandler";
|
||||||
import {IIdentityProvider, ISSOFlow} from "../../../Login";
|
import {IdentityProviderBrand, IIdentityProvider, ISSOFlow} from "../../../Login";
|
||||||
import classNames from "classnames";
|
import AccessibleTooltipButton from "./AccessibleTooltipButton";
|
||||||
|
|
||||||
interface ISSOButtonProps extends Omit<IProps, "flow"> {
|
interface ISSOButtonProps extends Omit<IProps, "flow"> {
|
||||||
idp: IIdentityProvider;
|
idp: IIdentityProvider;
|
||||||
mini?: boolean;
|
mini?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getIcon = (brand: IdentityProviderBrand | string) => {
|
||||||
|
switch (brand) {
|
||||||
|
case IdentityProviderBrand.Apple:
|
||||||
|
return require(`../../../../res/img/element-icons/brands/apple.svg`);
|
||||||
|
case IdentityProviderBrand.Facebook:
|
||||||
|
return require(`../../../../res/img/element-icons/brands/facebook.svg`);
|
||||||
|
case IdentityProviderBrand.Github:
|
||||||
|
return require(`../../../../res/img/element-icons/brands/github.svg`);
|
||||||
|
case IdentityProviderBrand.Gitlab:
|
||||||
|
return require(`../../../../res/img/element-icons/brands/gitlab.svg`);
|
||||||
|
case IdentityProviderBrand.Google:
|
||||||
|
return require(`../../../../res/img/element-icons/brands/google.svg`);
|
||||||
|
case IdentityProviderBrand.Twitter:
|
||||||
|
return require(`../../../../res/img/element-icons/brands/twitter.svg`);
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const SSOButton: React.FC<ISSOButtonProps> = ({
|
const SSOButton: React.FC<ISSOButtonProps> = ({
|
||||||
matrixClient,
|
matrixClient,
|
||||||
loginType,
|
loginType,
|
||||||
|
@ -37,7 +58,6 @@ const SSOButton: React.FC<ISSOButtonProps> = ({
|
||||||
mini,
|
mini,
|
||||||
...props
|
...props
|
||||||
}) => {
|
}) => {
|
||||||
const kind = primary ? "primary" : "primary_outline";
|
|
||||||
const label = idp ? _t("Continue with %(provider)s", { provider: idp.name }) : _t("Sign in with single sign-on");
|
const label = idp ? _t("Continue with %(provider)s", { provider: idp.name }) : _t("Sign in with single sign-on");
|
||||||
|
|
||||||
const onClick = () => {
|
const onClick = () => {
|
||||||
|
@ -45,30 +65,35 @@ const SSOButton: React.FC<ISSOButtonProps> = ({
|
||||||
};
|
};
|
||||||
|
|
||||||
let icon;
|
let icon;
|
||||||
if (typeof idp?.icon === "string" && (idp.icon.startsWith("mxc://") || idp.icon.startsWith("https://"))) {
|
let brandClass;
|
||||||
icon = <img
|
const brandIcon = idp ? getIcon(idp.brand) : null;
|
||||||
src={matrixClient.mxcUrlToHttp(idp.icon, 24, 24, "crop", true)}
|
if (brandIcon) {
|
||||||
height="24"
|
const brandName = idp.brand.split(".").pop();
|
||||||
width="24"
|
brandClass = `mx_SSOButton_brand_${brandName}`;
|
||||||
alt={label}
|
icon = <img src={brandIcon} height="24" width="24" alt={brandName} />;
|
||||||
/>;
|
} else if (typeof idp?.icon === "string" && idp.icon.startsWith("mxc://")) {
|
||||||
|
const src = matrixClient.mxcUrlToHttp(idp.icon, 24, 24, "crop", true);
|
||||||
|
icon = <img src={src} height="24" width="24" alt={idp.name} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
const classes = classNames("mx_SSOButton", {
|
const classes = classNames("mx_SSOButton", {
|
||||||
|
[brandClass]: brandClass,
|
||||||
mx_SSOButton_mini: mini,
|
mx_SSOButton_mini: mini,
|
||||||
|
mx_SSOButton_default: !idp,
|
||||||
|
mx_SSOButton_primary: primary,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (mini) {
|
if (mini) {
|
||||||
// TODO fallback icon
|
// TODO fallback icon
|
||||||
return (
|
return (
|
||||||
<AccessibleButton {...props} className={classes} kind={kind} onClick={onClick}>
|
<AccessibleTooltipButton {...props} title={label} className={classes} onClick={onClick}>
|
||||||
{ icon }
|
{ icon }
|
||||||
</AccessibleButton>
|
</AccessibleTooltipButton>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AccessibleButton {...props} className={classes} kind={kind} onClick={onClick}>
|
<AccessibleButton {...props} className={classes} onClick={onClick}>
|
||||||
{ icon }
|
{ icon }
|
||||||
{ label }
|
{ label }
|
||||||
</AccessibleButton>
|
</AccessibleButton>
|
||||||
|
@ -83,6 +108,8 @@ interface IProps {
|
||||||
primary?: boolean;
|
primary?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const MAX_PER_ROW = 6;
|
||||||
|
|
||||||
const SSOButtons: React.FC<IProps> = ({matrixClient, flow, loginType, fragmentAfterLogin, primary}) => {
|
const SSOButtons: React.FC<IProps> = ({matrixClient, flow, loginType, fragmentAfterLogin, primary}) => {
|
||||||
const providers = flow["org.matrix.msc2858.identity_providers"] || [];
|
const providers = flow["org.matrix.msc2858.identity_providers"] || [];
|
||||||
if (providers.length < 2) {
|
if (providers.length < 2) {
|
||||||
|
@ -97,8 +124,13 @@ const SSOButtons: React.FC<IProps> = ({matrixClient, flow, loginType, fragmentAf
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const rows = Math.ceil(providers.length / MAX_PER_ROW);
|
||||||
|
const size = Math.ceil(providers.length / rows);
|
||||||
|
|
||||||
return <div className="mx_SSOButtons">
|
return <div className="mx_SSOButtons">
|
||||||
{ providers.map(idp => (
|
{ chunk(providers, size).map(chunk => (
|
||||||
|
<div key={chunk[0].id} className="mx_SSOButtons_row">
|
||||||
|
{ chunk.map(idp => (
|
||||||
<SSOButton
|
<SSOButton
|
||||||
key={idp.id}
|
key={idp.id}
|
||||||
matrixClient={matrixClient}
|
matrixClient={matrixClient}
|
||||||
|
@ -109,6 +141,8 @@ const SSOButtons: React.FC<IProps> = ({matrixClient, flow, loginType, fragmentAf
|
||||||
primary={primary}
|
primary={primary}
|
||||||
/>
|
/>
|
||||||
)) }
|
)) }
|
||||||
|
</div>
|
||||||
|
)) }
|
||||||
</div>;
|
</div>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
36
src/components/views/host_signup/HostSignupContainer.tsx
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
/*
|
||||||
|
Copyright 2021 The Matrix.org Foundation C.I.C.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import React, { useState } from 'react';
|
||||||
|
import HostSignupDialog from "../dialogs/HostSignupDialog";
|
||||||
|
import { HostSignupStore } from "../../../stores/HostSignupStore";
|
||||||
|
import { useEventEmitter } from "../../../hooks/useEventEmitter";
|
||||||
|
import { UPDATE_EVENT } from "../../../stores/AsyncStore";
|
||||||
|
|
||||||
|
const HostSignupContainer = () => {
|
||||||
|
const [isActive, setIsActive] = useState(HostSignupStore.instance.isHostSignupActive);
|
||||||
|
useEventEmitter(HostSignupStore.instance, UPDATE_EVENT, () => {
|
||||||
|
setIsActive(HostSignupStore.instance.isHostSignupActive);
|
||||||
|
});
|
||||||
|
|
||||||
|
return <div className="mx_HostSignupContainer">
|
||||||
|
{isActive &&
|
||||||
|
<HostSignupDialog />
|
||||||
|
}
|
||||||
|
</div>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default HostSignupContainer
|
|
@ -19,6 +19,8 @@ import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
||||||
import { _t } from "../../../languageHandler";
|
import { _t } from "../../../languageHandler";
|
||||||
import WidgetStore from "../../../stores/WidgetStore";
|
import WidgetStore from "../../../stores/WidgetStore";
|
||||||
import EventTileBubble from "./EventTileBubble";
|
import EventTileBubble from "./EventTileBubble";
|
||||||
|
import { MatrixClientPeg } from "../../../MatrixClientPeg";
|
||||||
|
import { Container, WidgetLayoutStore } from "../../../stores/widgets/WidgetLayoutStore";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
mxEvent: MatrixEvent;
|
mxEvent: MatrixEvent;
|
||||||
|
@ -33,10 +35,15 @@ export default class MJitsiWidgetEvent extends React.PureComponent<IProps> {
|
||||||
const url = this.props.mxEvent.getContent()['url'];
|
const url = this.props.mxEvent.getContent()['url'];
|
||||||
const prevUrl = this.props.mxEvent.getPrevContent()['url'];
|
const prevUrl = this.props.mxEvent.getPrevContent()['url'];
|
||||||
const senderName = this.props.mxEvent.sender?.name || this.props.mxEvent.getSender();
|
const senderName = this.props.mxEvent.sender?.name || this.props.mxEvent.getSender();
|
||||||
|
const room = MatrixClientPeg.get().getRoom(this.props.mxEvent.getRoomId());
|
||||||
|
const widgetId = this.props.mxEvent.getStateKey();
|
||||||
|
const widget = WidgetStore.instance.getRoom(room.roomId, true).widgets.find(w => w.id === widgetId);
|
||||||
|
|
||||||
let joinCopy = _t('Join the conference at the top of this room');
|
let joinCopy = _t('Join the conference at the top of this room');
|
||||||
if (!WidgetStore.instance.isPinned(this.props.mxEvent.getRoomId(), this.props.mxEvent.getStateKey())) {
|
if (widget && WidgetLayoutStore.instance.isInContainer(room, widget, Container.Right)) {
|
||||||
joinCopy = _t('Join the conference from the room information card on the right');
|
joinCopy = _t('Join the conference from the room information card on the right');
|
||||||
|
} else if (!widget) {
|
||||||
|
joinCopy = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!url) {
|
if (!url) {
|
||||||
|
|
|
@ -81,6 +81,7 @@ export default class TextualBody extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
_applyFormatting() {
|
_applyFormatting() {
|
||||||
|
const showLineNumbers = SettingsStore.getValue("showCodeLineNumbers");
|
||||||
this.activateSpoilers([this._content.current]);
|
this.activateSpoilers([this._content.current]);
|
||||||
|
|
||||||
// pillifyLinks BEFORE linkifyElement because plain room/user URLs in the composer
|
// pillifyLinks BEFORE linkifyElement because plain room/user URLs in the composer
|
||||||
|
@ -91,31 +92,142 @@ export default class TextualBody extends React.Component {
|
||||||
this.calculateUrlPreview();
|
this.calculateUrlPreview();
|
||||||
|
|
||||||
if (this.props.mxEvent.getContent().format === "org.matrix.custom.html") {
|
if (this.props.mxEvent.getContent().format === "org.matrix.custom.html") {
|
||||||
const blocks = ReactDOM.findDOMNode(this).getElementsByTagName("code");
|
// Handle expansion and add buttons
|
||||||
if (blocks.length > 0) {
|
const pres = ReactDOM.findDOMNode(this).getElementsByTagName("pre");
|
||||||
|
if (pres.length > 0) {
|
||||||
|
for (let i = 0; i < pres.length; i++) {
|
||||||
|
// If there already is a div wrapping the codeblock we want to skip this.
|
||||||
|
// This happens after the codeblock was edited.
|
||||||
|
if (pres[i].parentNode.className == "mx_EventTile_pre_container") continue;
|
||||||
|
// Wrap a div around <pre> so that the copy button can be correctly positioned
|
||||||
|
// when the <pre> overflows and is scrolled horizontally.
|
||||||
|
const div = this._wrapInDiv(pres[i]);
|
||||||
|
this._handleCodeBlockExpansion(pres[i]);
|
||||||
|
this._addCodeExpansionButton(div, pres[i]);
|
||||||
|
this._addCodeCopyButton(div);
|
||||||
|
if (showLineNumbers) {
|
||||||
|
this._addLineNumbers(pres[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Highlight code
|
||||||
|
const codes = ReactDOM.findDOMNode(this).getElementsByTagName("code");
|
||||||
|
if (codes.length > 0) {
|
||||||
// Do this asynchronously: parsing code takes time and we don't
|
// Do this asynchronously: parsing code takes time and we don't
|
||||||
// need to block the DOM update on it.
|
// need to block the DOM update on it.
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (this._unmounted) return;
|
if (this._unmounted) return;
|
||||||
for (let i = 0; i < blocks.length; i++) {
|
for (let i = 0; i < codes.length; i++) {
|
||||||
|
// If the code already has the hljs class we want to skip this.
|
||||||
|
// This happens after the codeblock was edited.
|
||||||
|
if (codes[i].className.includes("hljs")) continue;
|
||||||
|
this._highlightCode(codes[i]);
|
||||||
|
}
|
||||||
|
}, 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_addCodeExpansionButton(div, pre) {
|
||||||
|
// Calculate how many percent does the pre element take up.
|
||||||
|
// If it's less than 30% we don't add the expansion button.
|
||||||
|
const percentageOfViewport = pre.offsetHeight / window.innerHeight * 100;
|
||||||
|
if (percentageOfViewport < 30) return;
|
||||||
|
|
||||||
|
const button = document.createElement("span");
|
||||||
|
button.className = "mx_EventTile_button ";
|
||||||
|
if (pre.className == "mx_EventTile_collapsedCodeBlock") {
|
||||||
|
button.className += "mx_EventTile_expandButton";
|
||||||
|
} else {
|
||||||
|
button.className += "mx_EventTile_collapseButton";
|
||||||
|
}
|
||||||
|
|
||||||
|
button.onclick = async () => {
|
||||||
|
button.className = "mx_EventTile_button ";
|
||||||
|
if (pre.className == "mx_EventTile_collapsedCodeBlock") {
|
||||||
|
pre.className = "";
|
||||||
|
button.className += "mx_EventTile_collapseButton";
|
||||||
|
} else {
|
||||||
|
pre.className = "mx_EventTile_collapsedCodeBlock";
|
||||||
|
button.className += "mx_EventTile_expandButton";
|
||||||
|
}
|
||||||
|
|
||||||
|
// By expanding/collapsing we changed
|
||||||
|
// the height, therefore we call this
|
||||||
|
this.props.onHeightChanged();
|
||||||
|
};
|
||||||
|
|
||||||
|
div.appendChild(button);
|
||||||
|
}
|
||||||
|
|
||||||
|
_addCodeCopyButton(div) {
|
||||||
|
const button = document.createElement("span");
|
||||||
|
button.className = "mx_EventTile_button mx_EventTile_copyButton ";
|
||||||
|
|
||||||
|
// Check if expansion button exists. If so
|
||||||
|
// we put the copy button to the bottom
|
||||||
|
const expansionButtonExists = div.getElementsByClassName("mx_EventTile_button");
|
||||||
|
if (expansionButtonExists.length > 0) button.className += "mx_EventTile_buttonBottom";
|
||||||
|
|
||||||
|
button.onclick = async () => {
|
||||||
|
const copyCode = button.parentNode.getElementsByTagName("code")[0];
|
||||||
|
const successful = await copyPlaintext(copyCode.textContent);
|
||||||
|
|
||||||
|
const buttonRect = button.getBoundingClientRect();
|
||||||
|
const GenericTextContextMenu = sdk.getComponent('context_menus.GenericTextContextMenu');
|
||||||
|
const {close} = ContextMenu.createMenu(GenericTextContextMenu, {
|
||||||
|
...toRightOf(buttonRect, 2),
|
||||||
|
message: successful ? _t('Copied!') : _t('Failed to copy'),
|
||||||
|
});
|
||||||
|
button.onmouseleave = close;
|
||||||
|
};
|
||||||
|
|
||||||
|
div.appendChild(button);
|
||||||
|
}
|
||||||
|
|
||||||
|
_wrapInDiv(pre) {
|
||||||
|
const div = document.createElement("div");
|
||||||
|
div.className = "mx_EventTile_pre_container";
|
||||||
|
|
||||||
|
// Insert containing div in place of <pre> block
|
||||||
|
pre.parentNode.replaceChild(div, pre);
|
||||||
|
// Append <pre> block and copy button to container
|
||||||
|
div.appendChild(pre);
|
||||||
|
|
||||||
|
return div;
|
||||||
|
}
|
||||||
|
|
||||||
|
_handleCodeBlockExpansion(pre) {
|
||||||
|
if (!SettingsStore.getValue("expandCodeByDefault")) {
|
||||||
|
pre.className = "mx_EventTile_collapsedCodeBlock";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_addLineNumbers(pre) {
|
||||||
|
pre.innerHTML = '<span class="mx_EventTile_lineNumbers"></span>' + pre.innerHTML + '<span></span>';
|
||||||
|
const lineNumbers = pre.getElementsByClassName("mx_EventTile_lineNumbers")[0];
|
||||||
|
// Calculate number of lines in pre
|
||||||
|
const number = pre.innerHTML.split(/\n/).length;
|
||||||
|
// Iterate through lines starting with 1 (number of the first line is 1)
|
||||||
|
for (let i = 1; i < number; i++) {
|
||||||
|
lineNumbers.innerHTML += '<span class="mx_EventTile_lineNumber">' + i + '</span>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_highlightCode(code) {
|
||||||
if (SettingsStore.getValue("enableSyntaxHighlightLanguageDetection")) {
|
if (SettingsStore.getValue("enableSyntaxHighlightLanguageDetection")) {
|
||||||
highlight.highlightBlock(blocks[i]);
|
highlight.highlightBlock(code);
|
||||||
} else {
|
} else {
|
||||||
// Only syntax highlight if there's a class starting with language-
|
// Only syntax highlight if there's a class starting with language-
|
||||||
const classes = blocks[i].className.split(/\s+/).filter(function(cl) {
|
const classes = code.className.split(/\s+/).filter(function(cl) {
|
||||||
return cl.startsWith('language-') && !cl.startsWith('language-_');
|
return cl.startsWith('language-') && !cl.startsWith('language-_');
|
||||||
});
|
});
|
||||||
|
|
||||||
if (classes.length != 0) {
|
if (classes.length != 0) {
|
||||||
highlight.highlightBlock(blocks[i]);
|
highlight.highlightBlock(code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 10);
|
|
||||||
}
|
|
||||||
this._addCodeCopyButton();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidUpdate(prevProps) {
|
componentDidUpdate(prevProps) {
|
||||||
if (!this.props.editState) {
|
if (!this.props.editState) {
|
||||||
|
@ -254,38 +366,6 @@ export default class TextualBody extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_addCodeCopyButton() {
|
|
||||||
// Add 'copy' buttons to pre blocks
|
|
||||||
Array.from(ReactDOM.findDOMNode(this).querySelectorAll('.mx_EventTile_body pre')).forEach((p) => {
|
|
||||||
const button = document.createElement("span");
|
|
||||||
button.className = "mx_EventTile_copyButton";
|
|
||||||
button.onclick = async () => {
|
|
||||||
const copyCode = button.parentNode.getElementsByTagName("pre")[0];
|
|
||||||
const successful = await copyPlaintext(copyCode.textContent);
|
|
||||||
|
|
||||||
const buttonRect = button.getBoundingClientRect();
|
|
||||||
const GenericTextContextMenu = sdk.getComponent('context_menus.GenericTextContextMenu');
|
|
||||||
const {close} = ContextMenu.createMenu(GenericTextContextMenu, {
|
|
||||||
...toRightOf(buttonRect, 2),
|
|
||||||
message: successful ? _t('Copied!') : _t('Failed to copy'),
|
|
||||||
});
|
|
||||||
button.onmouseleave = close;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Wrap a div around <pre> so that the copy button can be correctly positioned
|
|
||||||
// when the <pre> overflows and is scrolled horizontally.
|
|
||||||
const div = document.createElement("div");
|
|
||||||
div.className = "mx_EventTile_pre_container";
|
|
||||||
|
|
||||||
// Insert containing div in place of <pre> block
|
|
||||||
p.parentNode.replaceChild(div, p);
|
|
||||||
|
|
||||||
// Append <pre> block and copy button to container
|
|
||||||
div.appendChild(p);
|
|
||||||
div.appendChild(button);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
onCancelClick = event => {
|
onCancelClick = event => {
|
||||||
this.setState({ widgetHidden: true });
|
this.setState({ widgetHidden: true });
|
||||||
// FIXME: persist this somewhere smarter than local storage
|
// FIXME: persist this somewhere smarter than local storage
|
||||||
|
|
|
@ -33,6 +33,7 @@ interface IProps {
|
||||||
previousPhase?: RightPanelPhases;
|
previousPhase?: RightPanelPhases;
|
||||||
closeLabel?: string;
|
closeLabel?: string;
|
||||||
onClose?(): void;
|
onClose?(): void;
|
||||||
|
refireParams?;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IGroupProps {
|
interface IGroupProps {
|
||||||
|
@ -56,6 +57,7 @@ const BaseCard: React.FC<IProps> = ({
|
||||||
withoutScrollContainer,
|
withoutScrollContainer,
|
||||||
previousPhase,
|
previousPhase,
|
||||||
children,
|
children,
|
||||||
|
refireParams,
|
||||||
}) => {
|
}) => {
|
||||||
let backButton;
|
let backButton;
|
||||||
if (previousPhase) {
|
if (previousPhase) {
|
||||||
|
@ -63,6 +65,7 @@ const BaseCard: React.FC<IProps> = ({
|
||||||
defaultDispatcher.dispatch<SetRightPanelPhasePayload>({
|
defaultDispatcher.dispatch<SetRightPanelPhasePayload>({
|
||||||
action: Action.SetRightPanelPhase,
|
action: Action.SetRightPanelPhase,
|
||||||
phase: previousPhase,
|
phase: previousPhase,
|
||||||
|
refireParams: refireParams,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
backButton = <AccessibleButton className="mx_BaseCard_back" onClick={onBackClick} title={_t("Back")} />;
|
backButton = <AccessibleButton className="mx_BaseCard_back" onClick={onBackClick} title={_t("Back")} />;
|
||||||
|
|