Add config option to autorageshake when key backup is not enabled (#7741)
* report on not enabled Signed-off-by: Kerry Archibald <kerrya@element.io> * add setting Signed-off-by: Kerry Archibald <kerrya@element.io> * check key backup status after crypto init Signed-off-by: Kerry Archibald <kerrya@element.io> * remove log Signed-off-by: Kerry Archibald <kerrya@element.io> * test encryption setup in DeviceListener Signed-off-by: Kerry Archibald <kerrya@element.io> * i18n Signed-off-by: Kerry Archibald <kerrya@element.io> * sendLogs for key backup auto-report event Signed-off-by: Kerry Archibald <kerrya@element.io> * remove reloadOnChagneController Signed-off-by: Kerry Archibald <kerrya@element.io>
This commit is contained in:
parent
d06ec845ee
commit
b5e7d12f76
6 changed files with 290 additions and 1 deletions
|
@ -36,6 +36,7 @@ import { isSecretStorageBeingAccessed, accessSecretStorage } from "./SecurityMan
|
|||
import { isSecureBackupRequired } from './utils/WellKnownUtils';
|
||||
import { isLoggedIn } from './components/structures/MatrixChat';
|
||||
import { ActionPayload } from "./dispatcher/payloads";
|
||||
import { Action } from "./dispatcher/actions";
|
||||
|
||||
const KEY_BACKUP_POLL_INTERVAL = 5 * 60 * 1000;
|
||||
|
||||
|
@ -48,6 +49,7 @@ export default class DeviceListener {
|
|||
// cache of the key backup info
|
||||
private keyBackupInfo: object = null;
|
||||
private keyBackupFetchedAt: number = null;
|
||||
private keyBackupStatusChecked = false;
|
||||
// We keep a list of our own device IDs so we can batch ones that were already
|
||||
// there the last time the app launched into a single toast, but display new
|
||||
// ones in their own toasts.
|
||||
|
@ -92,6 +94,7 @@ export default class DeviceListener {
|
|||
this.dismissedThisDeviceToast = false;
|
||||
this.keyBackupInfo = null;
|
||||
this.keyBackupFetchedAt = null;
|
||||
this.keyBackupStatusChecked = false;
|
||||
this.ourDeviceIdsAtStart = null;
|
||||
this.displayingToastsForDeviceIds = new Set();
|
||||
}
|
||||
|
@ -227,6 +230,8 @@ export default class DeviceListener {
|
|||
|
||||
if (this.dismissedThisDeviceToast || allSystemsReady) {
|
||||
hideSetupEncryptionToast();
|
||||
|
||||
this.checkKeyBackupStatus();
|
||||
} else if (this.shouldShowSetupEncryptionToast()) {
|
||||
// make sure our keys are finished downloading
|
||||
await cli.downloadKeys([cli.getUserId()]);
|
||||
|
@ -238,6 +243,7 @@ export default class DeviceListener {
|
|||
) {
|
||||
// Cross-signing on account but this device doesn't trust the master key (verify this session)
|
||||
showSetupEncryptionToast(SetupKind.VERIFY_THIS_SESSION);
|
||||
this.checkKeyBackupStatus();
|
||||
} else {
|
||||
const backupInfo = await this.getKeyBackupInfo();
|
||||
if (backupInfo) {
|
||||
|
@ -312,4 +318,17 @@ export default class DeviceListener {
|
|||
|
||||
this.displayingToastsForDeviceIds = newUnverifiedDeviceIds;
|
||||
}
|
||||
|
||||
private checkKeyBackupStatus = async () => {
|
||||
if (this.keyBackupStatusChecked) {
|
||||
return;
|
||||
}
|
||||
// returns null when key backup status hasn't finished being checked
|
||||
const isKeyBackupEnabled = MatrixClientPeg.get().getKeyBackupEnabled();
|
||||
this.keyBackupStatusChecked = isKeyBackupEnabled !== null;
|
||||
|
||||
if (isKeyBackupEnabled === false) {
|
||||
dis.dispatch({ action: Action.ReportKeyBackupNotEnabled });
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -218,4 +218,10 @@ export enum Action {
|
|||
* Payload: none
|
||||
*/
|
||||
AnonymousAnalyticsReject = "anonymous_analytics_reject",
|
||||
|
||||
/**
|
||||
* Fires after crypto is setup if key backup is not enabled
|
||||
* Used to trigger auto rageshakes when configured
|
||||
*/
|
||||
ReportKeyBackupNotEnabled = "report_key_backup_not_enabled",
|
||||
}
|
||||
|
|
|
@ -960,6 +960,7 @@
|
|||
"Developer mode": "Developer mode",
|
||||
"Automatically send debug logs on any error": "Automatically send debug logs on any error",
|
||||
"Automatically send debug logs on decryption errors": "Automatically send debug logs on decryption errors",
|
||||
"Automatically send debug logs when key backup is not functioning": "Automatically send debug logs when key backup is not functioning",
|
||||
"Collecting app version information": "Collecting app version information",
|
||||
"Collecting logs": "Collecting logs",
|
||||
"Uploading logs": "Uploading logs",
|
||||
|
|
|
@ -891,6 +891,11 @@ export const SETTINGS: {[setting: string]: ISetting} = {
|
|||
default: false,
|
||||
controller: new ReloadOnChangeController(),
|
||||
},
|
||||
"automaticKeyBackNotEnabledReporting": {
|
||||
displayName: _td("Automatically send debug logs when key backup is not functioning"),
|
||||
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS_WITH_CONFIG,
|
||||
default: false,
|
||||
},
|
||||
[UIFeature.RoomHistorySettings]: {
|
||||
supportedLevels: LEVELS_UI_FEATURE,
|
||||
default: true,
|
||||
|
|
|
@ -24,6 +24,7 @@ import defaultDispatcher from '../dispatcher/dispatcher';
|
|||
import { AsyncStoreWithClient } from './AsyncStoreWithClient';
|
||||
import { ActionPayload } from '../dispatcher/payloads';
|
||||
import SettingsStore from "../settings/SettingsStore";
|
||||
import { Action } from "../dispatcher/actions";
|
||||
|
||||
// Minimum interval of 1 minute between reports
|
||||
const RAGESHAKE_INTERVAL = 60000;
|
||||
|
@ -62,7 +63,10 @@ export default class AutoRageshakeStore extends AsyncStoreWithClient<IState> {
|
|||
}
|
||||
|
||||
protected async onAction(payload: ActionPayload) {
|
||||
// we don't actually do anything here
|
||||
switch (payload.action) {
|
||||
case Action.ReportKeyBackupNotEnabled:
|
||||
this.onReportKeyBackupNotEnabled();
|
||||
}
|
||||
}
|
||||
|
||||
protected async onReady() {
|
||||
|
@ -152,6 +156,16 @@ export default class AutoRageshakeStore extends AsyncStoreWithClient<IState> {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
private async onReportKeyBackupNotEnabled(): Promise<void> {
|
||||
if (!SettingsStore.getValue("automaticKeyBackNotEnabledReporting")) return;
|
||||
|
||||
await sendBugReport(SdkConfig.get().bug_report_endpoint_url, {
|
||||
userText: `Auto-reporting key backup not enabled`,
|
||||
sendLogs: true,
|
||||
labels: ["web", Action.ReportKeyBackupNotEnabled],
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
window.mxAutoRageshakeStore = AutoRageshakeStore.instance;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue