Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 31e370d

Browse files
authored
Merge pull request #1813 from matrix-org/dbkr/cryptowarning
Show error if indexeddb store version is too new
2 parents 4bf5e44 + 4c51f6d commit 31e370d

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

src/MatrixClientPeg.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import utils from 'matrix-js-sdk/lib/utils';
2121
import EventTimeline from 'matrix-js-sdk/lib/models/event-timeline';
2222
import EventTimelineSet from 'matrix-js-sdk/lib/models/event-timeline-set';
2323
import createMatrixClient from './utils/createMatrixClient';
24+
import sdk from '.';
2425

2526
interface MatrixClientCreds {
2627
homeserverUrl: string,
@@ -88,6 +89,25 @@ class MatrixClientPeg {
8889
// this can happen for a number of reasons, the most likely being
8990
// that the olm library was missing. It's not fatal.
9091
console.warn("Unable to initialise e2e: " + e);
92+
93+
if (e.name == 'VersionError') {
94+
// XXX: import here to avoid cyclical dependencies
95+
const Modal = require('./Modal');
96+
const _t = require('./languageHandler')._t;
97+
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
98+
Modal.createTrackedDialog('New crypto data detected', '', ErrorDialog, {
99+
title: _t("Cryptography Disabled"),
100+
description: _t(
101+
"The cryptography data in this browser session is "+
102+
"too new for this version of Riot to understand. "+
103+
"Cryptography has been disabled. To re-enable it, go "+
104+
"back to the newer version of Riot. If you'd like to "+
105+
"use cryptography on this version, go back to the new "+
106+
"version, export your keys and log out, then return to "+
107+
"this version.",
108+
),
109+
});
110+
}
91111
}
92112

93113
const opts = utils.deepCopy(this.opts);

src/i18n/strings/en_EN.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@
5757
"Failed to invite users to community": "Failed to invite users to community",
5858
"Failed to invite users to %(groupId)s": "Failed to invite users to %(groupId)s",
5959
"Failed to add the following rooms to %(groupId)s:": "Failed to add the following rooms to %(groupId)s:",
60+
"Cryptography Disabled": "Cryptography Disabled",
61+
"The cryptography data in this browser session is too new for this version of Riot to understand. Cryptography has been disabled. To re-enable it, go back to the newer version of Riot. If you'd like to use cryptography on this version, export your keys and log out of the newer version.": "The cryptography data in this browser session is too new for this version of Riot to understand. Cryptography has been disabled. To re-enable it, go back to the newer version of Riot. If you'd like to use cryptography on this version, export your keys and log out of the newer version.",
6062
"Riot does not have permission to send you notifications - please check your browser settings": "Riot does not have permission to send you notifications - please check your browser settings",
6163
"Riot was not given permission to send notifications - please try again": "Riot was not given permission to send notifications - please try again",
6264
"Unable to enable Notifications": "Unable to enable Notifications",
@@ -150,7 +152,6 @@
150152
"%(widgetName)s widget modified by %(senderName)s": "%(widgetName)s widget modified by %(senderName)s",
151153
"%(widgetName)s widget added by %(senderName)s": "%(widgetName)s widget added by %(senderName)s",
152154
"%(widgetName)s widget removed by %(senderName)s": "%(widgetName)s widget removed by %(senderName)s",
153-
"Communities": "Communities",
154155
"Message Pinning": "Message Pinning",
155156
"%(displayName)s is typing": "%(displayName)s is typing",
156157
"%(names)s and %(count)s others are typing|other": "%(names)s and %(count)s others are typing",
@@ -524,6 +525,7 @@
524525
"Unverify": "Unverify",
525526
"Verify...": "Verify...",
526527
"No results": "No results",
528+
"Communities": "Communities",
527529
"Home": "Home",
528530
"Integrations Error": "Integrations Error",
529531
"Could not connect to the integration server": "Could not connect to the integration server",
@@ -859,10 +861,10 @@
859861
"Incorrect username and/or password.": "Incorrect username and/or password.",
860862
"Guest access is disabled on this Home Server.": "Guest access is disabled on this Home Server.",
861863
"The phone number entered looks invalid": "The phone number entered looks invalid",
864+
"This homeserver doesn't offer any login flows which are supported by this client.": "This homeserver doesn't offer any login flows which are supported by this client.",
862865
"Error: Problem communicating with the given homeserver.": "Error: Problem communicating with the given homeserver.",
863866
"Can't connect to homeserver via HTTP when an HTTPS URL is in your browser bar. Either use HTTPS or <a>enable unsafe scripts</a>.": "Can't connect to homeserver via HTTP when an HTTPS URL is in your browser bar. Either use HTTPS or <a>enable unsafe scripts</a>.",
864867
"Can't connect to homeserver - please check your connectivity, ensure your <a>homeserver's SSL certificate</a> is trusted, and that a browser extension is not blocking requests.": "Can't connect to homeserver - please check your connectivity, ensure your <a>homeserver's SSL certificate</a> is trusted, and that a browser extension is not blocking requests.",
865-
"This homeserver doesn't offer any login flows which are supported by this client.": "This homeserver doesn't offer any login flows which are supported by this client.",
866868
"Login as guest": "Login as guest",
867869
"Return to app": "Return to app",
868870
"Failed to fetch avatar URL": "Failed to fetch avatar URL",

0 commit comments

Comments
 (0)