diff --git a/CHANGELOG.md b/CHANGELOG.md index 07e478fa02..02c085d0b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,159 @@ +Changes in [2.3.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v2.3.0) (2020-03-30) +=================================================================================================== +[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v2.3.0-rc.1...v2.3.0) + + * Upgrade JS SDK to 5.2.0 + +Changes in [2.3.0-rc.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v2.3.0-rc.1) (2020-03-26) +============================================================================================================= +[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v2.2.3...v2.3.0-rc.1) + + * Upgrade JS SDK to 5.2.0-rc.1 + * Add a flag to control whether cross-signing signatures are trusted + [\#4277](https://github.com/matrix-org/matrix-react-sdk/pull/4277) + * Update from Weblate + [\#4282](https://github.com/matrix-org/matrix-react-sdk/pull/4282) + * Update copy on SSSS symmetric upgrade toast + [\#4281](https://github.com/matrix-org/matrix-react-sdk/pull/4281) + * Wait for SSSS upgrade to complete + [\#4270](https://github.com/matrix-org/matrix-react-sdk/pull/4270) + * Update cross-signing verification copy and fix i18n + [\#4278](https://github.com/matrix-org/matrix-react-sdk/pull/4278) + * Fix soft-crash on bad permalinks + [\#4280](https://github.com/matrix-org/matrix-react-sdk/pull/4280) + * Fix: make self-verification wait for incoming request + [\#4267](https://github.com/matrix-org/matrix-react-sdk/pull/4267) + * Fall back to non-standard persisted api for Safari + [\#4272](https://github.com/matrix-org/matrix-react-sdk/pull/4272) + * Respond to backup key sharing requests + [\#4275](https://github.com/matrix-org/matrix-react-sdk/pull/4275) + * Log and display secret sharing cache state + [\#4268](https://github.com/matrix-org/matrix-react-sdk/pull/4268) + * Support sending config and ready events to capable widgets (Jitsi) + [\#4266](https://github.com/matrix-org/matrix-react-sdk/pull/4266) + * If cached keys are present in the key backup dialog, use them + [\#4273](https://github.com/matrix-org/matrix-react-sdk/pull/4273) + * Fix formatbar not hidden on highlighted message sent + [\#4265](https://github.com/matrix-org/matrix-react-sdk/pull/4265) + * Support Jitsi conferences sent/received on Riot Mobile and older Riot Webs + [\#4252](https://github.com/matrix-org/matrix-react-sdk/pull/4252) + * Use unified function to check cross-signing is ready + [\#4263](https://github.com/matrix-org/matrix-react-sdk/pull/4263) + * Migrate SSSS to symmetric + [\#4224](https://github.com/matrix-org/matrix-react-sdk/pull/4224) + * Migration to symmetric SSSS + [\#4242](https://github.com/matrix-org/matrix-react-sdk/pull/4242) + * Always display verification request toasts on top + [\#4262](https://github.com/matrix-org/matrix-react-sdk/pull/4262) + * Fix: assume SAS is supported when starting request with .start + [\#4249](https://github.com/matrix-org/matrix-react-sdk/pull/4249) + * Fix logout when Olm failed to load. + [\#4261](https://github.com/matrix-org/matrix-react-sdk/pull/4261) + * Improve naming of Jitsi conferences + [\#4251](https://github.com/matrix-org/matrix-react-sdk/pull/4251) + * Handle matrix.to user permalink in-room rather than solo + [\#4245](https://github.com/matrix-org/matrix-react-sdk/pull/4245) + * Fix: filter room list (again) by canonical and alternative aliases + [\#4260](https://github.com/matrix-org/matrix-react-sdk/pull/4260) + * EventIndex: Add some logging to the file panel populating. + [\#4250](https://github.com/matrix-org/matrix-react-sdk/pull/4250) + * Update from Weblate + [\#4259](https://github.com/matrix-org/matrix-react-sdk/pull/4259) + * Migrate RoomView to React Contexts in the hope for better temporal stability + [\#4258](https://github.com/matrix-org/matrix-react-sdk/pull/4258) + * Update WidgetUtils.js fix Jitsi path + [\#4256](https://github.com/matrix-org/matrix-react-sdk/pull/4256) + * Fix local jitsi build url fail and missing argument + [\#4255](https://github.com/matrix-org/matrix-react-sdk/pull/4255) + * Add shortcut CmdOrCtrl+. to toggle right panel + [\#4244](https://github.com/matrix-org/matrix-react-sdk/pull/4244) + * Improve Keyboard Shortcuts. Add alt-arrows & alt-shift-arrows + [\#4241](https://github.com/matrix-org/matrix-react-sdk/pull/4241) + * Bring back legacy verification by comparing public device keys + [\#4240](https://github.com/matrix-org/matrix-react-sdk/pull/4240) + * Searching: Return an empty result if the search term is an empty string. + [\#4248](https://github.com/matrix-org/matrix-react-sdk/pull/4248) + * Break continuation on showHiddenEvents-rendered events + [\#4247](https://github.com/matrix-org/matrix-react-sdk/pull/4247) + * Watch for show-RR settings changes, use room-specific and fix margins + [\#4246](https://github.com/matrix-org/matrix-react-sdk/pull/4246) + * Register Mac electron specific Cmd+, shortcut to User Settings + [\#4243](https://github.com/matrix-org/matrix-react-sdk/pull/4243) + * Use a local wrapper for Jitsi calls + [\#4234](https://github.com/matrix-org/matrix-react-sdk/pull/4234) + * Invite Dialog fixes + [\#4233](https://github.com/matrix-org/matrix-react-sdk/pull/4233) + * RoomPreviewBar word-break the sender name too + [\#4239](https://github.com/matrix-org/matrix-react-sdk/pull/4239) + * Report to the user when a key signature upload fails + [\#4229](https://github.com/matrix-org/matrix-react-sdk/pull/4229) + * pre-send megolm keys when possible when a user starts typing + [\#4235](https://github.com/matrix-org/matrix-react-sdk/pull/4235) + * we don't do mx_fadable anymore so get rid of broken RightPanel disabling + [\#4238](https://github.com/matrix-org/matrix-react-sdk/pull/4238) + * Fix left left panel overflowing vertically + [\#4237](https://github.com/matrix-org/matrix-react-sdk/pull/4237) + * Fix custom tags causing left panel to over-expand + [\#4236](https://github.com/matrix-org/matrix-react-sdk/pull/4236) + * Add Keyboard shortcuts dialog + [\#4231](https://github.com/matrix-org/matrix-react-sdk/pull/4231) + * Don't use buildkite agent to upload logs + [\#4232](https://github.com/matrix-org/matrix-react-sdk/pull/4232) + * Remove Gemini Scrollbars + [\#4217](https://github.com/matrix-org/matrix-react-sdk/pull/4217) + * Room Directory Explore Servers redesign + [\#4209](https://github.com/matrix-org/matrix-react-sdk/pull/4209) + * Fix redo keyboard shortcut on macOS + [\#4110](https://github.com/matrix-org/matrix-react-sdk/pull/4110) + * Fix: ensure local state for aliases doesn't get garbled up + [\#4230](https://github.com/matrix-org/matrix-react-sdk/pull/4230) + * Rename 'jump to bottom' to avoid ublock block + [\#4208](https://github.com/matrix-org/matrix-react-sdk/pull/4208) + * Restore key backup in background after complete security + [\#4225](https://github.com/matrix-org/matrix-react-sdk/pull/4225) + * Fix key backup trust text for cross-signing + [\#4223](https://github.com/matrix-org/matrix-react-sdk/pull/4223) + * Add default on config setting to control call button in composer + [\#4227](https://github.com/matrix-org/matrix-react-sdk/pull/4227) + * Fix: make alternative addresses UX less confusing + [\#4221](https://github.com/matrix-org/matrix-react-sdk/pull/4221) + * Wait for verification request on login + [\#4222](https://github.com/matrix-org/matrix-react-sdk/pull/4222) + * EventIndex: Add support to delete events from the index. + [\#4204](https://github.com/matrix-org/matrix-react-sdk/pull/4204) + * EventIndex: Remove a checkpoint if the HTTP request returns a 403. + [\#4214](https://github.com/matrix-org/matrix-react-sdk/pull/4214) + * Move to composer when typing letters with Shift held + [\#4216](https://github.com/matrix-org/matrix-react-sdk/pull/4216) + * Wrap large room names when previewing them + [\#4213](https://github.com/matrix-org/matrix-react-sdk/pull/4213) + * Rename Review Devices to Review Sessions + [\#4219](https://github.com/matrix-org/matrix-react-sdk/pull/4219) + * Fix typo in tabIndex to make React happy + [\#4215](https://github.com/matrix-org/matrix-react-sdk/pull/4215) + * Proof of concept for custom theme adding + [\#4148](https://github.com/matrix-org/matrix-react-sdk/pull/4148) + * Remove stuff that yarn install doesn't think we need + [\#4205](https://github.com/matrix-org/matrix-react-sdk/pull/4205) + * Declare jsx in tsconfig for IDEs + [\#4207](https://github.com/matrix-org/matrix-react-sdk/pull/4207) + * Fix: best-effort to join room without canonical alias over federation from + room directory + [\#4210](https://github.com/matrix-org/matrix-react-sdk/pull/4210) + * Test for cross-signing homeserver support during login, toasts + [\#4206](https://github.com/matrix-org/matrix-react-sdk/pull/4206) + * Send verification request to a single device in a way compatible with non- + cross-signing + [\#4202](https://github.com/matrix-org/matrix-react-sdk/pull/4202) + * Fixes for removing local alias + [\#4199](https://github.com/matrix-org/matrix-react-sdk/pull/4199) + * yarn upgrade + [\#4201](https://github.com/matrix-org/matrix-react-sdk/pull/4201) + * Support TypeScript for React components + [\#4203](https://github.com/matrix-org/matrix-react-sdk/pull/4203) + * When room name is changed, show both the old and new name + [\#4183](https://github.com/matrix-org/matrix-react-sdk/pull/4183) + Changes in [2.2.3](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v2.2.3) (2020-03-17) =================================================================================================== [Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v2.2.3-rc.1...v2.2.3) diff --git a/package.json b/package.json index 1ff0fb6f55..7001b1cb21 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matrix-react-sdk", - "version": "2.2.3", + "version": "2.3.0", "description": "SDK for matrix.org using React", "author": "matrix.org", "repository": { diff --git a/res/css/_components.scss b/res/css/_components.scss index 6890a1ffd1..b959b1f1cd 100644 --- a/res/css/_components.scss +++ b/res/css/_components.scss @@ -186,6 +186,7 @@ @import "./views/settings/_AvatarSetting.scss"; @import "./views/settings/_CrossSigningPanel.scss"; @import "./views/settings/_DevicesPanel.scss"; +@import "./views/settings/_E2eAdvancedPanel.scss"; @import "./views/settings/_EmailAddresses.scss"; @import "./views/settings/_IntegrationManager.scss"; @import "./views/settings/_KeyBackupPanel.scss"; diff --git a/res/css/structures/_AutoHideScrollbar.scss b/res/css/structures/_AutoHideScrollbar.scss index 6e4484157c..50842c71bc 100644 --- a/res/css/structures/_AutoHideScrollbar.scss +++ b/res/css/structures/_AutoHideScrollbar.scss @@ -14,69 +14,16 @@ See the License for the specific language governing permissions and limitations under the License. */ -/* This file has CSS for both native and non-native scrollbars in an order - * that's fairly logical to read but duplicates a selector to separate the - * hiding/showing from the sizing. - */ -/* stylelint-disable no-duplicate-selectors */ - -/* -1. for browsers that support native overlay auto-hiding scrollbars -*/ -.mx_AutoHideScrollbar { - overflow-x: hidden; - overflow-y: auto; - -ms-overflow-style: -ms-autohiding-scrollbar; -} -/* -2. webkit also supports overflow:overlay where the scrollbars don't take any space -in the layout but they don't autohide, so do that only on hover -*/ -body.mx_scrollbar_overlay_noautohide .mx_AutoHideScrollbar { - overflow-y: hidden; -} - -body.mx_scrollbar_overlay_noautohide .mx_AutoHideScrollbar:hover { - overflow-y: overlay; -} -/* -3. as a last fallback, compensate for the scrollbar taking up space in the layout -by having giving the child element (.mx_AutoHideScrollbar_offset) a -negative right margin of the width of the scrollbar when the container -is overflowing. This is what Firefox ends up using. Overflow is detected -in javascript, and adds the mx_AutoHideScrollbar_overflow class to the container. -This only works in Firefox, which should be fine as this fallback is only needed there. -*/ -body.mx_scrollbar_nooverlay { - .mx_AutoHideScrollbar { - overflow-y: hidden; - } - - .mx_AutoHideScrollbar:hover { - overflow-y: auto; - } - - /* - offset scrollbar width with negative margin-right - - include before and after psuedo-elements here so they can - be used to do something interesting like scroll-indicating - gradients (see IndicatorScrollBar) - */ - .mx_AutoHideScrollbar:hover.mx_AutoHideScrollbar_overflow > .mx_AutoHideScrollbar_offset, - .mx_AutoHideScrollbar:hover.mx_AutoHideScrollbar_overflow::before, - .mx_AutoHideScrollbar:hover.mx_AutoHideScrollbar_overflow::after { - margin-right: calc(-1 * var(--scrollbar-width)); - } -} - -// style the native scrollbars ... -// ... standard css scrollbars (firefox at time of writing) -.mx_AutoHideScrollbar { +// make any scrollbar grey and thin +html { scrollbar-color: $scrollbar-thumb-color $scrollbar-track-color; +} +// scrollbar-width is not inherited (but -color is, why?!), +// so declare it on every element +* { scrollbar-width: thin; } -// or fallback for webkit browsers + ::-webkit-scrollbar { width: 6px; height: 6px; @@ -84,6 +31,37 @@ body.mx_scrollbar_nooverlay { } ::-webkit-scrollbar-thumb { - background-color: $scrollbar-thumb-color; border-radius: 3px; + background-color: $scrollbar-thumb-color; +} + +// make auto-hide scrollbars not transparent again on hover +.mx_AutoHideScrollbar:hover { + scrollbar-color: $scrollbar-thumb-color $scrollbar-track-color; + + &::-webkit-scrollbar { + background-color: $scrollbar-track-color; + } + + &::-webkit-scrollbar-thumb { + background-color: $scrollbar-thumb-color; + } +} + +// make scrollbars transparent for autohide scrollbars +.mx_AutoHideScrollbar { + overflow-x: hidden; + overflow-y: auto; + overflow-y: overlay; // where supported + -ms-overflow-style: -ms-autohiding-scrollbar; + + &::-webkit-scrollbar { + background-color: transparent; + } + + &::-webkit-scrollbar-thumb { + background-color: transparent; + } + + scrollbar-color: transparent transparent; } diff --git a/res/css/structures/_GroupView.scss b/res/css/structures/_GroupView.scss index 2575169664..72a1132c15 100644 --- a/res/css/structures/_GroupView.scss +++ b/res/css/structures/_GroupView.scss @@ -337,7 +337,7 @@ limitations under the License. display: none; } -.mx_GroupView_body .mx_AutoHideScrollbar_offset > * { +.mx_GroupView_body .mx_AutoHideScrollbar > * { margin: 11px 50px 50px 68px; } @@ -366,7 +366,7 @@ limitations under the License. padding: 40px 20px; } -.mx_GroupView .mx_MemberInfo .mx_AutoHideScrollbar_offset > :not(.mx_MemberInfo_avatar) { +.mx_GroupView .mx_MemberInfo .mx_AutoHideScrollbar > :not(.mx_MemberInfo_avatar) { padding-left: 16px; padding-right: 16px; } diff --git a/res/css/structures/_RoomSubList.scss b/res/css/structures/_RoomSubList.scss index be44563cfb..1934e681c2 100644 --- a/res/css/structures/_RoomSubList.scss +++ b/res/css/structures/_RoomSubList.scss @@ -166,41 +166,22 @@ limitations under the License. // overflow indicators .mx_RoomSubList:not(.resized-all) > .mx_RoomSubList_scroll { - &.mx_IndicatorScrollbar_topOverflow::before, - &.mx_IndicatorScrollbar_bottomOverflow::after { + &.mx_IndicatorScrollbar_topOverflow::before { position: sticky; + content: ""; + top: 0; left: 0; right: 0; height: 8px; - content: ""; - display: block; z-index: 100; + display: block; pointer-events: none; - } - - &.mx_IndicatorScrollbar_topOverflow > .mx_AutoHideScrollbar_offset { - margin-top: -8px; - } - &.mx_IndicatorScrollbar_bottomOverflow > .mx_AutoHideScrollbar_offset { - margin-bottom: -8px; - } - - &.mx_IndicatorScrollbar_topOverflow::before { - top: 0; transition: background-image 0.1s ease-in; background: linear-gradient(to top, $panel-gradient); } - /* - // for now, we remove the bottomOverflow entirely as we don't want to - // lose the screen real-estate due to a bg-colored gradient, but we also - // don't want to use drop shadows and risk a confusing hierarchy of cards. - // so, instead, we hard-clip at the bottom but soft-clip at the top. - &.mx_IndicatorScrollbar_bottomOverflow::after { - bottom: 0; - transition: background-image 0.1s ease-in; - margin: 0px -8px; - background: linear-gradient(to bottom, rgba(0,0,0,0.1), rgba(0,0,0,0.0)); + + &.mx_IndicatorScrollbar_topOverflow { + margin-top: -8px; } - */ } diff --git a/res/css/structures/_TagPanel.scss b/res/css/structures/_TagPanel.scss index 472831c0d9..c1c5d92d3c 100644 --- a/res/css/structures/_TagPanel.scss +++ b/res/css/structures/_TagPanel.scss @@ -137,7 +137,7 @@ limitations under the License. top: -8px; border-radius: 8px; background-color: $neutral-badge-color; - color: #ffffff; + color: #000; font-weight: 600; font-size: 10px; text-align: center; diff --git a/res/css/views/right_panel/_VerificationPanel.scss b/res/css/views/right_panel/_VerificationPanel.scss index 2a733d11a7..459622b277 100644 --- a/res/css/views/right_panel/_VerificationPanel.scss +++ b/res/css/views/right_panel/_VerificationPanel.scss @@ -15,6 +15,21 @@ limitations under the License. */ .mx_UserInfo { + .mx_EncryptionPanel_cancel { + mask: url('$(res)/img/feather-customised/cancel.svg'); + mask-repeat: no-repeat; + mask-position: center; + mask-size: cover; + width: 14px; + height: 14px; + background-color: $settings-subsection-fg-color; + cursor: pointer; + position: absolute; + z-index: 100; + top: 14px; + right: 14px; + } + .mx_VerificationPanel_verified_section .mx_E2EIcon { // Override general user info margin margin: 0 auto !important; diff --git a/res/css/views/rooms/_RoomBreadcrumbs.scss b/res/css/views/rooms/_RoomBreadcrumbs.scss index 67350aac34..3858d836e6 100644 --- a/res/css/views/rooms/_RoomBreadcrumbs.scss +++ b/res/css/views/rooms/_RoomBreadcrumbs.scss @@ -41,7 +41,7 @@ limitations under the License. overflow-x: visible; } - .mx_AutoHideScrollbar_offset { + .mx_AutoHideScrollbar { display: flex; flex-direction: row; height: 100%; diff --git a/res/css/views/settings/_E2eAdvancedPanel.scss b/res/css/views/settings/_E2eAdvancedPanel.scss new file mode 100644 index 0000000000..9e32685d12 --- /dev/null +++ b/res/css/views/settings/_E2eAdvancedPanel.scss @@ -0,0 +1,20 @@ +/* +Copyright 2020 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_E2eAdvancedPanel_settingLongDescription { + margin-right: 150px; +} + diff --git a/src/CallHandler.js b/src/CallHandler.js index 362db939a3..8284e788b4 100644 --- a/src/CallHandler.js +++ b/src/CallHandler.js @@ -430,7 +430,7 @@ async function _startCallApp(roomId, type) { return; } - const confId = `JitsiConference_${generateHumanReadableId()}`; + const confId = `JitsiConference${generateHumanReadableId()}`; const jitsiDomain = SdkConfig.get()['jitsi']['preferredDomain']; let widgetUrl = WidgetUtils.getLocalJitsiWrapperUrl(); diff --git a/src/CrossSigningManager.js b/src/CrossSigningManager.js index f6a4c914b7..1bcf1ba706 100644 --- a/src/CrossSigningManager.js +++ b/src/CrossSigningManager.js @@ -142,13 +142,34 @@ const onSecretRequested = async function({ console.log(`CrossSigningManager: Ignoring request from untrusted device ${deviceId}`); return; } - const callbacks = client.getCrossSigningCacheCallbacks(); - if (!callbacks.getCrossSigningKeyCache) return; - if (name === "m.cross_signing.self_signing") { - const key = await callbacks.getCrossSigningKeyCache("self_signing"); - return key && encodeBase64(key); - } else if (name === "m.cross_signing.user_signing") { - const key = await callbacks.getCrossSigningKeyCache("user_signing"); + if (name.startsWith("m.cross_signing")) { + const callbacks = client.getCrossSigningCacheCallbacks(); + if (!callbacks.getCrossSigningKeyCache) return; + /* Explicit enumeration here is deliberate – never share the master key! */ + if (name === "m.cross_signing.self_signing") { + const key = await callbacks.getCrossSigningKeyCache("self_signing"); + if (!key) { + console.log( + `self_signing requested by ${deviceId}, but not found in cache`, + ); + } + return key && encodeBase64(key); + } else if (name === "m.cross_signing.user_signing") { + const key = await callbacks.getCrossSigningKeyCache("user_signing"); + if (!key) { + console.log( + `user_signing requested by ${deviceId}, but not found in cache`, + ); + } + return key && encodeBase64(key); + } + } else if (name === "m.megolm_backup.v1") { + const key = await client._crypto.getSessionBackupPrivateKey(); + if (!key) { + console.log( + `session backup key requested by ${deviceId}, but not found in cache`, + ); + } return key && encodeBase64(key); } console.warn("onSecretRequested didn't recognise the secret named ", name); @@ -192,19 +213,19 @@ export async function promptForBackupPassphrase() { * * @param {Function} [func] An operation to perform once secret storage has been * bootstrapped. Optional. - * @param {bool} [force] Reset secret storage even if it's already set up + * @param {bool} [forceReset] Reset secret storage even if it's already set up */ -export async function accessSecretStorage(func = async () => { }, force = false) { +export async function accessSecretStorage(func = async () => { }, forceReset = false) { const cli = MatrixClientPeg.get(); secretStorageBeingAccessed = true; try { - if (!await cli.hasSecretStorageKey() || force) { + if (!await cli.hasSecretStorageKey() || forceReset) { // This dialog calls bootstrap itself after guiding the user through // passphrase creation. const { finished } = Modal.createTrackedDialogAsync('Create Secret Storage dialog', '', import("./async-components/views/dialogs/secretstorage/CreateSecretStorageDialog"), { - force, + force: forceReset, }, null, /* priority = */ false, /* static = */ true, ); diff --git a/src/DeviceListener.js b/src/DeviceListener.js index 7878a1a670..f8555c7602 100644 --- a/src/DeviceListener.js +++ b/src/DeviceListener.js @@ -119,89 +119,85 @@ export default class DeviceListener { const crossSigningReady = await cli.isCrossSigningReady(); - if (!crossSigningReady) { - if (this._dismissedThisDeviceToast) { - ToastStore.sharedInstance().dismissToast(THIS_DEVICE_TOAST_KEY); - return; - } - - // cross signing isn't enabled - nag to enable it - // There are 3 different toasts for: - if (cli.getStoredCrossSigningForUser(cli.getUserId())) { - // Cross-signing on account but this device doesn't trust the master key (verify this session) - ToastStore.sharedInstance().addOrReplaceToast({ - key: THIS_DEVICE_TOAST_KEY, - title: _t("Verify this session"), - icon: "verification_warning", - props: {kind: 'verify_this_session'}, - component: sdk.getComponent("toasts.SetupEncryptionToast"), - }); - } else { - const backupInfo = await this._getKeyBackupInfo(); - if (backupInfo) { - // No cross-signing on account but key backup available (upgrade encryption) + if (this._dismissedThisDeviceToast) { + ToastStore.sharedInstance().dismissToast(THIS_DEVICE_TOAST_KEY); + } else { + if (!crossSigningReady) { + // cross signing isn't enabled - nag to enable it + // There are 3 different toasts for: + if (cli.getStoredCrossSigningForUser(cli.getUserId())) { + // Cross-signing on account but this device doesn't trust the master key (verify this session) ToastStore.sharedInstance().addOrReplaceToast({ key: THIS_DEVICE_TOAST_KEY, - title: _t("Encryption upgrade available"), + title: _t("Verify this session"), icon: "verification_warning", - props: {kind: 'upgrade_encryption'}, + props: {kind: 'verify_this_session'}, component: sdk.getComponent("toasts.SetupEncryptionToast"), }); } else { - // No cross-signing or key backup on account (set up encryption) + const backupInfo = await this._getKeyBackupInfo(); + if (backupInfo) { + // No cross-signing on account but key backup available (upgrade encryption) + ToastStore.sharedInstance().addOrReplaceToast({ + key: THIS_DEVICE_TOAST_KEY, + title: _t("Encryption upgrade available"), + icon: "verification_warning", + props: {kind: 'upgrade_encryption'}, + component: sdk.getComponent("toasts.SetupEncryptionToast"), + }); + } else { + // No cross-signing or key backup on account (set up encryption) + ToastStore.sharedInstance().addOrReplaceToast({ + key: THIS_DEVICE_TOAST_KEY, + title: _t("Set up encryption"), + icon: "verification_warning", + props: {kind: 'set_up_encryption'}, + component: sdk.getComponent("toasts.SetupEncryptionToast"), + }); + } + } + return; + } else if (await cli.secretStorageKeyNeedsUpgrade()) { + ToastStore.sharedInstance().addOrReplaceToast({ + key: THIS_DEVICE_TOAST_KEY, + title: _t("Encryption upgrade available"), + icon: "verification_warning", + props: {kind: 'upgrade_ssss'}, + component: sdk.getComponent("toasts.SetupEncryptionToast"), + }); + } + } + + // as long as cross-signing isn't ready, + // you can't see or dismiss any device toasts + if (crossSigningReady) { + const newActiveToasts = new Set(); + + const devices = await cli.getStoredDevicesForUser(cli.getUserId()); + for (const device of devices) { + if (device.deviceId == cli.deviceId) continue; + + const deviceTrust = await cli.checkDeviceTrust(cli.getUserId(), device.deviceId); + if (deviceTrust.isCrossSigningVerified() || this._dismissed.has(device.deviceId)) { + ToastStore.sharedInstance().dismissToast(toastKey(device.deviceId)); + } else { + this._activeNagToasts.add(device.deviceId); ToastStore.sharedInstance().addOrReplaceToast({ - key: THIS_DEVICE_TOAST_KEY, - title: _t("Set up encryption"), + key: toastKey(device.deviceId), + title: _t("Unverified login. Was this you?"), icon: "verification_warning", - props: {kind: 'set_up_encryption'}, - component: sdk.getComponent("toasts.SetupEncryptionToast"), + props: { device }, + component: sdk.getComponent("toasts.UnverifiedSessionToast"), }); + newActiveToasts.add(device.deviceId); } } - return; - } else if (await cli.secretStorageKeyNeedsUpgrade()) { - if (this._dismissedThisDeviceToast) { - ToastStore.sharedInstance().dismissToast(THIS_DEVICE_TOAST_KEY); - return; + + // clear any other outstanding toasts (eg. logged out devices) + for (const deviceId of this._activeNagToasts) { + if (!newActiveToasts.has(deviceId)) ToastStore.sharedInstance().dismissToast(toastKey(deviceId)); } - - ToastStore.sharedInstance().addOrReplaceToast({ - key: THIS_DEVICE_TOAST_KEY, - title: _t("Encryption upgrade available"), - icon: "verification_warning", - props: {kind: 'upgrade_encryption'}, - component: sdk.getComponent("toasts.SetupEncryptionToast"), - }); - } else { - ToastStore.sharedInstance().dismissToast(THIS_DEVICE_TOAST_KEY); + this._activeNagToasts = newActiveToasts; } - - const newActiveToasts = new Set(); - - const devices = await cli.getStoredDevicesForUser(cli.getUserId()); - for (const device of devices) { - if (device.deviceId == cli.deviceId) continue; - - const deviceTrust = await cli.checkDeviceTrust(cli.getUserId(), device.deviceId); - if (deviceTrust.isCrossSigningVerified() || this._dismissed.has(device.deviceId)) { - ToastStore.sharedInstance().dismissToast(toastKey(device.deviceId)); - } else { - this._activeNagToasts.add(device.deviceId); - ToastStore.sharedInstance().addOrReplaceToast({ - key: toastKey(device.deviceId), - title: _t("Unverified session"), - icon: "verification_warning", - props: { device }, - component: sdk.getComponent("toasts.UnverifiedSessionToast"), - }); - newActiveToasts.add(device.deviceId); - } - } - - // clear any other outstanding toasts (eg. logged out devices) - for (const deviceId of this._activeNagToasts) { - if (!newActiveToasts.has(deviceId)) ToastStore.sharedInstance().dismissToast(toastKey(deviceId)); - } - this._activeNagToasts = newActiveToasts; } } diff --git a/src/FromWidgetPostMessageApi.js b/src/FromWidgetPostMessageApi.js index 64caba0fdf..ea76c85643 100644 --- a/src/FromWidgetPostMessageApi.js +++ b/src/FromWidgetPostMessageApi.js @@ -24,6 +24,8 @@ import {MatrixClientPeg} from "./MatrixClientPeg"; import RoomViewStore from "./stores/RoomViewStore"; import {IntegrationManagers} from "./integrations/IntegrationManagers"; import SettingsStore from "./settings/SettingsStore"; +import {Capability, KnownWidgetActions} from "./widgets/WidgetApi"; +import SdkConfig from "./SdkConfig"; const WIDGET_API_VERSION = '0.0.2'; // Current API version const SUPPORTED_WIDGET_API_VERSIONS = [ @@ -213,11 +215,18 @@ export default class FromWidgetPostMessageApi { const data = event.data.data; const val = data.value; - if (ActiveWidgetStore.widgetHasCapability(widgetId, 'm.always_on_screen')) { + if (ActiveWidgetStore.widgetHasCapability(widgetId, Capability.AlwaysOnScreen)) { ActiveWidgetStore.setWidgetPersistence(widgetId, val); } } else if (action === 'get_openid') { // Handled by caller + } else if (action === KnownWidgetActions.GetRiotWebConfig) { + if (ActiveWidgetStore.widgetHasCapability(widgetId, Capability.GetRiotWebConfig)) { + this.sendResponse(event, { + api: INBOUND_API_NAME, + config: SdkConfig.get(), + }); + } } else { console.warn('Widget postMessage event unhandled'); this.sendError(event, {message: 'The postMessage was unhandled'}); diff --git a/src/Keyboard.ts b/src/Keyboard.ts index 817d0a0b97..23e2bbf0d6 100644 --- a/src/Keyboard.ts +++ b/src/Keyboard.ts @@ -22,6 +22,7 @@ export const Key = { PAGE_UP: "PageUp", PAGE_DOWN: "PageDown", BACKSPACE: "Backspace", + DELETE: "Delete", ARROW_UP: "ArrowUp", ARROW_DOWN: "ArrowDown", ARROW_LEFT: "ArrowLeft", diff --git a/src/MatrixClientPeg.js b/src/MatrixClientPeg.js index 98fcc85d60..21f05b9759 100644 --- a/src/MatrixClientPeg.js +++ b/src/MatrixClientPeg.js @@ -148,6 +148,9 @@ class _MatrixClientPeg { // check that we have a version of the js-sdk which includes initCrypto if (!SettingsStore.getValue("lowBandwidth") && this.matrixClient.initCrypto) { await this.matrixClient.initCrypto(); + this.matrixClient.setCryptoTrustCrossSignedDevices( + !SettingsStore.getValue('e2ee.manuallyVerifyAllSessions'), + ); StorageManager.setCryptoInitialised(true); } } catch (e) { diff --git a/src/SlashCommands.js b/src/SlashCommands.js index d306978f78..72ca4b1566 100644 --- a/src/SlashCommands.js +++ b/src/SlashCommands.js @@ -128,6 +128,15 @@ export const CommandMap = { }, category: CommandCategories.messages, }), + html: new Command({ + name: 'html', + args: '', + description: _td('Sends a message as html, without interpreting it as markdown'), + runFn: function(roomId, messages) { + return success(MatrixClientPeg.get().sendHtmlMessage(roomId, messages, messages)); + }, + category: CommandCategories.messages, + }), ddg: new Command({ name: 'ddg', args: '', diff --git a/src/WidgetMessaging.js b/src/WidgetMessaging.js index d40a8ab637..30c2389b1e 100644 --- a/src/WidgetMessaging.js +++ b/src/WidgetMessaging.js @@ -27,6 +27,7 @@ import {MatrixClientPeg} from "./MatrixClientPeg"; import SettingsStore from "./settings/SettingsStore"; import WidgetOpenIDPermissionsDialog from "./components/views/dialogs/WidgetOpenIDPermissionsDialog"; import WidgetUtils from "./utils/WidgetUtils"; +import {KnownWidgetActions} from "./widgets/WidgetApi"; if (!global.mxFromWidgetMessaging) { global.mxFromWidgetMessaging = new FromWidgetPostMessageApi(); @@ -75,6 +76,17 @@ export default class WidgetMessaging { }); } + /** + * Tells the widget that the client is ready to handle further widget requests. + * @returns {Promise<*>} Resolves after the widget has acknowledged the ready message. + */ + flagReadyToContinue() { + return this.messageToWidget({ + api: OUTBOUND_API_NAME, + action: KnownWidgetActions.ClientReady, + }); + } + /** * Request a screenshot from a widget * @return {Promise} To be resolved with screenshot data when it has been generated diff --git a/src/accessibility/KeyboardShortcuts.tsx b/src/accessibility/KeyboardShortcuts.tsx index c2739beefa..bcbf3d6810 100644 --- a/src/accessibility/KeyboardShortcuts.tsx +++ b/src/accessibility/KeyboardShortcuts.tsx @@ -118,6 +118,11 @@ const shortcuts: Record = { key: Key.ARROW_DOWN, }], description: _td("Navigate composer history"), + }, { + keybinds: [{ + key: Key.ESCAPE, + }], + description: _td("Cancel replying to a message"), }, ], diff --git a/src/async-components/views/dialogs/eventindex/ManageEventIndexDialog.js b/src/async-components/views/dialogs/eventindex/ManageEventIndexDialog.js index 371fdcaf64..3d7249b5a1 100644 --- a/src/async-components/views/dialogs/eventindex/ManageEventIndexDialog.js +++ b/src/async-components/views/dialogs/eventindex/ManageEventIndexDialog.js @@ -168,7 +168,6 @@ export default class ManageEventIndexDialog extends React.Component { totalRooms: formatCountLong(this.state.roomCount), })}
{ - const blob = new Blob([this._encodedRecoveryKey], { + const blob = new Blob([this._recoveryKey.encodedPrivateKey], { type: 'text/plain;charset=us-ascii', }); FileSaver.saveAs(blob, 'recovery-key.txt'); @@ -234,14 +233,14 @@ export default class CreateSecretStorageDialog extends React.PureComponent { if (force) { await cli.bootstrapSecretStorage({ authUploadDeviceSigningKeys: this._doBootstrapUIAuth, - createSecretStorageKey: async () => this._keyInfo, + createSecretStorageKey: async () => this._recoveryKey, setupNewKeyBackup: true, setupNewSecretStorage: true, }); } else { await cli.bootstrapSecretStorage({ authUploadDeviceSigningKeys: this._doBootstrapUIAuth, - createSecretStorageKey: async () => this._keyInfo, + createSecretStorageKey: async () => this._recoveryKey, keyBackupInfo: this.state.backupInfo, setupNewKeyBackup: !this.state.backupInfo && this.state.useKeyBackup, getKeyBackupPassphrase: promptForBackupPassphrase, @@ -299,10 +298,8 @@ export default class CreateSecretStorageDialog extends React.PureComponent { } _onSkipPassPhraseClick = async () => { - const [keyInfo, encodedRecoveryKey] = + this._recoveryKey = await MatrixClientPeg.get().createRecoveryKeyFromPassphrase(); - this._keyInfo = keyInfo; - this._encodedRecoveryKey = encodedRecoveryKey; this.setState({ copied: false, downloaded: false, @@ -335,10 +332,8 @@ export default class CreateSecretStorageDialog extends React.PureComponent { if (this.state.passPhrase !== this.state.passPhraseConfirm) return; - const [keyInfo, encodedRecoveryKey] = + this._recoveryKey = await MatrixClientPeg.get().createRecoveryKeyFromPassphrase(this.state.passPhrase); - this._keyInfo = keyInfo; - this._encodedRecoveryKey = encodedRecoveryKey; this.setState({ copied: false, downloaded: false, @@ -412,7 +407,6 @@ export default class CreateSecretStorageDialog extends React.PureComponent {
{_t("Enter your account password to confirm the upgrade:")}
- {this._encodedRecoveryKey} + {this._recoveryKey.encodedPrivateKey}
diff --git a/src/components/structures/AutoHideScrollbar.js b/src/components/structures/AutoHideScrollbar.js index 3f27f51f18..04323bb548 100644 --- a/src/components/structures/AutoHideScrollbar.js +++ b/src/components/structures/AutoHideScrollbar.js @@ -1,5 +1,6 @@ /* Copyright 2018 New Vector Ltd +Copyright 2020 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. @@ -16,93 +17,10 @@ limitations under the License. import React from "react"; -// derived from code from github.com/noeldelgado/gemini-scrollbar -// Copyright (c) Noel Delgado (pixelia.me) -function getScrollbarWidth(alternativeOverflow) { - const div = document.createElement('div'); - div.className = 'mx_AutoHideScrollbar'; //to get width of css scrollbar - div.style.position = 'absolute'; - div.style.top = '-9999px'; - div.style.width = '100px'; - div.style.height = '100px'; - div.style.overflow = "scroll"; - if (alternativeOverflow) { - div.style.overflow = alternativeOverflow; - } - div.style.msOverflowStyle = '-ms-autohiding-scrollbar'; - document.body.appendChild(div); - const scrollbarWidth = (div.offsetWidth - div.clientWidth); - document.body.removeChild(div); - return scrollbarWidth; -} - -function install() { - const scrollbarWidth = getScrollbarWidth(); - if (scrollbarWidth !== 0) { - const hasForcedOverlayScrollbar = getScrollbarWidth('overlay') === 0; - // overflow: overlay on webkit doesn't auto hide the scrollbar - if (hasForcedOverlayScrollbar) { - document.body.classList.add("mx_scrollbar_overlay_noautohide"); - } else { - document.body.classList.add("mx_scrollbar_nooverlay"); - const style = document.createElement('style'); - style.type = 'text/css'; - style.innerText = - `body.mx_scrollbar_nooverlay { --scrollbar-width: ${scrollbarWidth}px; }`; - document.head.appendChild(style); - } - } -} - -const installBodyClassesIfNeeded = (function() { - let installed = false; - return function() { - if (!installed) { - install(); - installed = true; - } - }; -})(); - export default class AutoHideScrollbar extends React.Component { constructor(props) { super(props); - this.onOverflow = this.onOverflow.bind(this); - this.onUnderflow = this.onUnderflow.bind(this); this._collectContainerRef = this._collectContainerRef.bind(this); - this._needsOverflowListener = null; - } - - onOverflow() { - this.containerRef.classList.add("mx_AutoHideScrollbar_overflow"); - this.containerRef.classList.remove("mx_AutoHideScrollbar_underflow"); - } - - onUnderflow() { - this.containerRef.classList.remove("mx_AutoHideScrollbar_overflow"); - this.containerRef.classList.add("mx_AutoHideScrollbar_underflow"); - } - - checkOverflow() { - if (!this._needsOverflowListener) { - return; - } - if (this.containerRef.scrollHeight > this.containerRef.clientHeight) { - this.onOverflow(); - } else { - this.onUnderflow(); - } - } - - componentDidUpdate() { - this.checkOverflow(); - } - - componentDidMount() { - installBodyClassesIfNeeded(); - this._needsOverflowListener = - document.body.classList.contains("mx_scrollbar_nooverlay"); - this.checkOverflow(); } _collectContainerRef(ref) { @@ -126,9 +44,7 @@ export default class AutoHideScrollbar extends React.Component { onScroll={this.props.onScroll} onWheel={this.props.onWheel} > -
- { this.props.children } -
+ { this.props.children }
); } } diff --git a/src/components/structures/EmbeddedPage.js b/src/components/structures/EmbeddedPage.js index f854dc955f..a0a95ac6f1 100644 --- a/src/components/structures/EmbeddedPage.js +++ b/src/components/structures/EmbeddedPage.js @@ -37,6 +37,8 @@ export default class EmbeddedPage extends React.PureComponent { className: PropTypes.string, // Whether to wrap the page in a scrollbar scrollbar: PropTypes.bool, + // Map of keys to replace with values, e.g {$placeholder: "value"} + replaceMap: PropTypes.object, }; static contextType = MatrixClientContext; @@ -81,6 +83,13 @@ export default class EmbeddedPage extends React.PureComponent { } body = body.replace(/_t\(['"]([\s\S]*?)['"]\)/mg, (match, g1)=>this.translate(g1)); + + if (this.props.replaceMap) { + Object.keys(this.props.replaceMap).forEach(key => { + body = body.split(key).join(this.props.replaceMap[key]); + }); + } + this.setState({ page: body }); }, ); diff --git a/src/components/structures/IndicatorScrollbar.js b/src/components/structures/IndicatorScrollbar.js index f14d99f730..05ad4f7561 100644 --- a/src/components/structures/IndicatorScrollbar.js +++ b/src/components/structures/IndicatorScrollbar.js @@ -66,6 +66,22 @@ export default class IndicatorScrollbar extends React.Component { this._autoHideScrollbar = autoHideScrollbar; } + + componentDidUpdate(prevProps) { + const prevLen = prevProps && prevProps.children && prevProps.children.length || 0; + const curLen = this.props.children && this.props.children.length || 0; + // check overflow only if amount of children changes. + // if we don't guard here, we end up with an infinite + // render > componentDidUpdate > checkOverflow > setState > render loop + if (prevLen !== curLen) { + this.checkOverflow(); + } + } + + componentDidMount() { + this.checkOverflow(); + } + checkOverflow() { const hasTopOverflow = this._scrollElement.scrollTop > 0; const hasBottomOverflow = this._scrollElement.scrollHeight > @@ -95,10 +111,6 @@ export default class IndicatorScrollbar extends React.Component { this._scrollElement.classList.remove("mx_IndicatorScrollbar_rightOverflow"); } - if (this._autoHideScrollbar) { - this._autoHideScrollbar.checkOverflow(); - } - if (this.props.trackHorizontalOverflow) { this.setState({ // Offset from absolute position of the container diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index 52002f0591..258972d18d 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -657,6 +657,7 @@ export default createReactClass({ collapseLhs: true, }); break; + case 'focus_room_filter': // for CtrlOrCmd+K to work by expanding the left panel first case 'show_left_panel': this.setState({ collapseLhs: false, @@ -2021,7 +2022,7 @@ export default createReactClass({ } } else if (this.state.view === VIEWS.WELCOME) { const Welcome = sdk.getComponent('auth.Welcome'); - view = ; + view = ; } else if (this.state.view === VIEWS.REGISTER) { const Registration = sdk.getComponent('structures.auth.Registration'); view = ( diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 5fd5f42f78..2c9e798bd8 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -55,6 +55,7 @@ import RightPanelStore from "../../stores/RightPanelStore"; import {haveTileForEvent} from "../views/rooms/EventTile"; import RoomContext from "../../contexts/RoomContext"; import MatrixClientContext from "../../contexts/MatrixClientContext"; +import { shieldStatusForRoom } from '../../utils/ShieldUtils'; const DEBUG = false; let debuglog = function() {}; @@ -235,6 +236,11 @@ export default createReactClass({ showReadReceipts: SettingsStore.getValue("showReadReceipts", roomId), }; + if (!initial && this.state.shouldPeek && !newState.shouldPeek) { + // Stop peeking because we have joined this room now + this.context.stopPeeking(); + } + // Temporary logging to diagnose https://github.com/vector-im/riot-web/issues/4307 console.log( 'RVS update:', @@ -466,6 +472,10 @@ export default createReactClass({ RoomScrollStateStore.setScrollState(this.state.roomId, this._getScrollState()); } + if (this.state.shouldPeek) { + this.context.stopPeeking(); + } + // stop tracking room changes to format permalinks this._stopAllPermalinkCreators(); @@ -817,40 +827,9 @@ export default createReactClass({ return; } - // Duplication between here and _updateE2eStatus in RoomTile /* At this point, the user has encryption on and cross-signing on */ - const e2eMembers = await room.getEncryptionTargetMembers(); - const verified = []; - const unverified = []; - e2eMembers.map(({userId}) => userId) - .filter((userId) => userId !== this.context.getUserId()) - .forEach((userId) => { - (this.context.checkUserTrust(userId).isCrossSigningVerified() ? - verified : unverified).push(userId); - }); - - debuglog("e2e verified", verified, "unverified", unverified); - - /* Check all verified user devices. */ - /* Don't alarm if no other users are verified */ - const targets = (verified.length > 0) ? [...verified, this.context.getUserId()] : verified; - for (const userId of targets) { - const devices = await this.context.getStoredDevicesForUser(userId); - const anyDeviceNotVerified = devices.some(({deviceId}) => { - return !this.context.checkDeviceTrust(userId, deviceId).isVerified(); - }); - if (anyDeviceNotVerified) { - this.setState({ - e2eStatus: "warning", - }); - debuglog("e2e status set to warning as not all users trust all of their sessions." + - " Aborted on user", userId); - return; - } - } - this.setState({ - e2eStatus: unverified.length === 0 ? "verified" : "normal", + e2eStatus: await shieldStatusForRoom(this.context, room), }); }, diff --git a/src/components/structures/TabbedView.tsx b/src/components/structures/TabbedView.tsx index ea485acc1a..c0e0e58db8 100644 --- a/src/components/structures/TabbedView.tsx +++ b/src/components/structures/TabbedView.tsx @@ -20,6 +20,7 @@ import * as React from "react"; import {_t} from '../../languageHandler'; import * as PropTypes from "prop-types"; import * as sdk from "../../index"; +import AutoHideScrollbar from './AutoHideScrollbar'; import { ReactNode } from "react"; /** @@ -113,9 +114,9 @@ export default class TabbedView extends React.Component { private _renderTabPanel(tab: Tab): React.ReactNode { return (
-
+ {tab.body} -
+
); } diff --git a/src/components/structures/auth/CompleteSecurity.js b/src/components/structures/auth/CompleteSecurity.js index 3154564cd3..06cece0af2 100644 --- a/src/components/structures/auth/CompleteSecurity.js +++ b/src/components/structures/auth/CompleteSecurity.js @@ -18,13 +18,14 @@ import React from 'react'; import PropTypes from 'prop-types'; import { _t } from '../../../languageHandler'; import * as sdk from '../../../index'; -import { MatrixClientPeg } from '../../../MatrixClientPeg'; -import { accessSecretStorage, AccessCancelledError } from '../../../CrossSigningManager'; - -const PHASE_INTRO = 0; -const PHASE_BUSY = 1; -const PHASE_DONE = 2; -const PHASE_CONFIRM_SKIP = 3; +import { + SetupEncryptionStore, + PHASE_INTRO, + PHASE_BUSY, + PHASE_DONE, + PHASE_CONFIRM_SKIP, +} from '../../../stores/SetupEncryptionStore'; +import SetupEncryptionBody from "./SetupEncryptionBody"; export default class CompleteSecurity extends React.Component { static propTypes = { @@ -33,232 +34,42 @@ export default class CompleteSecurity extends React.Component { constructor() { super(); - - this.state = { - phase: PHASE_INTRO, - // this serves dual purpose as the object for the request logic and - // the presence of it insidicating that we're in 'verify mode'. - // Because of the latter, it lives in the state. - verificationRequest: null, - backupInfo: null, - }; - MatrixClientPeg.get().on("crypto.verification.request", this.onVerificationRequest); + const store = SetupEncryptionStore.sharedInstance(); + store.on("update", this._onStoreUpdate); + store.start(); + this.state = {phase: store.phase}; } + _onStoreUpdate = () => { + const store = SetupEncryptionStore.sharedInstance(); + this.setState({phase: store.phase}); + }; + componentWillUnmount() { - if (this.state.verificationRequest) { - this.state.verificationRequest.off("change", this.onVerificationRequestChange); - } - if (MatrixClientPeg.get()) { - MatrixClientPeg.get().removeListener("crypto.verification.request", this.onVerificationRequest); - } - } - - _onUsePassphraseClick = async () => { - this.setState({ - phase: PHASE_BUSY, - }); - const cli = MatrixClientPeg.get(); - try { - const backupInfo = await cli.getKeyBackupVersion(); - this.setState({backupInfo}); - - // The control flow is fairly twisted here... - // For the purposes of completing security, we only wait on getting - // as far as the trust check and then show a green shield. - // We also begin the key backup restore as well, which we're - // awaiting inside `accessSecretStorage` only so that it keeps your - // passphase cached for that work. This dialog itself will only wait - // on the first trust check, and the key backup restore will happen - // in the background. - await new Promise((resolve, reject) => { - try { - accessSecretStorage(async () => { - await cli.checkOwnCrossSigningTrust(); - resolve(); - if (backupInfo) { - // A complete restore can take many minutes for large - // accounts / slow servers, so we allow the dialog - // to advance before this. - await cli.restoreKeyBackupWithSecretStorage(backupInfo); - } - }); - } catch (e) { - console.error(e); - reject(e); - } - }); - - if (cli.getCrossSigningId()) { - this.setState({ - phase: PHASE_DONE, - }); - } - } catch (e) { - if (!(e instanceof AccessCancelledError)) { - console.log(e); - } - // this will throw if the user hits cancel, so ignore - this.setState({ - phase: PHASE_INTRO, - }); - } - } - - onVerificationRequest = async (request) => { - if (request.otherUserId !== MatrixClientPeg.get().getUserId()) return; - - if (this.state.verificationRequest) { - this.state.verificationRequest.off("change", this.onVerificationRequestChange); - } - await request.accept(); - request.on("change", this.onVerificationRequestChange); - this.setState({ - verificationRequest: request, - }); - } - - onVerificationRequestChange = () => { - if (this.state.verificationRequest.cancelled) { - this.state.verificationRequest.off("change", this.onVerificationRequestChange); - this.setState({ - verificationRequest: null, - }); - } - } - - onSkipClick = () => { - this.setState({ - phase: PHASE_CONFIRM_SKIP, - }); - } - - onSkipConfirmClick = () => { - this.props.onFinished(); - } - - onSkipBackClick = () => { - this.setState({ - phase: PHASE_INTRO, - }); - } - - onDoneClick = () => { - this.props.onFinished(); + const store = SetupEncryptionStore.sharedInstance(); + store.off("update", this._onStoreUpdate); + store.stop(); } render() { const AuthPage = sdk.getComponent("auth.AuthPage"); const CompleteSecurityBody = sdk.getComponent("auth.CompleteSecurityBody"); - const AccessibleButton = sdk.getComponent("elements.AccessibleButton"); - - const { - phase, - } = this.state; - + const {phase} = this.state; let icon; let title; - let body; - - if (this.state.verificationRequest) { - const EncryptionPanel = sdk.getComponent("views.right_panel.EncryptionPanel"); - body = ; - } else if (phase === PHASE_INTRO) { - const InlineSpinner = sdk.getComponent('elements.InlineSpinner'); + if (phase === PHASE_INTRO) { icon = ; title = _t("Complete security"); - body = ( -
-

{_t( - "Open an existing session & use it to verify this one, " + - "granting it access to encrypted messages.", - )}

-

{_t("Waiting…")}

-

{_t( - "If you can’t access one, ", - {}, { - button: sub => - {sub} - , - })}

-
- - {_t("Skip")} - -
-
- ); } else if (phase === PHASE_DONE) { icon = ; title = _t("Session verified"); - let message; - if (this.state.backupInfo) { - message =

{_t( - "Your new session is now verified. It has access to your " + - "encrypted messages, and other users will see it as trusted.", - )}

; - } else { - message =

{_t( - "Your new session is now verified. Other users will see it as trusted.", - )}

; - } - body = ( -
-
- {message} -
- - {_t("Done")} - -
-
- ); } else if (phase === PHASE_CONFIRM_SKIP) { icon = ; title = _t("Are you sure?"); - body = ( -
-

{_t( - "Without completing security on this session, it won’t have " + - "access to encrypted messages.", - )}

-
- - {_t("Skip")} - - - {_t("Go Back")} - -
-
- ); } else if (phase === PHASE_BUSY) { - const Spinner = sdk.getComponent('views.elements.Spinner'); icon = ; title = _t("Complete security"); - body = ; } else { throw new Error(`Unknown phase ${phase}`); } @@ -271,7 +82,7 @@ export default class CompleteSecurity extends React.Component { {title}
- {body} +
diff --git a/src/components/structures/auth/ForgotPassword.js b/src/components/structures/auth/ForgotPassword.js index e921951512..c849edf260 100644 --- a/src/components/structures/auth/ForgotPassword.js +++ b/src/components/structures/auth/ForgotPassword.js @@ -296,7 +296,6 @@ export default createReactClass({
{ + const store = SetupEncryptionStore.sharedInstance(); + if (store.phase === PHASE_FINISHED) { + this.props.onFinished(); + return; + } + this.setState({ + phase: store.phase, + verificationRequest: store.verificationRequest, + backupInfo: store.backupInfo, + }); + }; + + componentWillUnmount() { + const store = SetupEncryptionStore.sharedInstance(); + store.off("update", this._onStoreUpdate); + store.stop(); + } + + _onUsePassphraseClick = async () => { + const store = SetupEncryptionStore.sharedInstance(); + store.usePassPhrase(); + } + + onSkipClick = () => { + const store = SetupEncryptionStore.sharedInstance(); + store.skip(); + } + + onSkipConfirmClick = () => { + const store = SetupEncryptionStore.sharedInstance(); + store.skipConfirm(); + } + + onSkipBackClick = () => { + const store = SetupEncryptionStore.sharedInstance(); + store.returnAfterSkip(); + } + + onDoneClick = () => { + const store = SetupEncryptionStore.sharedInstance(); + store.done(); + } + + render() { + const AccessibleButton = sdk.getComponent("elements.AccessibleButton"); + + const { + phase, + } = this.state; + + if (this.state.verificationRequest) { + const EncryptionPanel = sdk.getComponent("views.right_panel.EncryptionPanel"); + return ; + } else if (phase === PHASE_INTRO) { + const InlineSpinner = sdk.getComponent('elements.InlineSpinner'); + return ( +
+

{_t( + "Open an existing session & use it to verify this one, " + + "granting it access to encrypted messages.", + )}

+

{_t("Waiting…")}

+

{_t( + "If you can’t access one, ", + {}, { + button: sub => + {sub} + , + })}

+
+ + {_t("Skip")} + +
+
+ ); + } else if (phase === PHASE_DONE) { + let message; + if (this.state.backupInfo) { + message =

{_t( + "Your new session is now verified. It has access to your " + + "encrypted messages, and other users will see it as trusted.", + )}

; + } else { + message =

{_t( + "Your new session is now verified. Other users will see it as trusted.", + )}

; + } + return ( +
+
+ {message} +
+ + {_t("Done")} + +
+
+ ); + } else if (phase === PHASE_CONFIRM_SKIP) { + return ( +
+

{_t( + "Without completing security on this session, it won’t have " + + "access to encrypted messages.", + )}

+
+ + {_t("Skip")} + + + {_t("Go Back")} + +
+
+ ); + } else if (phase === PHASE_BUSY) { + const Spinner = sdk.getComponent('views.elements.Spinner'); + return ; + } else { + console.log(`SetupEncryptionBody: Unknown phase ${phase}`); + } + } +} diff --git a/src/components/structures/auth/SoftLogout.js b/src/components/structures/auth/SoftLogout.js index d38fcf3883..287f7e5605 100644 --- a/src/components/structures/auth/SoftLogout.js +++ b/src/components/structures/auth/SoftLogout.js @@ -213,7 +213,6 @@ export default class SoftLogout extends React.Component {

{introText}

{error} { _t("Confirm your identity by entering your account password below.") }

- this[FIELD_EMAIL] = field} type="text" label={emailPlaceholder} @@ -524,7 +523,6 @@ export default createReactClass({ onOptionChange={this.onPhoneCountryChange} />; return this[FIELD_PHONE_NUMBER] = field} type="text" label={phoneLabel} diff --git a/src/components/views/auth/ServerConfig.js b/src/components/views/auth/ServerConfig.js index a9e26b8fb7..37517c7484 100644 --- a/src/components/views/auth/ServerConfig.js +++ b/src/components/views/auth/ServerConfig.js @@ -223,7 +223,8 @@ export default class ServerConfig extends React.PureComponent { {sub} , })} - , })} -
-
diff --git a/src/components/views/dialogs/BugReportDialog.js b/src/components/views/dialogs/BugReportDialog.js index fe95041373..6e337d53dc 100644 --- a/src/components/views/dialogs/BugReportDialog.js +++ b/src/components/views/dialogs/BugReportDialog.js @@ -166,7 +166,6 @@ export default class BugReportDialog extends React.Component { ) }

- this._aliasFieldRef = ref} onChange={this.onAliasChange} domain={domain} value={this.state.alias} /> + this._aliasFieldRef = ref} onChange={this.onAliasChange} domain={domain} value={this.state.alias} />
); } else { @@ -188,8 +188,8 @@ export default createReactClass({ >
- this._nameFieldRef = ref} label={ _t('Name') } onChange={this.onNameChange} onValidate={this.onNameValidate} value={this.state.name} className="mx_CreateRoomDialog_name" /> - + this._nameFieldRef = ref} label={ _t('Name') } onChange={this.onNameChange} onValidate={this.onNameValidate} value={this.state.name} className="mx_CreateRoomDialog_name" /> + { privateLabel } { publicLabel } diff --git a/src/components/views/dialogs/DeactivateAccountDialog.js b/src/components/views/dialogs/DeactivateAccountDialog.js index d7468933df..4c14f356e4 100644 --- a/src/components/views/dialogs/DeactivateAccountDialog.js +++ b/src/components/views/dialogs/DeactivateAccountDialog.js @@ -174,7 +174,6 @@ export default class DeactivateAccountDialog extends React.Component {

{ _t("To continue, please enter your password:") }

- {adminMessage} + + ; +} diff --git a/src/components/views/dialogs/TextInputDialog.js b/src/components/views/dialogs/TextInputDialog.js index b9f6f6ebce..b6b29f4350 100644 --- a/src/components/views/dialogs/TextInputDialog.js +++ b/src/components/views/dialogs/TextInputDialog.js @@ -116,7 +116,6 @@ export default createReactClass({
{ console.log(`Failed to get capabilities for widget type ${this.props.type}`, this.props.id, err); }); diff --git a/src/components/views/elements/EditableItemList.js b/src/components/views/elements/EditableItemList.js index 6e649e777a..50d5a3d10f 100644 --- a/src/components/views/elements/EditableItemList.js +++ b/src/components/views/elements/EditableItemList.js @@ -121,7 +121,7 @@ export default class EditableItemList extends React.Component { return ( - diff --git a/src/components/views/elements/EventListSummary.js b/src/components/views/elements/EventListSummary.js index 7a69398071..79c84293c2 100644 --- a/src/components/views/elements/EventListSummary.js +++ b/src/components/views/elements/EventListSummary.js @@ -20,6 +20,7 @@ import MemberAvatar from '../avatars/MemberAvatar'; import { _t } from '../../../languageHandler'; import {MatrixEvent, RoomMember} from "matrix-js-sdk"; import {useStateToggle} from "../../../hooks/useStateToggle"; +import AccessibleButton from "./AccessibleButton"; const EventListSummary = ({events, children, threshold=3, onToggle, startExpanded, summaryMembers=[], summaryText}) => { const [expanded, toggleExpanded] = useStateToggle(startExpanded); @@ -42,24 +43,15 @@ const EventListSummary = ({events, children, threshold=3, onToggle, startExpande ); } + let body; if (expanded) { - return ( -
-
- { _t('collapse') } -
-
 
- { children } -
- ); - } - - const avatars = summaryMembers.map((m) => ); - return ( -
-
- { _t('expand') } -
+ body = +
 
+ { children } +
; + } else { + const avatars = summaryMembers.map((m) => ); + body = (
@@ -70,6 +62,15 @@ const EventListSummary = ({events, children, threshold=3, onToggle, startExpande
+ ); + } + + return ( +
+ + { expanded ? _t('collapse') : _t('expand') } + + { body }
); }; diff --git a/src/components/views/elements/Field.js b/src/components/views/elements/Field.js index 8583c91a01..2ebb90da26 100644 --- a/src/components/views/elements/Field.js +++ b/src/components/views/elements/Field.js @@ -23,10 +23,16 @@ import { debounce } from 'lodash'; // Invoke validation from user input (when typing, etc.) at most once every N ms. const VALIDATION_THROTTLE_MS = 200; +const BASE_ID = "mx_Field"; +let count = 1; +function getId() { + return `${BASE_ID}_${count++}`; +} + export default class Field extends React.PureComponent { static propTypes = { - // The field's ID, which binds the input and label together. - id: PropTypes.string.isRequired, + // The field's ID, which binds the input and label together. Immutable. + id: PropTypes.string, // The element to create. Defaults to "input". // To define options for a select, use element: PropTypes.oneOf(["input", "select", "textarea"]), @@ -63,13 +69,15 @@ export default class Field extends React.PureComponent { // All other props pass through to the . }; - constructor() { - super(); + constructor(props) { + super(props); this.state = { valid: undefined, feedback: undefined, focused: false, }; + + this.id = this.props.id || getId(); } onFocus = (ev) => { @@ -167,6 +175,7 @@ export default class Field extends React.PureComponent { inputProps.type = inputProps.type || "text"; inputProps.ref = input => this.input = input; inputProps.placeholder = inputProps.placeholder || inputProps.label; + inputProps.id = this.id; // this overwrites the id from props inputProps.onFocus = this.onFocus; inputProps.onChange = this.onChange; @@ -211,7 +220,7 @@ export default class Field extends React.PureComponent { return
{prefixContainer} {fieldInput} - + {postfixContainer} {fieldTooltip}
; diff --git a/src/components/views/elements/PowerSelector.js b/src/components/views/elements/PowerSelector.js index 2f4c08922a..eff14979a9 100644 --- a/src/components/views/elements/PowerSelector.js +++ b/src/components/views/elements/PowerSelector.js @@ -132,7 +132,7 @@ export default createReactClass({ const label = typeof this.props.label === "undefined" ? _t("Power level") : this.props.label; if (this.state.custom) { picker = ( - @@ -151,7 +151,7 @@ export default createReactClass({ }); picker = ( - {options} diff --git a/src/components/views/elements/RoomAliasField.js b/src/components/views/elements/RoomAliasField.js index b38047cd3b..d3de6a5d34 100644 --- a/src/components/views/elements/RoomAliasField.js +++ b/src/components/views/elements/RoomAliasField.js @@ -23,7 +23,6 @@ import {MatrixClientPeg} from '../../../MatrixClientPeg'; // Controlled form component wrapping Field for inputting a room alias scoped to a given domain export default class RoomAliasField extends React.PureComponent { static propTypes = { - id: PropTypes.string.isRequired, domain: PropTypes.string.isRequired, onChange: PropTypes.func, value: PropTypes.string.isRequired, @@ -50,7 +49,6 @@ export default class RoomAliasField extends React.PureComponent { className="mx_RoomAliasField" prefix={poundSign} postfix={domain} - id={this.props.id} ref={ref => this._fieldRef = ref} onValidate={this._onValidate} placeholder={_t("e.g. my-room")} diff --git a/src/components/views/emojipicker/EmojiPicker.js b/src/components/views/emojipicker/EmojiPicker.js index ca8f0c0565..cacc15a5f9 100644 --- a/src/components/views/emojipicker/EmojiPicker.js +++ b/src/components/views/emojipicker/EmojiPicker.js @@ -22,6 +22,7 @@ import { _t } from '../../../languageHandler'; import * as recent from '../../../emojipicker/recent'; import {DATA_BY_CATEGORY, getEmojiFromUnicode} from "../../../emoji"; +import AutoHideScrollbar from "../../structures/AutoHideScrollbar"; export const CATEGORY_HEADER_HEIGHT = 22; export const EMOJI_HEIGHT = 37; @@ -214,7 +215,7 @@ class EmojiPicker extends React.Component {
-
+ this.bodyRef.current = e} onScroll={this.onScroll}> {this.categories.map(category => { const emojis = this.memoizedDataByCategory[category.id]; const categoryElement = ( + {this.state.previewEmoji || !this.props.showQuickReactions ? : } diff --git a/src/components/views/right_panel/EncryptionInfo.js b/src/components/views/right_panel/EncryptionInfo.js index bbedc9b303..610ea99511 100644 --- a/src/components/views/right_panel/EncryptionInfo.js +++ b/src/components/views/right_panel/EncryptionInfo.js @@ -28,7 +28,7 @@ export const PendingActionSpinner = ({text}) => {
; }; -const EncryptionInfo = ({waitingForOtherParty, waitingForNetwork, member, onStartVerification}) => { +const EncryptionInfo = ({waitingForOtherParty, waitingForNetwork, member, onStartVerification, isRoomEncrypted}) => { let content; if (waitingForOtherParty || waitingForNetwork) { let text; @@ -49,13 +49,27 @@ const EncryptionInfo = ({waitingForOtherParty, waitingForNetwork, member, onStar ); } - return -
-

{_t("Encryption")}

+ let description; + if (isRoomEncrypted) { + description = (

{_t("Messages in this room are end-to-end encrypted.")}

{_t("Your messages are secured and only you and the recipient have the unique keys to unlock them.")}

+ ); + } else { + description = ( +
+

{_t("Messages in this room are not end-to-end encrypted.")}

+

{_t("In encrypted rooms, your messages are secured and only you and the recipient have the unique keys to unlock them.")}

+
+ ); + } + + return +
+

{_t("Encryption")}

+ { description }

{_t("Verify User")}

diff --git a/src/components/views/right_panel/EncryptionPanel.js b/src/components/views/right_panel/EncryptionPanel.js index a14d4a2b7d..2c51662111 100644 --- a/src/components/views/right_panel/EncryptionPanel.js +++ b/src/components/views/right_panel/EncryptionPanel.js @@ -30,7 +30,8 @@ import {_t} from "../../../languageHandler"; // cancellation codes which constitute a key mismatch const MISMATCHES = ["m.key_mismatch", "m.user_error", "m.mismatched_sas"]; -const EncryptionPanel = ({verificationRequest, verificationRequestPromise, member, onClose, layout}) => { +const EncryptionPanel = (props) => { + const {verificationRequest, verificationRequestPromise, member, onClose, layout, isRoomEncrypted} = props; const [request, setRequest] = useState(verificationRequest); // state to show a spinner immediately after clicking "start verification", // before we have a request @@ -83,6 +84,22 @@ const EncryptionPanel = ({verificationRequest, verificationRequestPromise, membe }, [onClose, request]); useEventEmitter(request, "change", changeHandler); + const onCancel = useCallback(function() { + if (request) { + request.cancel(); + } + }, [request]); + + let cancelButton; + if (layout !== "dialog" && request && request.pending) { + const AccessibleButton = sdk.getComponent("elements.AccessibleButton"); + cancelButton = (); + } + const onStartVerification = useCallback(async () => { setRequesting(true); const cli = MatrixClientPeg.get(); @@ -97,21 +114,27 @@ const EncryptionPanel = ({verificationRequest, verificationRequestPromise, membe (request && (phase === PHASE_REQUESTED || phase === PHASE_UNSENT || phase === undefined)); if (!request || requested) { const initiatedByMe = (!request && isRequesting) || (request && request.initiatedByMe); - return ; + return ( + {cancelButton} + + ); } else { - return ( + return ( + {cancelButton} - ); + ); } }; EncryptionPanel.propTypes = { diff --git a/src/components/views/right_panel/UserInfo.js b/src/components/views/right_panel/UserInfo.js index 4219da690e..a2081dc9e4 100644 --- a/src/components/views/right_panel/UserInfo.js +++ b/src/components/views/right_panel/UserInfo.js @@ -68,8 +68,10 @@ export const getE2EStatus = (cli, userId, devices) => { return hasUnverifiedDevice ? "warning" : "verified"; } const isMe = userId === cli.getUserId(); - const userVerified = cli.checkUserTrust(userId).isCrossSigningVerified(); - if (!userVerified) return "normal"; + const userTrust = cli.checkUserTrust(userId); + if (!userTrust.isCrossSigningVerified()) { + return userTrust.wasCrossSigningVerified() ? "warning" : "normal"; + } const anyDeviceUnverified = devices.some(device => { const { deviceId } = device; @@ -1297,8 +1299,7 @@ const BasicUserInfo = ({room, member, groupId, devices, isRoomEncrypted}) => { const userVerified = userTrust.isCrossSigningVerified(); const isMe = member.userId === cli.getUserId(); const canVerify = SettingsStore.isFeatureEnabled("feature_cross_signing") && - homeserverSupportsCrossSigning && - isRoomEncrypted && !userVerified && !isMe; + homeserverSupportsCrossSigning && !userVerified && !isMe; const setUpdating = (updating) => { setPendingUpdateCount(count => count + (updating ? 1 : -1)); @@ -1320,20 +1321,15 @@ const BasicUserInfo = ({room, member, groupId, devices, isRoomEncrypted}) => { ); } - let devicesSection; - if (isRoomEncrypted) { - devicesSection = ; - } - const securitySection = (

{ _t("Security") }

{ text }

{ verifyButton } - { devicesSection } +
); @@ -1388,6 +1384,7 @@ const UserInfoHeader = ({onClose, member, e2eStatus}) => {
+ ); break; } diff --git a/src/components/views/right_panel/VerificationPanel.js b/src/components/views/right_panel/VerificationPanel.js index 38ee31c8b7..1cb2737005 100644 --- a/src/components/views/right_panel/VerificationPanel.js +++ b/src/components/views/right_panel/VerificationPanel.js @@ -48,6 +48,7 @@ export default class VerificationPanel extends React.PureComponent { PHASE_DONE, ]).isRequired, onClose: PropTypes.func.isRequired, + isRoomEncrypted: PropTypes.bool, }; constructor(props) { @@ -174,15 +175,22 @@ export default class VerificationPanel extends React.PureComponent { renderVerifiedPhase() { const {member} = this.props; + let text; + if (this.props.isRoomEncrypted) { + text = _t("Verify all users in a room to ensure it's secure."); + } else { + text = _t("In encrypted rooms, verify all users to ensure it’s secure."); + } + const AccessibleButton = sdk.getComponent('elements.AccessibleButton'); return (
-

Verified

+

{_t("Verified")}

{_t("You've successfully verified %(displayName)s!", { displayName: member.displayName || member.name || member.userId, })}

-

Verify all users in a room to ensure it's secure.

+

{ text }

{_t("Got it")} @@ -209,7 +217,7 @@ export default class VerificationPanel extends React.PureComponent { return (
-

Verification cancelled

+

{_t("Verification cancelled")}

{ text }

@@ -231,7 +239,7 @@ export default class VerificationPanel extends React.PureComponent { if (this.state.sasEvent) { const VerificationShowSas = sdk.getComponent('views.verification.VerificationShowSas'); return
-

Compare emoji

+

{_t("Compare emoji")}

- + { stateViews } { appsDrawer } { fileDropTarget } { callView } { conferenceCallNotification } { this.props.children } -
+ ); }, }); diff --git a/src/components/views/rooms/BasicMessageComposer.js b/src/components/views/rooms/BasicMessageComposer.js index 147f3c0af8..df62823360 100644 --- a/src/components/views/rooms/BasicMessageComposer.js +++ b/src/components/views/rooms/BasicMessageComposer.js @@ -149,14 +149,17 @@ export default class BasicMessageEditor extends React.Component { const position = selection.end || selection; this._setLastCaretFromPosition(position); } + const {isEmpty} = this.props.model; if (this.props.placeholder) { - const {isEmpty} = this.props.model; if (isEmpty) { this._showPlaceholder(); } else { this._hidePlaceholder(); } } + if (isEmpty) { + this._formatBarRef.hide(); + } this.setState({autoComplete: this.props.model.autoComplete}); this.historyManager.tryPush(this.props.model, selection, inputType, diff); TypingStore.sharedInstance().setSelfTyping(this.props.room.roomId, !this.props.model.isEmpty); @@ -444,6 +447,8 @@ export default class BasicMessageEditor extends React.Component { } else if (event.key === Key.TAB) { this._tabCompleteName(); handled = true; + } else if (event.key === Key.BACKSPACE || event.key === Key.DELETE) { + this._formatBarRef.hide(); } } if (handled) { diff --git a/src/components/views/rooms/MemberTile.js b/src/components/views/rooms/MemberTile.js index 1f1d8389b1..bf2a1bee23 100644 --- a/src/components/views/rooms/MemberTile.js +++ b/src/components/views/rooms/MemberTile.js @@ -65,6 +65,7 @@ export default createReactClass({ }); if (isRoomEncrypted) { cli.on("userTrustStatusChanged", this.onUserTrustStatusChanged); + cli.on("deviceVerificationChanged", this.onDeviceVerificationChanged); this.updateE2EStatus(); } else { // Listen for room to become encrypted @@ -88,6 +89,7 @@ export default createReactClass({ if (cli) { cli.removeListener("RoomState.events", this.onRoomStateEvents); cli.removeListener("userTrustStatusChanged", this.onUserTrustStatusChanged); + cli.removeListener("deviceVerificationChanged", this.onDeviceVerificationChanged); } }, @@ -110,14 +112,19 @@ export default createReactClass({ this.updateE2EStatus(); }, + onDeviceVerificationChanged: function(userId, deviceId, deviceInfo) { + if (userId !== this.props.member.userId) return; + this.updateE2EStatus(); + }, + updateE2EStatus: async function() { const cli = MatrixClientPeg.get(); const { userId } = this.props.member; const isMe = userId === cli.getUserId(); - const userVerified = cli.checkUserTrust(userId).isCrossSigningVerified(); - if (!userVerified) { + const userTrust = cli.checkUserTrust(userId); + if (!userTrust.isCrossSigningVerified()) { this.setState({ - e2eStatus: "normal", + e2eStatus: userTrust.wasCrossSigningVerified() ? "warning" : "normal", }); return; } diff --git a/src/components/views/rooms/MessageComposerFormatBar.js b/src/components/views/rooms/MessageComposerFormatBar.js index 79ae9f34e8..42d54f5987 100644 --- a/src/components/views/rooms/MessageComposerFormatBar.js +++ b/src/components/views/rooms/MessageComposerFormatBar.js @@ -19,12 +19,13 @@ import PropTypes from 'prop-types'; import { _t } from '../../../languageHandler'; import * as sdk from '../../../index'; import classNames from 'classnames'; +import AccessibleButton from "../elements/AccessibleButton"; export default class MessageComposerFormatBar extends React.PureComponent { static propTypes = { onAction: PropTypes.func.isRequired, shortcuts: PropTypes.object.isRequired, - } + }; constructor(props) { super(props); @@ -64,7 +65,7 @@ class FormatButton extends React.PureComponent { icon: PropTypes.string.isRequired, shortcut: PropTypes.string, visible: PropTypes.bool, - } + }; render() { const InteractiveTooltip = sdk.getComponent('elements.InteractiveTooltip'); @@ -82,11 +83,12 @@ class FormatButton extends React.PureComponent { return ( - - + ); } diff --git a/src/components/views/rooms/RoomTile.js b/src/components/views/rooms/RoomTile.js index 0f44f5077a..0c913b32da 100644 --- a/src/components/views/rooms/RoomTile.js +++ b/src/components/views/rooms/RoomTile.js @@ -37,6 +37,7 @@ import E2EIcon from './E2EIcon'; import InviteOnlyIcon from './InviteOnlyIcon'; // eslint-disable-next-line camelcase import rate_limited_func from '../../../ratelimitedfunc'; +import { shieldStatusForRoom } from '../../../utils/ShieldUtils'; export default createReactClass({ displayName: 'RoomTile', @@ -154,35 +155,9 @@ export default createReactClass({ return; } - // Duplication between here and _updateE2eStatus in RoomView - const e2eMembers = await this.props.room.getEncryptionTargetMembers(); - const verified = []; - const unverified = []; - e2eMembers.map(({userId}) => userId) - .filter((userId) => userId !== cli.getUserId()) - .forEach((userId) => { - (cli.checkUserTrust(userId).isCrossSigningVerified() ? - verified : unverified).push(userId); - }); - - /* Check all verified user devices. */ - /* Don't alarm if no other users are verified */ - const targets = (verified.length > 0) ? [...verified, cli.getUserId()] : verified; - for (const userId of targets) { - const devices = await cli.getStoredDevicesForUser(userId); - const allDevicesVerified = devices.every(({deviceId}) => { - return cli.checkDeviceTrust(userId, deviceId).isVerified(); - }); - if (!allDevicesVerified) { - this.setState({ - e2eStatus: "warning", - }); - return; - } - } - + /* At this point, the user has encryption on and cross-signing on */ this.setState({ - e2eStatus: unverified.length === 0 ? "verified" : "normal", + e2eStatus: await shieldStatusForRoom(cli, this.props.room), }); }, diff --git a/src/components/views/rooms/SendMessageComposer.js b/src/components/views/rooms/SendMessageComposer.js index 90c37780fe..d87d99dc46 100644 --- a/src/components/views/rooms/SendMessageComposer.js +++ b/src/components/views/rooms/SendMessageComposer.js @@ -131,8 +131,13 @@ export default class SendMessageComposer extends React.Component { this.onVerticalArrow(event, false); } else if (this._prepareToEncrypt) { this._prepareToEncrypt(); + } else if (event.key === Key.ESCAPE) { + dis.dispatch({ + action: 'reply_to_event', + event: null, + }); } - } + }; onVerticalArrow(e, up) { // arrows from an initial-caret composer navigates recent messages to edit diff --git a/src/components/views/settings/ChangePassword.js b/src/components/views/settings/ChangePassword.js index b51ff6cf9d..6607458b40 100644 --- a/src/components/views/settings/ChangePassword.js +++ b/src/components/views/settings/ChangePassword.js @@ -235,7 +235,7 @@ export default createReactClass({ if (!this.state.cachedPassword) { currentPassword = (
-
{ + _bootstrapSecureSecretStorage = async (forceReset=false) => { this.setState({ error: null }); try { - await accessSecretStorage(() => undefined, force); + await accessSecretStorage(() => undefined, forceReset); } catch (e) { this.setState({ error: e }); console.error("Error bootstrapping secret storage", e); @@ -130,6 +140,9 @@ export default class CrossSigningPanel extends React.PureComponent { error, crossSigningPublicKeysOnDevice, crossSigningPrivateKeysInStorage, + selfSigningPrivateKeyCached, + userSigningPrivateKeyCached, + sessionBackupKeyCached, secretStorageKeyInAccount, homeserverSupportsCrossSigning, crossSigningReady, @@ -209,6 +222,18 @@ export default class CrossSigningPanel extends React.PureComponent { {_t("Cross-signing private keys:")} {crossSigningPrivateKeysInStorage ? _t("in secret storage") : _t("not found")} + + {_t("Self signing private key:")} + {selfSigningPrivateKeyCached ? _t("cached locally") : _t("not found locally")} + + + {_t("User signing private key:")} + {userSigningPrivateKeyCached ? _t("cached locally") : _t("not found locally")} + + + {_t("Session backup key:")} + {sessionBackupKeyCached ? _t("cached locally") : _t("not found locally")} + {_t("Secret storage public key:")} {secretStorageKeyInAccount ? _t("in account data") : _t("not found")} diff --git a/src/components/views/settings/E2eAdvancedPanel.js b/src/components/views/settings/E2eAdvancedPanel.js new file mode 100644 index 0000000000..709465bcb0 --- /dev/null +++ b/src/components/views/settings/E2eAdvancedPanel.js @@ -0,0 +1,39 @@ +/* +Copyright 2020 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 * as sdk from '../../../index'; +import {_t} from "../../../languageHandler"; +import {SettingLevel} from "../../../settings/SettingsStore"; + +const SETTING_MANUALLY_VERIFY_ALL_SESSIONS = "e2ee.manuallyVerifyAllSessions"; + +const E2eAdvancedPanel = props => { + const SettingsFlag = sdk.getComponent('views.elements.SettingsFlag'); + return
+ {_t("Advanced")} + + +
{_t( + "Individually verify each session used by a user to mark it as trusted, not trusting cross-signed devices.", + )}
+
; +}; + +export default E2eAdvancedPanel; diff --git a/src/components/views/settings/ProfileSettings.js b/src/components/views/settings/ProfileSettings.js index 72dfe7a983..23ab60423a 100644 --- a/src/components/views/settings/ProfileSettings.js +++ b/src/components/views/settings/ProfileSettings.js @@ -153,7 +153,7 @@ export default class ProfileSettings extends React.Component { {this.state.userId} {hostingSignup}

-
diff --git a/src/components/views/settings/SetIdServer.js b/src/components/views/settings/SetIdServer.js index 995959dc90..cb37271452 100644 --- a/src/components/views/settings/SetIdServer.js +++ b/src/components/views/settings/SetIdServer.js @@ -403,8 +403,8 @@ export default class SetIdServer extends React.Component { {bodyText} - - -
- - {_t("Theme")} {systemThemeSection} - diff --git a/src/components/views/settings/tabs/user/MjolnirUserSettingsTab.js b/src/components/views/settings/tabs/user/MjolnirUserSettingsTab.js index 7f3a2c401d..d22b7ec183 100644 --- a/src/components/views/settings/tabs/user/MjolnirUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/MjolnirUserSettingsTab.js @@ -272,7 +272,6 @@ export default class MjolnirUserSettingsTab extends React.Component {
{_t("Security & Privacy")}
@@ -311,6 +313,7 @@ export default class SecurityUserSettingsTab extends React.Component {
{this._renderIgnoredUsers()} {this._renderManageInvites()} +
); } diff --git a/src/components/views/settings/tabs/user/VoiceUserSettingsTab.js b/src/components/views/settings/tabs/user/VoiceUserSettingsTab.js index f4fbcada3a..71ed2bab65 100644 --- a/src/components/views/settings/tabs/user/VoiceUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/VoiceUserSettingsTab.js @@ -163,7 +163,7 @@ export default class VoiceUserSettingsTab extends React.Component { if (audioOutputs.length > 0) { const defaultDevice = getDefaultDevice(audioOutputs); speakerDropdown = ( - {this._renderDeviceOptions(audioOutputs, 'audioOutput')} @@ -175,7 +175,7 @@ export default class VoiceUserSettingsTab extends React.Component { if (audioInputs.length > 0) { const defaultDevice = getDefaultDevice(audioInputs); microphoneDropdown = ( - {this._renderDeviceOptions(audioInputs, 'audioInput')} @@ -187,7 +187,7 @@ export default class VoiceUserSettingsTab extends React.Component { if (videoInputs.length > 0) { const defaultDevice = getDefaultDevice(videoInputs); webcamDropdown = ( - {this._renderDeviceOptions(videoInputs, 'videoInput')} diff --git a/src/components/views/toasts/SetupEncryptionToast.js b/src/components/views/toasts/SetupEncryptionToast.js index 9016e4c6d7..6e2df12658 100644 --- a/src/components/views/toasts/SetupEncryptionToast.js +++ b/src/components/views/toasts/SetupEncryptionToast.js @@ -16,23 +16,61 @@ limitations under the License. import React from 'react'; import PropTypes from 'prop-types'; +import Modal from '../../../Modal'; +import { MatrixClientPeg } from '../../../MatrixClientPeg'; import * as sdk from "../../../index"; import { _t } from '../../../languageHandler'; import DeviceListener from '../../../DeviceListener'; +import SetupEncryptionDialog from "../dialogs/SetupEncryptionDialog"; import { accessSecretStorage } from '../../../CrossSigningManager'; export default class SetupEncryptionToast extends React.PureComponent { static propTypes = { toastKey: PropTypes.string.isRequired, - kind: PropTypes.oneOf(['set_up_encryption', 'verify_this_session', 'upgrade_encryption']).isRequired, + kind: PropTypes.oneOf([ + 'set_up_encryption', + 'verify_this_session', + 'upgrade_encryption', + 'upgrade_ssss', + ]).isRequired, }; _onLaterClick = () => { DeviceListener.sharedInstance().dismissEncryptionSetup(); }; + async _waitForCompletion() { + if (this.props.kind === 'upgrade_ssss') { + return new Promise(resolve => { + const recheck = async () => { + const needsUpgrade = await MatrixClientPeg.get().secretStorageKeyNeedsUpgrade(); + if (!needsUpgrade) { + MatrixClientPeg.get().removeListener('accountData', recheck); + resolve(); + } + }; + MatrixClientPeg.get().on('accountData', recheck); + recheck(); + }); + } else { + return; + } + } + _onSetupClick = async () => { - accessSecretStorage(); + if (this.props.kind === "verify_this_session") { + Modal.createTrackedDialog('Verify session', 'Verify session', SetupEncryptionDialog, + {}, null, /* priority = */ false, /* static = */ true); + } else { + const Spinner = sdk.getComponent("elements.Spinner"); + const modal = Modal.createDialog(Spinner, null, 'mx_Dialog_spinner'); + try { + await accessSecretStorage(); + await this._waitForCompletion(); + } finally { + modal.close(); + } + } }; getDescription() { @@ -42,6 +80,8 @@ export default class SetupEncryptionToast extends React.PureComponent { return _t('Verify yourself & others to keep your chats safe'); case 'verify_this_session': return _t('Other users may not trust it'); + case 'upgrade_ssss': + return _t('Update your secure storage'); } } @@ -49,6 +89,7 @@ export default class SetupEncryptionToast extends React.PureComponent { switch (this.props.kind) { case 'set_up_encryption': case 'upgrade_encryption': + case 'upgrade_ssss': return _t('Upgrade'); case 'verify_this_session': return _t('Verify'); diff --git a/src/createRoom.js b/src/createRoom.js index 45e849065d..66d4d1908e 100644 --- a/src/createRoom.js +++ b/src/createRoom.js @@ -174,6 +174,9 @@ export function findDMForUser(client, userId) { return member && (member.membership === "invite" || member.membership === "join"); } return false; + }).sort((r1, r2) => { + return r2.getLastActiveTimestamp() - + r1.getLastActiveTimestamp(); }); if (suitableDMRooms.length) { return suitableDMRooms[0]; diff --git a/src/i18n/strings/de_DE.json b/src/i18n/strings/de_DE.json index 2eb24c29bf..9565299b8d 100644 --- a/src/i18n/strings/de_DE.json +++ b/src/i18n/strings/de_DE.json @@ -701,7 +701,7 @@ "Failed to remove tag %(tagName)s from room": "Fehler beim Entfernen des \"%(tagName)s\"-Tags von dem Raum", "Failed to add tag %(tagName)s to room": "Fehler beim Hinzufügen des \"%(tagName)s\"-Tags an dem Raum", "Did you know: you can use communities to filter your Riot.im experience!": "Wusstest du: Du kannst Communities nutzen um deine Riot.im-Erfahrung zu filtern!", - "To set up a filter, drag a community avatar over to the filter panel on the far left hand side of the screen. You can click on an avatar in the filter panel at any time to see only the rooms and people associated with that community.": "Um einen Filter zu setzen, siehe einen Community-Bild auf das Filter-Panel ganz links. Du kannst jederzeit auf einen Avatar im Filter-Panel klicken um nur die Räume und Personen aus der Community zu sehen.", + "To set up a filter, drag a community avatar over to the filter panel on the far left hand side of the screen. You can click on an avatar in the filter panel at any time to see only the rooms and people associated with that community.": "Um einen Filter zu setzen, ziehe ein Community-Bild auf das Filter-Panel ganz links. Du kannst jederzeit auf einen Avatar im Filter-Panel klicken um nur die Räume und Personen aus der Community zu sehen.", "Clear filter": "Filter zurücksetzen", "Key request sent.": "Schlüssel-Anfragen gesendet.", "If you've submitted a bug via GitHub, debug logs can help us track down the problem. Debug logs contain application usage data including your username, the IDs or aliases of the rooms or groups you have visited and the usernames of other users. They do not contain messages.": "Wenn du einen Fehler via GitHub gemeldet hast, können Fehlerberichte uns helfen um das Problem zu finden. Sie enthalten Anwendungsdaten wie deinen Nutzernamen, Raum- und Gruppen-ID's und Aliase die du besucht hast und Nutzernamen anderer Nutzer. Sie enthalten keine Nachrichten.", @@ -1733,5 +1733,11 @@ "%(senderName)s created a rule banning users matching %(glob)s for %(reason)s": "%(senderName)s erstellte eine Ausschluss-Regel für Nutzer, die wegen %(reason)s %(glob)s entspricht", "%(senderName)s created a rule banning rooms matching %(glob)s for %(reason)s": "%(senderName)s erstellte eine Ausschluss-Regel für Räume, die wegen %(reason)s %(glob)s entspricht", "%(senderName)s created a rule banning servers matching %(glob)s for %(reason)s": "%(senderName)s erstellte eine Ausschluss-Regel für Server, die aufgrund von %(reason)s %(glob)s entsprechen", - "%(senderName)s created a ban rule matching %(glob)s for %(reason)s": "%(senderName)s erstellt eine Ausschluss-Regel, die aufgrund von %(reason)s %(glob)s entsprechen" + "%(senderName)s created a ban rule matching %(glob)s for %(reason)s": "%(senderName)s erstellt eine Ausschluss-Regel, die aufgrund von %(reason)s %(glob)s entsprechen", + "Do you want to chat with %(user)s?": "Möchtest du mit %(user)s chatten?", + " wants to chat": " möchte mit dir chatten", + "Start chatting": "Chat starten", + "Reject & Ignore user": "Ablehnen & Nutzer ignorieren", + "%(senderName)s changed a rule that was banning users matching %(oldGlob)s to matching %(newGlob)s for %(reason)s": "%(senderName)s ändert eine Ausschluss-Regel von %(oldGlob)s nach %(newGlob)s, wegen %(reason)s", + "%(senderName)s changed a rule that was banning rooms matching %(oldGlob)s to matching %(newGlob)s for %(reason)s": "%(senderName)s ändert eine Ausschluss-Regel für Räume von %(oldGlob)s nach %(newGlob)s, wegen %(reason)s" } diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 57b39309b0..20ac0c2bb1 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -96,7 +96,7 @@ "Verify this session": "Verify this session", "Encryption upgrade available": "Encryption upgrade available", "Set up encryption": "Set up encryption", - "Unverified session": "Unverified session", + "Unverified login. Was this you?": "Unverified login. Was this you?", "Who would you like to add to this community?": "Who would you like to add to this community?", "Warning: any person you add to a community will be publicly visible to anyone who knows the community ID": "Warning: any person you add to a community will be publicly visible to anyone who knows the community ID", "Invite new community members": "Invite new community members", @@ -153,6 +153,7 @@ "Usage": "Usage", "Prepends ¯\\_(ツ)_/¯ to a plain-text message": "Prepends ¯\\_(ツ)_/¯ to a plain-text message", "Sends a message as plain text, without interpreting it as markdown": "Sends a message as plain text, without interpreting it as markdown", + "Sends a message as html, without interpreting it as markdown": "Sends a message as html, without interpreting it as markdown", "Searches DuckDuckGo for results": "Searches DuckDuckGo for results", "/ddg is not a command": "/ddg is not a command", "To use it, just wait for autocomplete results to load and tab through them.": "To use it, just wait for autocomplete results to load and tab through them.", @@ -432,6 +433,7 @@ "Enable message search in encrypted rooms": "Enable message search in encrypted rooms", "Keep secret storage passphrase in memory for this session": "Keep secret storage passphrase in memory for this session", "How fast should messages be downloaded.": "How fast should messages be downloaded.", + "Manually verify all remote sessions": "Manually verify all remote sessions", "Collecting app version information": "Collecting app version information", "Collecting logs": "Collecting logs", "Uploading report": "Uploading report", @@ -543,6 +545,7 @@ "Pin": "Pin", "Verify yourself & others to keep your chats safe": "Verify yourself & others to keep your chats safe", "Other users may not trust it": "Other users may not trust it", + "Update your secure storage": "Update your secure storage", "Upgrade": "Upgrade", "Verify": "Verify", "Later": "Later", @@ -582,6 +585,11 @@ "not found": "not found", "Cross-signing private keys:": "Cross-signing private keys:", "in secret storage": "in secret storage", + "Self signing private key:": "Self signing private key:", + "cached locally": "cached locally", + "not found locally": "not found locally", + "User signing private key:": "User signing private key:", + "Session backup key:": "Session backup key:", "Secret storage public key:": "Secret storage public key:", "in account data": "in account data", "Homeserver feature support:": "Homeserver feature support:", @@ -598,6 +606,7 @@ "Public Name": "Public Name", "Last seen": "Last seen", "Failed to set display name": "Failed to set display name", + "Individually verify each session used by a user to mark it as trusted, not trusting cross-signed devices.": "Individually verify each session used by a user to mark it as trusted, not trusting cross-signed devices.", "Disable Notifications": "Disable Notifications", "Enable Notifications": "Enable Notifications", "Securely cache encrypted messages locally for them to appear in search results, using ": "Securely cache encrypted messages locally for them to appear in search results, using ", @@ -1195,6 +1204,8 @@ "Start Verification": "Start Verification", "Messages in this room are end-to-end encrypted.": "Messages in this room are end-to-end encrypted.", "Your messages are secured and only you and the recipient have the unique keys to unlock them.": "Your messages are secured and only you and the recipient have the unique keys to unlock them.", + "Messages in this room are not end-to-end encrypted.": "Messages in this room are not end-to-end encrypted.", + "In encrypted rooms, your messages are secured and only you and the recipient have the unique keys to unlock them.": "In encrypted rooms, your messages are secured and only you and the recipient have the unique keys to unlock them.", "Verify User": "Verify User", "For extra security, verify this user by checking a one-time code on both of your devices.": "For extra security, verify this user by checking a one-time code on both of your devices.", "Your messages are not secure": "Your messages are not secure", @@ -1221,7 +1232,6 @@ "Failed to remove user from community": "Failed to remove user from community", "%(role)s in %(roomName)s": "%(role)s in %(roomName)s", "This client does not support end-to-end encryption.": "This client does not support end-to-end encryption.", - "Messages in this room are not end-to-end encrypted.": "Messages in this room are not end-to-end encrypted.", "Security": "Security", "The session you are trying to verify doesn't support scanning a QR code or emoji verification, which is what Riot supports. Try with a different client.": "The session you are trying to verify doesn't support scanning a QR code or emoji verification, which is what Riot supports. Try with a different client.", "Verify by scanning": "Verify by scanning", @@ -1229,11 +1239,16 @@ "Verify by emoji": "Verify by emoji", "If you can't scan the code above, verify by comparing unique emoji.": "If you can't scan the code above, verify by comparing unique emoji.", "Verify by comparing unique emoji.": "Verify by comparing unique emoji.", + "Verify all users in a room to ensure it's secure.": "Verify all users in a room to ensure it's secure.", + "In encrypted rooms, verify all users to ensure it’s secure.": "In encrypted rooms, verify all users to ensure it’s secure.", + "Verified": "Verified", "You've successfully verified %(displayName)s!": "You've successfully verified %(displayName)s!", "Got it": "Got it", "Verification timed out. Start verification again from their profile.": "Verification timed out. Start verification again from their profile.", "%(displayName)s cancelled verification. Start verification again from their profile.": "%(displayName)s cancelled verification. Start verification again from their profile.", "You cancelled verification. Start verification again from their profile.": "You cancelled verification. Start verification again from their profile.", + "Verification cancelled": "Verification cancelled", + "Compare emoji": "Compare emoji", "Sunday": "Sunday", "Monday": "Monday", "Tuesday": "Tuesday", @@ -1866,6 +1881,7 @@ "Find other public servers or use a custom server": "Find other public servers or use a custom server", "Sign in to your Matrix account on %(serverName)s": "Sign in to your Matrix account on %(serverName)s", "Sign in to your Matrix account on ": "Sign in to your Matrix account on ", + "Sign in with SSO": "Sign in with SSO", "Sorry, your browser is not able to run Riot.": "Sorry, your browser is not able to run Riot.", "Riot uses many advanced browser features, some of which are not available or experimental in your current browser.": "Riot uses many advanced browser features, some of which are not available or experimental in your current browser.", "Please install Chrome, Firefox, or Safari for the best experience.": "Please install Chrome, Firefox, or Safari for the best experience.", @@ -2006,14 +2022,7 @@ "Uploading %(filename)s and %(count)s others|one": "Uploading %(filename)s and %(count)s other", "Could not load user profile": "Could not load user profile", "Complete security": "Complete security", - "Open an existing session & use it to verify this one, granting it access to encrypted messages.": "Open an existing session & use it to verify this one, granting it access to encrypted messages.", - "Waiting…": "Waiting…", - "If you can’t access one, ": "If you can’t access one, ", "Session verified": "Session verified", - "Your new session is now verified. It has access to your encrypted messages, and other users will see it as trusted.": "Your new session is now verified. It has access to your encrypted messages, and other users will see it as trusted.", - "Your new session is now verified. Other users will see it as trusted.": "Your new session is now verified. Other users will see it as trusted.", - "Without completing security on this session, it won’t have access to encrypted messages.": "Without completing security on this session, it won’t have access to encrypted messages.", - "Go Back": "Go Back", "Failed to send email": "Failed to send email", "The email address linked to your account must be entered.": "The email address linked to your account must be entered.", "A new password must be entered.": "A new password must be entered.", @@ -2063,6 +2072,13 @@ "You can now close this window or log in to your new account.": "You can now close this window or log in to your new account.", "Registration Successful": "Registration Successful", "Create your account": "Create your account", + "Open an existing session & use it to verify this one, granting it access to encrypted messages.": "Open an existing session & use it to verify this one, granting it access to encrypted messages.", + "Waiting…": "Waiting…", + "If you can’t access one, ": "If you can’t access one, ", + "Your new session is now verified. It has access to your encrypted messages, and other users will see it as trusted.": "Your new session is now verified. It has access to your encrypted messages, and other users will see it as trusted.", + "Your new session is now verified. Other users will see it as trusted.": "Your new session is now verified. Other users will see it as trusted.", + "Without completing security on this session, it won’t have access to encrypted messages.": "Without completing security on this session, it won’t have access to encrypted messages.", + "Go Back": "Go Back", "Failed to re-authenticate due to a homeserver problem": "Failed to re-authenticate due to a homeserver problem", "Failed to re-authenticate": "Failed to re-authenticate", "Regain access to your account and recover encryption keys stored in this session. Without them, you won’t be able to read all of your secure messages in any session.": "Regain access to your account and recover encryption keys stored in this session. Without them, you won’t be able to read all of your secure messages in any session.", @@ -2202,6 +2218,7 @@ "Navigate recent messages to edit": "Navigate recent messages to edit", "Jump to start/end of the composer": "Jump to start/end of the composer", "Navigate composer history": "Navigate composer history", + "Cancel replying to a message": "Cancel replying to a message", "Toggle microphone mute": "Toggle microphone mute", "Toggle video on/off": "Toggle video on/off", "Jump to room search": "Jump to room search", diff --git a/src/i18n/strings/eo.json b/src/i18n/strings/eo.json index 4849862f99..f4bb6ec244 100644 --- a/src/i18n/strings/eo.json +++ b/src/i18n/strings/eo.json @@ -111,7 +111,7 @@ "Someone": "Iu", "(not supported by this browser)": "(nesubtenata de tiu ĉi foliumilo)", "%(senderName)s answered the call.": "%(senderName)s akceptis la vokon.", - "(could not connect media)": "(aŭdvidaĵoj ne kunigeblis)", + "(could not connect media)": "(ne povis kunigi aŭdovidaĵojn)", "(no answer)": "(sen respondo)", "(unknown failure: %(reason)s)": "(nekonata eraro: %(reason)s)", "%(senderName)s ended the call.": "%(senderName)s finis la vokon.", @@ -2210,5 +2210,69 @@ "Matrix rooms": "Ĉambroj de Matrix", "Open an existing session & use it to verify this one, granting it access to encrypted messages.": "Malfermi jaman salutaĵon kaj kontroli ĉi tiun per ĝi, permesante al ĝi aliron al ĉifritaj mesaĝoj.", "Waiting…": "Atendante…", - "If you can’t access one, ": "Se vi ne povas iun atingi, " + "If you can’t access one, ": "Se vi ne povas iun atingi, ", + "Manually Verify by Text": "Permane kontroli tekste", + "Interactively verify by Emoji": "Interage kontroli bildosigne", + "Self signing private key:": "Memsubskriba privata ŝlosilo", + "cached locally": "kaŝmemorita loke", + "not found locally": "ne trovita loke", + "User signing private key:": "Uzantosubskriba privata ŝlosilo:", + "Secret Storage key format:": "Ŝlosila formo de sekreta deponejo:", + "outdated": "eksdata", + "up to date": "ĝisdata", + "Keyboard Shortcuts": "Klavkombinoj", + "Start a conversation with someone using their name, username (like ) or email address.": "Komencu interparolon kun iu per ĝia nomo, uzantonomo (kiel ), aŭ retpoŝtadreso.", + "a new master key signature": "nova ĉefŝlosila subskribo", + "a new cross-signing key signature": "nova transire subskriba ŝlosila subskribo", + "a device cross-signing signature": "aparata transire subskriba ŝlosila subskribo", + "a key signature": "ŝlosila subskribo", + "Riot encountered an error during upload of:": "Riot eraris dum alŝuto de:", + "Upload completed": "Alŝuto finiĝis", + "Cancelled signature upload": "Alŝuto de subskribo nuliĝis", + "Unabled to upload": "Ne povas alŝuti", + "Signature upload success": "Alŝuto de subskribo sukcesis", + "Signature upload failed": "Alŝuto de subskribo malsukcesis", + "Confirm by comparing the following with the User Settings in your other session:": "Konfirmu per komparo de la sekva kun la agardoj de uzanto en via alia salutaĵo:", + "Confirm this user's session by comparing the following with their User Settings:": "Konfirmu la salutaĵon de ĉi tiu uzanto per komparo de la sekva kun ĝiaj agordoj de uzanto", + "If they don't match, the security of your communication may be compromised.": "Se ili ne akordas, la sekureco de via komunikado eble estas rompita.", + "Navigation": "Navigado", + "Calls": "Vokoj", + "Room List": "Listo de ĉambroj", + "Autocomplete": "Memkompletigo", + "Alt": "Alt-klavo", + "Alt Gr": "Alt-Gr-klavo", + "Shift": "Majuskliga klavo", + "Super": "Super-klavo", + "Ctrl": "Stir-klavo", + "Toggle Bold": "Ŝalti grason", + "Toggle Italics": "Ŝalti kursivon", + "Toggle Quote": "Ŝalti citaĵon", + "New line": "Nova linio", + "Navigate recent messages to edit": "Navigi freŝajn mesaĝojn redaktotajn", + "Jump to start/end of the composer": "Salti al komenco/fino de la komponilo", + "Navigate composer history": "Navigi historion de la komponilo", + "Toggle microphone mute": "Baskuligi silentigon de mikrofono", + "Toggle video on/off": "Baskuligi filmojn", + "Jump to room search": "Salti al serĉo de ĉambroj", + "Navigate up/down in the room list": "Navigi supren/malsupren en la listo de ĉambroj", + "Select room from the room list": "Elekti ĉambron el la listo de ĉambroj", + "Collapse room list section": "Maletendi parton kun listo de ĉambroj", + "Expand room list section": "Etendi parton kun listo de ĉambroj", + "Clear room list filter field": "Vakigi filtrilon de la listo de ĉambroj", + "Scroll up/down in the timeline": "Rulumi supren/suben en la historio", + "Previous/next unread room or DM": "Antaŭa/sekva nelegita ĉambro", + "Previous/next room or DM": "Antaŭa/sekva ĉambro", + "Toggle the top left menu": "Baskuligi la supran maldekstran menuon", + "Close dialog or context menu": "Fermi interagujon aŭ kuntekstan menuon", + "Activate selected button": "Aktivigi la elektitan butonon", + "Toggle right panel": "Baskuligi la dekstran panelon", + "Toggle this dialog": "Baskuligi ĉi tiun interagujon", + "Move autocomplete selection up/down": "Movi memkompletigan elekton supren/suben", + "Cancel autocomplete": "Nuligi memkompletigon", + "Page Up": "Paĝosupren-klavo", + "Page Down": "Paĝosuben-klavo", + "Esc": "Eskapa klavo", + "Enter": "Eniga klavo", + "Space": "Spaco", + "End": "Finen-klavo" } diff --git a/src/i18n/strings/fr.json b/src/i18n/strings/fr.json index 258d9950b5..941fd209f2 100644 --- a/src/i18n/strings/fr.json +++ b/src/i18n/strings/fr.json @@ -2288,5 +2288,8 @@ "Navigate composer history": "Explorer l’historique du compositeur", "Previous/next unread room or DM": "Salon ou message direct non lu précédent/suivant", "Previous/next room or DM": "Salon ou message direct précédent/suivant", - "Toggle right panel": "Afficher/masquer le panneau de droite" + "Toggle right panel": "Afficher/masquer le panneau de droite", + "Secret Storage key format:": "Format de clé du coffre secret :", + "outdated": "obsolète", + "up to date": "à jour" } diff --git a/src/i18n/strings/hu.json b/src/i18n/strings/hu.json index d1e7aeebe7..7e78c367f7 100644 --- a/src/i18n/strings/hu.json +++ b/src/i18n/strings/hu.json @@ -2199,5 +2199,32 @@ "Error downloading theme information.": "A téma információk letöltése sikertelen.", "Theme added!": "Téma hozzáadva!", "Custom theme URL": "Egyedi téma URL", - "Add theme": "Téma hozzáadása" + "Add theme": "Téma hozzáadása", + "Review Sessions": "Munkamenetek átnézése", + "Manually Verify by Text": "Manuális szöveges ellenőrzés", + "Interactively verify by Emoji": "Közös ellenőrzés Emodzsival", + "Self signing private key:": "Titkos önaláíró kulcs:", + "cached locally": "helyben gyorsítótárazott", + "not found locally": "helyben nem található", + "User signing private key:": "Titkos felhasználó aláíró kulcs:", + "Secret Storage key format:": "Biztonsági tároló kulcs formátum:", + "outdated": "lejárt", + "up to date": "friss", + "Keyboard Shortcuts": "Billentyűzet kombinációk", + "Scroll to most recent messages": "A legfrissebb üzenethez görget", + "Local address": "Helyi cím", + "Published Addresses": "Nyilvánosságra hozott cím", + "Other published addresses:": "Másik nyilvánosságra hozott cím:", + "No other published addresses yet, add one below": "Nincs másik nyilvánosságra hozott cím, alább adj hozzá egyet", + "New published address (e.g. #alias:server)": "Új nyilvános cím (pl.: #becenév:szerver)", + "Local Addresses": "Helyi címek", + "Enter a server name": "Add meg a szerver nevét", + "Looks good": "Jól néz ki", + "Can't find this server or its room list": "A szerver vagy a szoba listája nem található", + "All rooms": "Minden szoba", + "Your server": "Matrix szervered", + "Are you sure you want to remove %(serverName)s": "Biztos, hogy törölni szeretnéd: %(serverName)s", + "Remove server": "Szerver törlése", + "Matrix": "Matrix", + "Add a new server": "Új szerver hozzáadása" } diff --git a/src/i18n/strings/it.json b/src/i18n/strings/it.json index a18aa8f760..4829d4cf7a 100644 --- a/src/i18n/strings/it.json +++ b/src/i18n/strings/it.json @@ -2276,5 +2276,17 @@ "Esc": "Esc", "Enter": "Invio", "Space": "Barra spaziatrice", - "End": "Fine" + "End": "Fine", + "Manually Verify by Text": "Verifica manualmente con testo", + "Interactively verify by Emoji": "Verifica interattivamente con emoji", + "Secret Storage key format:": "Formato chiave di archivio segreto:", + "outdated": "non aggiornato", + "up to date": "aggiornato", + "Confirm by comparing the following with the User Settings in your other session:": "Conferma confrontando il seguente con le impostazioni utente nell'altra sessione:", + "Confirm this user's session by comparing the following with their User Settings:": "Conferma questa sessione confrontando il seguente con le sue impostazioni utente:", + "If they don't match, the security of your communication may be compromised.": "Se non corrispondono, la sicurezza delle tue comunicazioni potrebbe essere compromessa.", + "Navigate composer history": "Naviga cronologia compositore", + "Previous/next unread room or DM": "Stanza o msg non letti successivi/precedenti", + "Previous/next room or DM": "Stanza o msg successivi/precedenti", + "Toggle right panel": "Apri/chiudi pannello a destra" } diff --git a/src/i18n/strings/sq.json b/src/i18n/strings/sq.json index 0dc35005ce..543b5fadb3 100644 --- a/src/i18n/strings/sq.json +++ b/src/i18n/strings/sq.json @@ -2265,5 +2265,20 @@ "Esc": "Esc", "Enter": "Enter", "Space": "Space", - "End": "End" + "End": "End", + "Manually Verify by Text": "Verifikojeni Dorazi përmes Teksti", + "Interactively verify by Emoji": "Verifikojeni në mënyrë ndërvepruese përmes Emoji-sh", + "Secret Storage key format:": "Format kyçesh Depozite të Fshehtë:", + "outdated": "e vjetruar", + "up to date": "e përditësuar", + "Start a conversation with someone using their name, username (like ) or email address.": "Nisni një bisedë me dikë duke përdorur emrin e tij, emrin e përdoruesit për të (bie fjala, ) ose adresë email.", + "Confirm by comparing the following with the User Settings in your other session:": "Ripohojeni duke krahasuar sa vijon me Rregullimet e Përdoruesit te sesioni juaj tjetër:", + "Confirm this user's session by comparing the following with their User Settings:": "Ripohojeni këtë sesion përdoruesi duke krahasuar sa vijon me Rregullimet e tij të Përdoruesit:", + "If they don't match, the security of your communication may be compromised.": "Nëse s’përputhen, siguria e komunikimeve tuaja mund të jetë komprometuar.", + "Super": "Super", + "Navigate composer history": "Lëvizni nëpër historikun e hartuesit", + "Toggle video on/off": "Aktivizoni/çaktivizoni videon", + "Previous/next unread room or DM": "Dhoma ose MD i palexuar i mëparshëm/pasues", + "Previous/next room or DM": "Dhoma ose MD i mëparshëm/pasues", + "Toggle right panel": "Hap/mbyll panelin djathtas" } diff --git a/src/i18n/strings/tr.json b/src/i18n/strings/tr.json index 4728cdd319..7b5a0ac3ec 100644 --- a/src/i18n/strings/tr.json +++ b/src/i18n/strings/tr.json @@ -81,7 +81,7 @@ "Direct chats": "Doğrudan Sohbetler", "Disable Notifications": "Bildirimleri Devre Dışı Bırak", "Disinvite": "Daveti İptal Et", - "Displays action": "Görünür eylem", + "Displays action": "Eylemi görüntüler", "Download %(text)s": "%(text)s metnini indir", "Drop File Here": "Dosyayı Buraya Bırak", "Ed25519 fingerprint": "Ed25519 parmak izi", @@ -117,7 +117,7 @@ "Failed to toggle moderator status": "Moderatör durumunu değiştirmek başarısız oldu", "Failed to unban": "Yasağı kaldırmak başarısız oldu", "Failed to upload profile picture!": "Profil resmi yükleme başarısız oldu!", - "Failed to verify email address: make sure you clicked the link in the email": "E-posta adresini doğrulama başarısız : e-postadaki bağlantıya tıkladığınızdan emin olun", + "Failed to verify email address: make sure you clicked the link in the email": "Eposta adresini doğrulamadı: epostadaki bağlantıya tıkladığınızdan emin olun", "Failure to create room": "Oda oluşturulamadı", "Favourite": "Favori", "Favourites": "Favoriler", @@ -249,7 +249,7 @@ "Submit": "Gönder", "Success": "Başarılı", "The phone number entered looks invalid": "Girilen telefon numarası geçersiz görünüyor", - "This email address is already in use": "Bu e-posta adresi zaten kullanımda", + "This email address is already in use": "Bu eposta adresi zaten kullanımda", "This email address was not found": "Bu e-posta adresi bulunamadı", "The email address linked to your account must be entered.": "Hesabınıza bağlı e-posta adresi girilmelidir.", "The remote side failed to pick up": "Uzak taraf toplanamadı(alınamadı)", @@ -538,15 +538,15 @@ "View Source": "Kaynağı Görüntüle", "With your current browser, the look and feel of the application may be completely incorrect, and some or all features may not function. If you want to try it anyway you can continue, but you are on your own in terms of any issues you may encounter!": "Geçerli tarayıcınız ile birlikte , uygulamanın görünüş ve kullanım hissi tamamen hatalı olabilir ve bazı ya da tüm özellikler çalışmayabilir. Yine de denemek isterseniz devam edebilirsiniz ancak karşılaşabileceğiniz sorunlar karşısında kendi başınasınız !", "There are advanced notifications which are not shown here": "Burada gösterilmeyen gelişmiş bildirimler var", - "The platform you're on": "Bulunduğun platform", + "The platform you're on": "Platformunuz", "The version of Riot.im": "Riot.im'in sürümü", - "Your language of choice": "Dil seçeneği", - "Which officially provided instance you are using, if any": "Hangi resmi destekli örneği(eğer varsa) kullanmaktasınız", - "Add Email Address": "E-posta Adresi Ekle", + "Your language of choice": "Dil seçiminiz", + "Which officially provided instance you are using, if any": "Hangi resmi destekli platformu kullanmaktasınız (eğer varsa)", + "Add Email Address": "Eposta Adresi Ekle", "Add Phone Number": "Telefon Numarası Ekle", "Your identity server's URL": "Kimlik sunucunuzun linki", "e.g. %(exampleValue)s": "örn.%(exampleValue)s", - "Every page you use in the app": "uygulamadaki kullandığınız tüm sayfalar", + "Every page you use in the app": "Uygulamadaki kullandığınız tüm sayfalar", "e.g. ": "örn. ", "Your User Agent": "Kullanıcı Ajanınız", "Your device resolution": "Cihazınızın çözünürlüğü", @@ -602,7 +602,7 @@ "%(names)s and %(count)s others are typing …|one": "%(names)s ve bir diğeri yazıyor…", "%(names)s and %(lastPerson)s are typing …": "%(names)s ve %(lastPerson)s yazıyor…", "Cannot reach homeserver": "Ana sunucuya erişilemiyor", - "Your Riot is misconfigured": "Rioutunuz hatalı yapılandırılmış", + "Your Riot is misconfigured": "Riot hatalı ayarlanmış", "Cannot reach identity server": "Kimlik sunucu erişilemiyor", "No homeserver URL provided": "Ana sunucu adresi belirtilmemiş", "Unexpected error resolving homeserver configuration": "Ana sunucu yapılandırması çözümlenirken beklenmeyen hata", @@ -643,7 +643,7 @@ "Power level": "Güç düzeyi", "e.g. my-room": "örn. odam", "Some characters not allowed": "Bazı karakterlere izin verilmiyor", - "Matrix ID": "Matrix ID", + "Matrix ID": "Matrix Kimliği", "Matrix Room ID": "Matrix Oda ID", "email address": "e-posta adresi", "That doesn't look like a valid email address": "Geçerli bir e-posta adresi gibi gözükmüyor", @@ -839,7 +839,7 @@ "Set a new password": "Yeni bir şifre belirle", "General failure": "Genel başarısızlık", "This homeserver does not support login using email address.": "Bu ana sunucu e-posta adresiyle oturum açmayı desteklemiyor.", - "This account has been deactivated.": "Bu hesap pasifleştirilmiş.", + "This account has been deactivated.": "Hesap devre dışı bırakıldı.", "Create account": "Yeni hesap", "Unable to query for supported registration methods.": "Desteklenen kayıt yöntemleri için sorgulama yapılamıyor.", "Continue with previous account": "Önceki hesapla devam et", @@ -848,8 +848,8 @@ "Create your account": "Hesabınızı oluşturun", "Forgotten your password?": "Parolanızı mı unuttunuz?", "Sign in and regain access to your account.": "Oturum açın ve yeniden hesabınıza ulaşın.", - "Whether or not you're logged in (we don't record your username)": "İster oturum açın yasa açmayın (biz kullanıcı adınızı kaydetmiyoruz)", - "Whether or not you're using the Richtext mode of the Rich Text Editor": "Zengin Metin Düzenleyicinin Zengin metin modunu kullanıyor ya da kullanmıyorsunuz", + "Whether or not you're logged in (we don't record your username)": "İster oturum açın yada açmayın (biz kullanıcı adınızı kaydetmiyoruz)", + "Whether or not you're using the Richtext mode of the Rich Text Editor": "Zengin Metin Düzenleyicisinin Zengin metin modunu kullanıyor ya da kullanmıyorsunuz", "Your homeserver's URL": "Ana sunucunuzun URL’i", "The information being sent to us to help make Riot.im better includes:": "Riot.im i daha iyi yapmamıza yardımcı olacak bize gönderdiğiniz bilgilerin içeriği:", "Try using turn.matrix.org": "turn.matrix.org i kullanarak dene", @@ -983,7 +983,7 @@ "Cat": "Kedi", "Lion": "Aslan", "Horse": "At", - "Unicorn": "Tek boynuzlu at", + "Unicorn": "Midilli", "Pig": "Domuz", "Elephant": "Fil", "Rabbit": "Tavşan", @@ -1230,7 +1230,7 @@ "Failed to copy": "Kopyalama başarısız", "edited": "düzenlendi", "Message removed by %(userId)s": "Mesaj %(userId)s tarafından silindi", - "You are still sharing your personal data on the identity server .": "Kimlik sunucusu üzerinde hala kişisel veri paylaşımı yapıyorsunuz.", + "You are still sharing your personal data on the identity server .": "Kimlik sunucusu üzerinde hala kişisel veri paylaşımı yapıyorsunuz \n.", "We recommend that you remove your email addresses and phone numbers from the identity server before disconnecting.": "Kimlik sunucusundan bağlantıyı kesmeden önce telefon numaranızı ve e-posta adreslerinizi silmenizi tavsiye ederiz.", "Set a new account password...": "Yeni bir hesap parolası belirle...", "Deactivating your account is a permanent action - be careful!": "Hesabınızı pasifleştirmek bir kalıcı eylemdir - dikkat edin!", @@ -1363,7 +1363,7 @@ "Members only (since the point in time of selecting this option)": "Sadece üyeler ( bu seçeneği seçtiğinizden itibaren)", "Unable to revoke sharing for email address": "E-posta adresi paylaşımı kaldırılamadı", "Unable to revoke sharing for phone number": "Telefon numarası paylaşımı kaldırılamıyor", - "Where this page includes identifiable information, such as a room, user or group ID, that data is removed before being sent to the server.": "Bu sayfadaki oda, kullanıcı veya grup ID si gibi betimleyici bilgiler sunucuya gönderilmeden önce silindi.", + "Where this page includes identifiable information, such as a room, user or group ID, that data is removed before being sent to the server.": "Bu sayfadaki oda, kullanıcı veya grup kimliği gibi betimleyici bilgiler sunucuya gönderilmeden önce silindi.", "Please ask the administrator of your homeserver (%(homeserverDomain)s) to configure a TURN server in order for calls to work reliably.": "Çağrıların sağlıklı bir şekide yapılabilmesi için lütfen anasunucunuzun (%(homeserverDomain)s) yöneticisinden bir TURN sunucusu yapılandırmasını isteyin.", "%(severalUsers)schanged their name %(count)s times|other": "%(severalUsers)s kullanıcıları isimlerini %(count)s kez değiştirdiler", "%(oneUser)schanged their name %(count)s times|other": "%(oneUser)s ismini %(count)s kez değiştirdi", @@ -1538,7 +1538,7 @@ "Some sessions for this user are not trusted": "Bu kullanıcı için bazı oturumlar güvenilir değil", "All sessions for this user are trusted": "Bu kullanıcı için tüm oturumlar güvenilir", "The version of Riot": "Riot sürümü", - "Your user agent": "Kullanıcı ajanınız", + "Your user agent": "Kullanıcı aracınız", "If you cancel now, you won't complete verifying the other user.": "Şimdi iptal ederseniz, diğer kullanıcıyı doğrulamayı tamamlamış olmayacaksınız.", "If you cancel now, you won't complete verifying your other session.": "Şimdi iptal ederseniz, diğer oturumu doğrulamış olmayacaksınız.", "Setting up keys": "Anahtarları ayarla", @@ -1752,5 +1752,79 @@ "Failed to re-authenticate due to a homeserver problem": "Anasunucu problemi yüzünden yeniden kimlik doğrulama başarısız", "Failed to re-authenticate": "Yeniden kimlik doğrulama başarısız", "A new recovery passphrase and key for Secure Messages have been detected.": "Yeni bir kurtarma parolası ve Güvenli Mesajlar için anahtar tespit edildi.", - "Not currently indexing messages for any room.": "Şu an hiç bir odada mesaj indeksleme yapılmıyor." + "Not currently indexing messages for any room.": "Şu an hiç bir odada mesaj indeksleme yapılmıyor.", + "Whether you're using Riot on a device where touch is the primary input mechanism": "Riot'u ana giriş yöntemi dokunma olan bir cihazda kullanıyor olsanızda", + "Whether or not you're using the 'breadcrumbs' feature (avatars above the room list)": "'Breadcrumbs' özelliğini kullanıp kullanmadığınız (oda listesi üzerinde avatarlar)", + "Whether you're using Riot as an installed Progressive Web App": "Riot'u gelişmiş web uygulaması olarak yükleyip yüklemediğinizi", + "The information being sent to us to help make Riot better includes:": "Riot'u geliştirmemizde bize yardım etmek için gönderdiğiniz bilgiler şunları içeriyor:", + "A call is currently being placed!": "Bir çağrı şu anda başlatılıyor!", + "At this time it is not possible to reply with a file. Would you like to upload this file without replying?": "Şu anda dosya ile birlikte mesaj yollamak mümkün değil. Dosyayı mesajsız yüklemek ister misiniz?", + "PM": "24:00", + "AM": "12:00", + "This action requires accessing the default identity server to validate an email address or phone number, but the server does not have any terms of service.": "Bu eylem, bir e-posta adresini veya telefon numarasını doğrulamak için varsayılan kimlik sunucusuna erişilmesini gerektirir, ancak sunucunun herhangi bir hizmet şartı yoktur.", + "Sends a message as plain text, without interpreting it as markdown": "Mesajı markdown kullanmadan basit metin olarak iletir", + "Use an identity server to invite by email. Click continue to use the default identity server (%(defaultIdentityServerName)s) or manage in Settings.": "E-posta ile davet etmek için kimlik sunucusu kullan. Varsayılan kimlik sunucusunu (%(defaultIdentityServerName)s) kullanmak için devam edin ya da ayarlardan değiştirin.", + "Unignored user": "Reddedilmemiş kullanıcı", + "WARNING: KEY VERIFICATION FAILED! The signing key for %(userId)s and session %(deviceId)s is \"%(fprint)s\" which does not match the provided key \"%(fingerprint)s\". This could mean your communications are being intercepted!": "UYARI: ANAHTAR DOĞRULAMASI BAŞARISIZ! %(userld)s'nin/nın %(deviceld)s oturumu için imza anahtarı \"%(fprint)s\" verilen anahtar ile uyumsuz \"%(fingerprint)s\". Bu iletişiminizin engellendiği anlamına gelebilir!", + "The signing key you provided matches the signing key you received from %(userId)s's session %(deviceId)s. Session marked as verified.": "Verilen imza anahtarı %(userld)s'nin/nın %(deviceld)s oturumundan gelen anahtar ile uyumlu. Oturum doğrulanmış olarak işaretlendi.", + "Forces the current outbound group session in an encrypted room to be discarded": "Şifreli bir odadaki geçerli giden grup oturumunun atılmasını zorlar", + "%(senderDisplayName)s changed the room name from %(oldRoomName)s to %(newRoomName)s.": "%(senderDisplayName)s oda ismini %(oldRoomName)s bununla değiştirdi %(newRoomName)s.", + "%(senderDisplayName)s enabled flair for %(groups)s in this room.": "%(senderDisplayName)s bu odada %(groups)s için etiketleri etkinleştirdi.", + "%(senderDisplayName)s disabled flair for %(groups)s in this room.": "%(senderDisplayName)s bu odada %(groups)s için etiketleri devre dışı bıraktı.", + "%(senderDisplayName)s enabled flair for %(newGroups)s and disabled flair for %(oldGroups)s in this room.": "%(senderDisplayName)s bu odada etiketleri %(newGroups)s için etkinleştirdi ve %(oldGroups)s için devre dışı bıraktı.", + "%(senderName)s added the alternative addresses %(addresses)s for this room.|one": "%(senderName)s bu oda için alternatif adres %(addresses)s ekledi.", + "%(senderName)s removed the alternative addresses %(addresses)s for this room.|other": "%(senderName)s bu oda için alternatif adresleri %(addresses)s sildi.", + "%(senderName)s removed the alternative addresses %(addresses)s for this room.|one": "%(senderName)s bu oda için alternatif adresi %(addresses)s sildi.", + "%(senderName)s revoked the invitation for %(targetDisplayName)s to join the room.": "%(senderName)s, %(targetDisplayName)s'nin odaya katılması için daveti iptal etti.", + "%(senderName)s removed the rule banning users matching %(glob)s": "%(senderName)s %(glob)s ile eşleşen kullanıcıları banlama kuralını kaldırdı", + "%(senderName)s removed the rule banning rooms matching %(glob)s": "%(senderName)s %(glob)s ile eşleşen odaları banlama kuralını kaldırdı", + "%(senderName)s removed the rule banning servers matching %(glob)s": "%(senderName)s %(glob)s ile eşleşen sunucuları banlama kuralını kaldırdı", + "%(senderName)s removed a ban rule matching %(glob)s": "%(senderName)s %(glob)s ile eşleşen banlama kuralını kaldırdı", + "%(senderName)s updated the rule banning users matching %(glob)s for %(reason)s": "%(senderName)s %(glob)s ile eşleşen kullanıcıları banlama kuralını bu sebepten dolayı güncelledi %(reason)s", + "%(senderName)s updated the rule banning rooms matching %(glob)s for %(reason)s": "%(senderName)s %(glob)s ile eşleşen odaları banlama kuralını bu sebepten dolayı güncelledi %(reason)s", + "%(senderName)s updated the rule banning servers matching %(glob)s for %(reason)s": "%(senderName)s %(glob)s ile eşleşen sunucuları banlama kuralını bu sebepten dolayı güncelledi %(reason)s", + "%(senderName)s changed a rule that was banning users matching %(oldGlob)s to matching %(newGlob)s for %(reason)s": "%(senderName)s %(oldGlob)s ile eşleşen kullanıcıları banlama kuralını %(newGlob)s ile eşleşen olarak değiştirdi sebebi %(reason)s", + "%(senderName)s changed a rule that was banning rooms matching %(oldGlob)s to matching %(newGlob)s for %(reason)s": "%(senderName)s %(oldGlob)s ile eşleşen odaları banlama kuralını %(newGlob)s ile eşleşen olarak değiştirdi sebebi %(reason)s", + "%(senderName)s changed a rule that was banning servers matching %(oldGlob)s to matching %(newGlob)s for %(reason)s": "%(senderName)s %(oldGlob)s ile eşleşen sunucuları banlama kuralını %(newGlob)s ile eşleşen olarak değiştirdi sebebi %(reason)s", + "%(senderName)s updated a ban rule that was matching %(oldGlob)s to matching %(newGlob)s for %(reason)s": "%(senderName)s %(oldGlob)s ile eşleşen banlama kuralını %(newGlob)s ile eşleşen olarak değiştirdi sebebi %(reason)s", + "%(name)s (%(userId)s) signed in to a new session without verifying it:": "%(name)s (%(userId)s) yeni oturuma doğrulamadan giriş yaptı:", + "Ask this user to verify their session, or manually verify it below.": "Kullanıcıya oturumunu doğrulamasını söyle, ya da aşağıdan doğrula.", + "Manually Verify by Text": "Metin ile Doğrula", + "Interactively verify by Emoji": "Emoji ile etkileşimli olarak doğrula", + "Use a longer keyboard pattern with more turns": "Daha karmaşık ve uzun bir klavye deseni kullan", + "Predictable substitutions like '@' instead of 'a' don't help very much": "Tahmin edilebilir harf değişimleri örneğin 'a' yerine '@' pek yardımcı olmuyor", + "A word by itself is easy to guess": "Kelime zaten kolay tahmin edilir", + "Straight rows of keys are easy to guess": "Aynı klavye satırındaki ardışık tuşlar kolay tahmin edilir", + "Short keyboard patterns are easy to guess": "Kısa klavye desenleri kolay tahmin edilir", + "Show a presence dot next to DMs in the room list": "Oda listesinde DM'lerin yanında varlık noktası göster", + "Support adding custom themes": "Özel tema eklemeyi destekle", + "Enable cross-signing to verify per-user instead of per-session (in development)": "Oturum başına doğrulamak yerine kullanıcı başına doğrulama yapmak için çapraz giriş yapmayı etkinleştir (geliştirmede)", + "Show padlocks on invite only rooms": "Sadece davetle girilen odalarda kilit işareti göster", + "Show read receipts sent by other users": "Diğer kullanıcılar tarafından gönderilen okundu bilgisini göster", + "Show a reminder to enable Secure Message Recovery in encrypted rooms": "Şifrelenmiş odalarda güvenli mesaj kurtarmayı etkinleştirmek için hatırlatıcı göster", + "Enable automatic language detection for syntax highlighting": "Sözdizimi vurgularken otomatik dil algılamayı etkinleştir", + "Show avatars in user and room mentions": "Kullanıcı veya odadan bahsedilirken avatarlarını göster", + "Automatically replace plain text Emoji": "Düz metini otomatik olarak emoji ile değiştir", + "Never send encrypted messages to unverified sessions from this session": "Şifreli mesajları asla bu oturumdaki doğrulanmamış oturumlara iletme", + "Never send encrypted messages to unverified sessions in this room from this session": "Şifreli mesajları asla oturumdaki bu odadaki doğrulanmamış oturumlara iletme", + "Prompt before sending invites to potentially invalid matrix IDs": "Potansiyel olarak geçersiz matrix kimliği olanlara davet gönderirken uyarı ver", + "Show shortcuts to recently viewed rooms above the room list": "Oda listesinin üzerinde en son kullanılan odaları göster", + "Secret Storage key format:": "Sır Depolama anahtar biçemi:", + "Error downloading theme information.": "Tema bilgisi indirilirken hata.", + "Theme added!": "Tema eklendi!", + "Add theme": "Tema ekle", + "Keyboard Shortcuts": "Klavye Kısayolları", + "%(count)s unread messages including mentions.|other": "anmalar dahil okunmayan %(count)s mesaj.", + "Local address": "Yerel adres", + "Local Addresses": "Yerel Adresler", + "Yours, or the other users’ session": "Sizin yada diğer kullanıcıların oturumları", + "Trusted": "Güvenilir", + "Not trusted": "Güvenilir değil", + "Hide sessions": "Oturumları gizle", + "Verify by scanning": "Taramayla doğrula", + "Verify by emoji": "Emojiyle doğrula", + "Verify by comparing unique emoji.": "Eşsiz emoji eşleştirme ile doğrulama.", + "Edited at %(date)s. Click to view edits.": "%(date)s tarihinde düzenlendi. Düzenlemeleri görmek için tıkla.", + "Failed to load group members": "Grup üyeleri yüklenirken başarısız", + "Visibility in Room List": "Oda Listesindeki Görünürlük" } diff --git a/src/i18n/strings/zh_Hant.json b/src/i18n/strings/zh_Hant.json index 6c60acc60f..eb4f94172e 100644 --- a/src/i18n/strings/zh_Hant.json +++ b/src/i18n/strings/zh_Hant.json @@ -2287,5 +2287,12 @@ "Navigate composer history": "瀏覽編輯區歷史紀錄", "Previous/next unread room or DM": "上一下/下一個未讀聊天室或直接訊息", "Previous/next room or DM": "上一個/下一個聊天室或直接訊息", - "Toggle right panel": "切換右側面板" + "Toggle right panel": "切換右側面板", + "Secret Storage key format:": "秘密儲存金鑰格式:", + "outdated": "太舊了", + "up to date": "已為最新", + "Self signing private key:": "自行簽章私鑰:", + "cached locally": "本機快取", + "not found locally": "在本機找不到", + "User signing private key:": "使用者簽章私鑰:" } diff --git a/src/indexing/EventIndex.js b/src/indexing/EventIndex.js index 9e27451a78..14257af014 100644 --- a/src/indexing/EventIndex.js +++ b/src/indexing/EventIndex.js @@ -469,6 +469,9 @@ export default class EventIndex extends EventEmitter { // decryption keys, do we want to retry this checkpoint at a later // stage? const filteredEvents = matrixEvents.filter(this.isValidEvent); + const undecryptableEvents = matrixEvents.filter((ev) => { + return ev.isDecryptionFailure(); + }); // Collect the redaction events so we can delete the redacted events // from the index. @@ -503,7 +506,10 @@ export default class EventIndex extends EventEmitter { console.log( "EventIndex: Crawled room", client.getRoom(checkpoint.roomId).name, - "and fetched", events.length, "events.", + "and fetched total", matrixEvents.length, "events of which", + events.length, "are being added,", redactionEvents.length, + "are redacted,", matrixEvents.length - events.length, + "are being skipped, undecryptable", undecryptableEvents.length, ); try { diff --git a/src/linkify-matrix.js b/src/linkify-matrix.js index cff7a93d08..ee9f703136 100644 --- a/src/linkify-matrix.js +++ b/src/linkify-matrix.js @@ -200,13 +200,17 @@ matrixLinkify.options = { switch (type) { case "url": { // intercept local permalinks to users and show them like userids (in userinfo of current room) - const permalink = parsePermalink(href); - if (permalink && permalink.userId) { - return { - click: function(e) { - matrixLinkify.onUserClick(e, permalink.userId); - }, - }; + try { + const permalink = parsePermalink(href); + if (permalink && permalink.userId) { + return { + click: function(e) { + matrixLinkify.onUserClick(e, permalink.userId); + }, + }; + } + } catch (e) { + // OK fine, it's not actually a permalink } break; } diff --git a/src/rageshake/submit-rageshake.js b/src/rageshake/submit-rageshake.js index 53e9f24788..00ef87f89c 100644 --- a/src/rageshake/submit-rageshake.js +++ b/src/rageshake/submit-rageshake.js @@ -118,6 +118,10 @@ export default async function sendBugReport(bugReportEndpoint, opts) { try { body.append("storageManager_persisted", await navigator.storage.persisted()); } catch (e) {} + } else if (document.hasStorageAccess) { // Safari + try { + body.append("storageManager_persisted", await document.hasStorageAccess()); + } catch (e) {} } if (navigator.storage && navigator.storage.estimate) { try { diff --git a/src/settings/Settings.js b/src/settings/Settings.js index 461761dfa2..0d72017878 100644 --- a/src/settings/Settings.js +++ b/src/settings/Settings.js @@ -16,6 +16,8 @@ See the License for the specific language governing permissions and limitations under the License. */ +import {MatrixClient} from 'matrix-js-sdk'; + import {_td} from '../languageHandler'; import { AudioNotificationsEnabledController, @@ -24,6 +26,7 @@ import { } from "./controllers/NotificationControllers"; import CustomStatusController from "./controllers/CustomStatusController"; import ThemeController from './controllers/ThemeController'; +import PushToMatrixClientController from './controllers/PushToMatrixClientController'; import ReloadOnChangeController from "./controllers/ReloadOnChangeController"; import {RIGHT_PANEL_PHASES} from "../stores/RightPanelStorePhases"; @@ -525,4 +528,12 @@ export const SETTINGS = { supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS_WITH_CONFIG, default: true, }, + "e2ee.manuallyVerifyAllSessions": { + supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS, + displayName: _td("Manually verify all remote sessions"), + default: false, + controller: new PushToMatrixClientController( + MatrixClient.prototype.setCryptoTrustCrossSignedDevices, true, + ), + }, }; diff --git a/src/settings/controllers/PushToMatrixClientController.js b/src/settings/controllers/PushToMatrixClientController.js new file mode 100644 index 0000000000..b7c285227f --- /dev/null +++ b/src/settings/controllers/PushToMatrixClientController.js @@ -0,0 +1,37 @@ +/* +Copyright 2020 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 { MatrixClientPeg } from '../../MatrixClientPeg'; + +/** + * When the value changes, call a setter function on the matrix client with the new value + */ +export default class PushToMatrixClientController { + constructor(setter, inverse) { + this._setter = setter; + this._inverse = inverse; + } + + getValueOverride(level, roomId, calculatedValue, calculatedAtLevel) { + return null; // no override + } + + onChange(level, roomId, newValue) { + // XXX does this work? This surely isn't necessarily the effective value, + // but it's what NotificationsEnabledController does... + this._setter.call(MatrixClientPeg.get(), this._inverse ? !newValue : newValue); + } +} diff --git a/src/stores/RightPanelStore.js b/src/stores/RightPanelStore.js index 814f54b454..8869d0be42 100644 --- a/src/stores/RightPanelStore.js +++ b/src/stores/RightPanelStore.js @@ -15,6 +15,7 @@ limitations under the License. */ import dis from '../dispatcher'; +import {pendingVerificationRequestForUser} from '../verification'; import {Store} from 'flux/utils'; import SettingsStore, {SettingLevel} from "../settings/SettingsStore"; import {RIGHT_PANEL_PHASES, RIGHT_PANEL_PHASES_NO_ARGS} from "./RightPanelStorePhases"; @@ -135,7 +136,20 @@ export default class RightPanelStore extends Store { break; case 'set_right_panel_phase': { - const targetPhase = payload.phase; + let targetPhase = payload.phase; + let refireParams = payload.refireParams; + // redirect to EncryptionPanel if there is an ongoing verification request + if (targetPhase === RIGHT_PANEL_PHASES.RoomMemberInfo) { + const {member} = payload.refireParams; + const pendingRequest = pendingVerificationRequestForUser(member); + if (pendingRequest) { + targetPhase = RIGHT_PANEL_PHASES.EncryptionPanel; + refireParams = { + verificationRequest: pendingRequest, + member, + }; + } + } if (!RIGHT_PANEL_PHASES[targetPhase]) { console.warn(`Tried to switch right panel to unknown phase: ${targetPhase}`); return; @@ -153,7 +167,7 @@ export default class RightPanelStore extends Store { }); } } else { - if (targetPhase === this._state.lastRoomPhase && !payload.refireParams) { + if (targetPhase === this._state.lastRoomPhase && !refireParams) { this._setState({ showRoomPanel: !this._state.showRoomPanel, }); @@ -161,7 +175,7 @@ export default class RightPanelStore extends Store { this._setState({ lastRoomPhase: targetPhase, showRoomPanel: true, - lastRoomPhaseParams: payload.refireParams || {}, + lastRoomPhaseParams: refireParams || {}, }); } } @@ -170,7 +184,7 @@ export default class RightPanelStore extends Store { dis.dispatch({ action: 'after_right_panel_phase_change', phase: targetPhase, - ...(payload.refireParams || {}), + ...(refireParams || {}), }); break; } diff --git a/src/stores/RoomViewStore.js b/src/stores/RoomViewStore.js index 64dfd56b2f..b32e088a76 100644 --- a/src/stores/RoomViewStore.js +++ b/src/stores/RoomViewStore.js @@ -123,6 +123,9 @@ class RoomViewStore extends Store { case 'join_room_error': this._joinRoomError(payload); break; + case 'join_room_ready': + this._setState({ shouldPeek: false }); + break; case 'on_client_not_viable': case 'on_logged_out': this.reset(); @@ -259,11 +262,10 @@ class RoomViewStore extends Store { MatrixClientPeg.get().joinRoom( this._state.roomAlias || this._state.roomId, payload.opts, ).then(() => { - // We don't actually need to do anything here: we do *not* - // clear the 'joining' flag because the Room object and/or - // our 'joined' member event may not have come down the sync - // stream yet, and that's the point at which we'd consider - // the user joined to the room. + // We do *not* clear the 'joining' flag because the Room object and/or our 'joined' member event may not + // have come down the sync stream yet, and that's the point at which we'd consider the user joined to the + // room. + dis.dispatch({ action: 'join_room_ready' }); }, (err) => { dis.dispatch({ action: 'join_room_error', diff --git a/src/stores/SetupEncryptionStore.js b/src/stores/SetupEncryptionStore.js new file mode 100644 index 0000000000..7b42e1552d --- /dev/null +++ b/src/stores/SetupEncryptionStore.js @@ -0,0 +1,144 @@ +/* +Copyright 2020 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 EventEmitter from 'events'; +import { MatrixClientPeg } from '../MatrixClientPeg'; +import { accessSecretStorage, AccessCancelledError } from '../CrossSigningManager'; + +export const PHASE_INTRO = 0; +export const PHASE_BUSY = 1; +export const PHASE_DONE = 2; //final done stage, but still showing UX +export const PHASE_CONFIRM_SKIP = 3; +export const PHASE_FINISHED = 4; //UX can be closed + +export class SetupEncryptionStore extends EventEmitter { + static sharedInstance() { + if (!global.mx_SetupEncryptionStore) global.mx_SetupEncryptionStore = new SetupEncryptionStore(); + return global.mx_SetupEncryptionStore; + } + + start() { + if (this._started) { + return; + } + this._started = true; + this.phase = PHASE_INTRO; + this.verificationRequest = null; + this.backupInfo = null; + MatrixClientPeg.get().on("crypto.verification.request", this.onVerificationRequest); + } + + stop() { + if (!this._started) { + return; + } + this._started = false; + if (this.verificationRequest) { + this.verificationRequest.off("change", this.onVerificationRequestChange); + } + if (MatrixClientPeg.get()) { + MatrixClientPeg.get().removeListener("crypto.verification.request", this.onVerificationRequest); + } + } + + async usePassPhrase() { + this.phase = PHASE_BUSY; + this.emit("update"); + const cli = MatrixClientPeg.get(); + try { + const backupInfo = await cli.getKeyBackupVersion(); + this.backupInfo = backupInfo; + this.emit("update"); + // The control flow is fairly twisted here... + // For the purposes of completing security, we only wait on getting + // as far as the trust check and then show a green shield. + // We also begin the key backup restore as well, which we're + // awaiting inside `accessSecretStorage` only so that it keeps your + // passphase cached for that work. This dialog itself will only wait + // on the first trust check, and the key backup restore will happen + // in the background. + await new Promise((resolve, reject) => { + try { + accessSecretStorage(async () => { + await cli.checkOwnCrossSigningTrust(); + resolve(); + if (backupInfo) { + // A complete restore can take many minutes for large + // accounts / slow servers, so we allow the dialog + // to advance before this. + await cli.restoreKeyBackupWithSecretStorage(backupInfo); + } + }).catch(reject); + } catch (e) { + console.error(e); + reject(e); + } + }); + + if (cli.getCrossSigningId()) { + this.phase = PHASE_DONE; + this.emit("update"); + } + } catch (e) { + if (!(e instanceof AccessCancelledError)) { + console.log(e); + } + // this will throw if the user hits cancel, so ignore + this.phase = PHASE_INTRO; + this.emit("update"); + } + } + + onVerificationRequest = async (request) => { + if (request.otherUserId !== MatrixClientPeg.get().getUserId()) return; + + if (this.verificationRequest) { + this.verificationRequest.off("change", this.onVerificationRequestChange); + } + this.verificationRequest = request; + await request.accept(); + request.on("change", this.onVerificationRequestChange); + this.emit("update"); + } + + onVerificationRequestChange = () => { + if (this.verificationRequest.cancelled) { + this.verificationRequest.off("change", this.onVerificationRequestChange); + this.verificationRequest = null; + this.emit("update"); + } + } + + skip() { + this.phase = PHASE_CONFIRM_SKIP; + this.emit("update"); + } + + skipConfirm() { + this.phase = PHASE_FINISHED; + this.emit("update"); + } + + returnAfterSkip() { + this.phase = PHASE_INTRO; + this.emit("update"); + } + + done() { + this.phase = PHASE_FINISHED; + this.emit("update"); + } +} diff --git a/src/utils/ShieldUtils.ts b/src/utils/ShieldUtils.ts new file mode 100644 index 0000000000..9bf6fe2327 --- /dev/null +++ b/src/utils/ShieldUtils.ts @@ -0,0 +1,58 @@ +import DMRoomMap from './DMRoomMap'; + +/* For now, a cut-down type spec for the client */ +interface Client { + getUserId: () => string; + checkUserTrust: (userId: string) => { + isCrossSigningVerified: () => boolean + wasCrossSigningVerified: () => boolean + }; + getStoredDevicesForUser: (userId: string) => Promise<[{ deviceId: string }]>; + checkDeviceTrust: (userId: string, deviceId: string) => { + isVerified: () => boolean + } +} + +interface Room { + getEncryptionTargetMembers: () => Promise<[{userId: string}]>; + roomId: string; +} + +export async function shieldStatusForRoom(client: Client, room: Room): Promise { + const members = (await room.getEncryptionTargetMembers()).map(({userId}) => userId); + const inDMMap = !!DMRoomMap.shared().getUserIdForRoomId(room.roomId); + + const verified: string[] = []; + const unverified: string[] = []; + members.filter((userId) => userId !== client.getUserId()) + .forEach((userId) => { + (client.checkUserTrust(userId).isCrossSigningVerified() ? + verified : unverified).push(userId); + }); + + /* Alarm if any unverified users were verified before. */ + for (const userId of unverified) { + if (client.checkUserTrust(userId).wasCrossSigningVerified()) { + return "warning"; + } + } + + /* Check all verified user devices. */ + /* Don't alarm if no other users are verified */ + const includeUser = (verified.length > 0) && // Don't alarm for self in rooms where nobody else is verified + !inDMMap && // Don't alarm for self in DMs with other users + (members.length !== 2) || // Don't alarm for self in 1:1 chats with other users + (members.length === 1); // Do alarm for self if we're alone in a room + const targets = includeUser ? [...verified, client.getUserId()] : verified; + for (const userId of targets) { + const devices = await client.getStoredDevicesForUser(userId); + const anyDeviceNotVerified = devices.some(({deviceId}) => { + return !client.checkDeviceTrust(userId, deviceId).isVerified(); + }); + if (anyDeviceNotVerified) { + return "warning"; + } + } + + return unverified.length === 0 ? "verified" : "normal"; +} diff --git a/src/utils/StorageManager.js b/src/utils/StorageManager.js index 4ed118da8a..e29b6d9b0e 100644 --- a/src/utils/StorageManager.js +++ b/src/utils/StorageManager.js @@ -48,6 +48,11 @@ export function tryPersistStorage() { navigator.storage.persist().then(persistent => { console.log("StorageManager: Persistent?", persistent); }); + } else if (document.requestStorageAccess) { // Safari + document.requestStorageAccess().then( + () => console.log("StorageManager: Persistent?", true), + () => console.log("StorageManager: Persistent?", false), + ); } else { console.log("StorageManager: Persistence unsupported"); } diff --git a/src/utils/WidgetUtils.js b/src/utils/WidgetUtils.js index 74e5f82c35..eea995cfea 100644 --- a/src/utils/WidgetUtils.js +++ b/src/utils/WidgetUtils.js @@ -28,6 +28,7 @@ const WIDGET_WAIT_TIME = 20000; import SettingsStore from "../settings/SettingsStore"; import ActiveWidgetStore from "../stores/ActiveWidgetStore"; import {IntegrationManagers} from "../integrations/IntegrationManagers"; +import {Capability} from "../widgets/WidgetApi"; /** * Encodes a URI according to a set of template variables. Variables will be @@ -454,12 +455,15 @@ export default class WidgetUtils { static getCapWhitelistForAppTypeInRoomId(appType, roomId) { const enableScreenshots = SettingsStore.getValue("enableWidgetScreenshots", roomId); - const capWhitelist = enableScreenshots ? ["m.capability.screenshot"] : []; + const capWhitelist = enableScreenshots ? [Capability.Screenshot] : []; // Obviously anyone that can add a widget can claim it's a jitsi widget, // so this doesn't really offer much over the set of domains we load // widgets from at all, but it probably makes sense for sanity. - if (appType == 'jitsi') capWhitelist.push("m.always_on_screen"); + if (appType === 'jitsi') { + capWhitelist.push(Capability.AlwaysOnScreen); + capWhitelist.push(Capability.GetRiotWebConfig); + } return capWhitelist; } diff --git a/src/verification.js b/src/verification.js index d0f6fd7806..2231346478 100644 --- a/src/verification.js +++ b/src/verification.js @@ -111,12 +111,7 @@ export async function verifyUser(user) { if (!await enable4SIfNeeded()) { return; } - const cli = MatrixClientPeg.get(); - const dmRoom = findDMForUser(cli, user.userId); - let existingRequest; - if (dmRoom) { - existingRequest = cli.findVerificationRequestDMInProgress(dmRoom.roomId); - } + const existingRequest = pendingVerificationRequestForUser(user); dis.dispatch({ action: "set_right_panel_phase", phase: RIGHT_PANEL_PHASES.EncryptionPanel, @@ -126,3 +121,11 @@ export async function verifyUser(user) { }, }); } + +export function pendingVerificationRequestForUser(user) { + const cli = MatrixClientPeg.get(); + const dmRoom = findDMForUser(cli, user.userId); + if (dmRoom) { + return cli.findVerificationRequestDMInProgress(dmRoom.roomId); + } +} diff --git a/src/widgets/WidgetApi.ts b/src/widgets/WidgetApi.ts index c19e34ae43..d6d1c79a99 100644 --- a/src/widgets/WidgetApi.ts +++ b/src/widgets/WidgetApi.ts @@ -23,6 +23,7 @@ export enum Capability { Screenshot = "m.capability.screenshot", Sticker = "m.sticker", AlwaysOnScreen = "m.always_on_screen", + GetRiotWebConfig = "im.vector.web.riot_config", } export enum KnownWidgetActions { @@ -33,7 +34,10 @@ export enum KnownWidgetActions { UpdateVisibility = "visibility", ReceiveOpenIDCredentials = "openid_credentials", SetAlwaysOnScreen = "set_always_on_screen", + GetRiotWebConfig = "im.vector.web.riot_config", + ClientReady = "im.vector.ready", } + export type WidgetAction = KnownWidgetActions | string; export enum WidgetApiType { @@ -63,10 +67,15 @@ export interface FromWidgetRequest extends WidgetRequest { */ export class WidgetApi { private origin: string; - private inFlightRequests: {[requestId: string]: (reply: FromWidgetRequest) => void} = {}; + private inFlightRequests: { [requestId: string]: (reply: FromWidgetRequest) => void } = {}; private readyPromise: Promise; private readyPromiseResolve: () => void; + /** + * Set this to true if your widget is expecting a ready message from the client. False otherwise (default). + */ + public expectingExplicitReady = false; + constructor(currentUrl: string, private widgetId: string, private requestedCapabilities: string[]) { this.origin = new URL(currentUrl).origin; @@ -83,7 +92,14 @@ export class WidgetApi { if (payload.action === KnownWidgetActions.GetCapabilities) { this.onCapabilitiesRequest(payload); + if (!this.expectingExplicitReady) { + this.readyPromiseResolve(); + } + } else if (payload.action === KnownWidgetActions.ClientReady) { this.readyPromiseResolve(); + + // Automatically acknowledge so we can move on + this.replyToRequest(payload, {}); } else { console.warn(`[WidgetAPI] Got unexpected action: ${payload.action}`); } @@ -126,7 +142,10 @@ export class WidgetApi { data: payload, response: {}, // Not used at this layer - it's used when the client responds }; - this.inFlightRequests[request.requestId] = callback; + + if (callback) { + this.inFlightRequests[request.requestId] = callback; + } console.log(`[WidgetAPI] Sending request: `, request); window.parent.postMessage(request, "*"); @@ -134,7 +153,16 @@ export class WidgetApi { public setAlwaysOnScreen(onScreen: boolean): Promise { return new Promise(resolve => { - this.callAction(KnownWidgetActions.SetAlwaysOnScreen, {value: onScreen}, resolve); + this.callAction(KnownWidgetActions.SetAlwaysOnScreen, {value: onScreen}, null); + resolve(); // SetAlwaysOnScreen is currently fire-and-forget, but that could change. + }); + } + + public getRiotConfig(): Promise { + return new Promise(resolve => { + this.callAction(KnownWidgetActions.GetRiotWebConfig, {}, response => { + resolve(response.response.config); + }); }); } } diff --git a/test/utils/ShieldUtils-test.js b/test/utils/ShieldUtils-test.js new file mode 100644 index 0000000000..5f676579fa --- /dev/null +++ b/test/utils/ShieldUtils-test.js @@ -0,0 +1,183 @@ +import { shieldStatusForRoom } from '../../src/utils/ShieldUtils'; +import DMRoomMap from '../../src/utils/DMRoomMap'; + +function mkClient(selfTrust) { + return { + getUserId: () => "@self:localhost", + checkUserTrust: (userId) => ({ + isCrossSigningVerified: () => userId[1] == "T", + wasCrossSigningVerified: () => userId[1] == "T" || userId[1] == "W", + }), + checkDeviceTrust: (userId, deviceId) => ({ + isVerified: () => userId === "@self:localhost" ? selfTrust : userId[2] == "T", + }), + getStoredDevicesForUser: async (userId) => ["DEVICE"], + }; +} + +describe("mkClient self-test", function() { + test.each([true, false])("behaves well for self-trust=%s", (v) => { + const client = mkClient(v); + expect(client.checkDeviceTrust("@self:localhost", "DEVICE").isVerified()).toBe(v); + }); + + test.each([ + ["@TT:h", true], + ["@TF:h", true], + ["@FT:h", false], + ["@FF:h", false]], + )("behaves well for user trust %s", (userId, trust) => { + expect(mkClient().checkUserTrust(userId).isCrossSigningVerified()).toBe(trust); + }); + + test.each([ + ["@TT:h", true], + ["@TF:h", false], + ["@FT:h", true], + ["@FF:h", false]], + )("behaves well for device trust %s", (userId, trust) => { + expect(mkClient().checkDeviceTrust(userId, "device").isVerified()).toBe(trust); + }); +}); + +describe("shieldStatusForMembership self-trust behaviour", function() { + beforeAll(() => { + DMRoomMap._sharedInstance = { + getUserIdForRoomId: (roomId) => roomId === "DM" ? "@any:h" : null, + }; + }); + + it.each( + [[true, true], [true, false], + [false, true], [false, false]], + )("2 unverified: returns 'normal', self-trust = %s, DM = %s", async (trusted, dm) => { + const client = mkClient(trusted); + const room = { + roomId: dm ? "DM" : "other", + getEncryptionTargetMembers: () => ["@self:localhost", "@FF1:h", "@FF2:h"].map((userId) => ({userId})), + }; + const status = await shieldStatusForRoom(client, room); + expect(status).toEqual("normal"); + }); + + it.each( + [["verified", true, true], ["verified", true, false], + ["verified", false, true], ["warning", false, false]], + )("2 verified: returns '%s', self-trust = %s, DM = %s", async (result, trusted, dm) => { + const client = mkClient(trusted); + const room = { + roomId: dm ? "DM" : "other", + getEncryptionTargetMembers: () => ["@self:localhost", "@TT1:h", "@TT2:h"].map((userId) => ({userId})), + }; + const status = await shieldStatusForRoom(client, room); + expect(status).toEqual(result); + }); + + it.each( + [["normal", true, true], ["normal", true, false], + ["normal", false, true], ["warning", false, false]], + )("2 mixed: returns '%s', self-trust = %s, DM = %s", async (result, trusted, dm) => { + const client = mkClient(trusted); + const room = { + roomId: dm ? "DM" : "other", + getEncryptionTargetMembers: () => ["@self:localhost", "@TT1:h", "@FF2:h"].map((userId) => ({userId})), + }; + const status = await shieldStatusForRoom(client, room); + expect(status).toEqual(result); + }); + + it.each( + [["verified", true, true], ["verified", true, false], + ["warning", false, true], ["warning", false, false]], + )("0 others: returns '%s', self-trust = %s, DM = %s", async (result, trusted, dm) => { + const client = mkClient(trusted); + const room = { + roomId: dm ? "DM" : "other", + getEncryptionTargetMembers: () => ["@self:localhost"].map((userId) => ({userId})), + }; + const status = await shieldStatusForRoom(client, room); + expect(status).toEqual(result); + }); + + it.each( + [["verified", true, true], ["verified", true, false], + ["verified", false, true], ["verified", false, false]], + )("1 verified: returns '%s', self-trust = %s, DM = %s", async (result, trusted, dm) => { + const client = mkClient(trusted); + const room = { + roomId: dm ? "DM" : "other", + getEncryptionTargetMembers: () => ["@self:localhost", "@TT:h"].map((userId) => ({userId})), + }; + const status = await shieldStatusForRoom(client, room); + expect(status).toEqual(result); + }); + + it.each( + [["normal", true, true], ["normal", true, false], + ["normal", false, true], ["normal", false, false]], + )("1 unverified: returns '%s', self-trust = %s, DM = %s", async (result, trusted, dm) => { + const client = mkClient(trusted); + const room = { + roomId: dm ? "DM" : "other", + getEncryptionTargetMembers: () => ["@self:localhost", "@FF:h"].map((userId) => ({userId})), + }; + const status = await shieldStatusForRoom(client, room); + expect(status).toEqual(result); + }); +}); + +describe("shieldStatusForMembership other-trust behaviour", function() { + beforeAll(() => { + DMRoomMap._sharedInstance = { + getUserIdForRoomId: (roomId) => roomId === "DM" ? "@any:h" : null, + }; + }); + + it.each( + [["warning", true], ["warning", false]], + )("1 verified/untrusted: returns '%s', DM = %s", async (result, dm) => { + const client = mkClient(true); + const room = { + roomId: dm ? "DM" : "other", + getEncryptionTargetMembers: () => ["@self:localhost", "@TF:h"].map((userId) => ({userId})), + }; + const status = await shieldStatusForRoom(client, room); + expect(status).toEqual(result); + }); + + it.each( + [["warning", true], ["warning", false]], + )("2 verified/untrusted: returns '%s', DM = %s", async (result, dm) => { + const client = mkClient(true); + const room = { + roomId: dm ? "DM" : "other", + getEncryptionTargetMembers: () => ["@self:localhost", "@TF:h", "@TT:h"].map((userId) => ({userId})), + }; + const status = await shieldStatusForRoom(client, room); + expect(status).toEqual(result); + }); + + it.each( + [["normal", true], ["normal", false]], + )("2 unverified/untrusted: returns '%s', DM = %s", async (result, dm) => { + const client = mkClient(true); + const room = { + roomId: dm ? "DM" : "other", + getEncryptionTargetMembers: () => ["@self:localhost", "@FF:h", "@FT:h"].map((userId) => ({userId})), + }; + const status = await shieldStatusForRoom(client, room); + expect(status).toEqual(result); + }); + + it.each( + [["warning", true], ["warning", false]], + )("2 was verified: returns '%s', DM = %s", async (result, dm) => { + const client = mkClient(true); + const room = { + roomId: dm ? "DM" : "other", + getEncryptionTargetMembers: () => ["@self:localhost", "@WF:h", "@FT:h"].map((userId) => ({userId})), + }; + const status = await shieldStatusForRoom(client, room); + expect(status).toEqual(result); + }); +}); diff --git a/yarn.lock b/yarn.lock index 582d89137e..c5fc8268a1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5690,8 +5690,8 @@ mathml-tag-names@^2.0.1: integrity sha512-APMBEanjybaPzUrfqU0IMU5I0AswKMH7k8OTLs0vvV4KZpExkTkY87nR/zpbuTPj+gARop7aGUbl11pnDfW6xg== "matrix-js-sdk@github:matrix-org/matrix-js-sdk#develop": - version "5.1.1" - resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/b2e154377a4268441a3b27b183dd7f7018187035" + version "5.2.0" + resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/223d37ffce674a23ca73702f04b9ba31cfd84196" dependencies: "@babel/runtime" "^7.8.3" another-json "^0.2.0"