Merge branches 'develop' and 'travis/download-logs' of github.com:matrix-org/matrix-react-sdk into travis/download-logs
Conflicts: src/i18n/strings/en_EN.json src/rageshake/submit-rageshake.ts
This commit is contained in:
commit
70c81cc377
1182 changed files with 47388 additions and 27457 deletions
|
@ -41,7 +41,7 @@ limitations under the License.
|
|||
const FLUSH_RATE_MS = 30 * 1000;
|
||||
|
||||
// the length of log data we keep in indexeddb (and include in the reports)
|
||||
const MAX_LOG_SIZE = 1024 * 1024 * 1; // 1 MB
|
||||
const MAX_LOG_SIZE = 1024 * 1024 * 5; // 5 MB
|
||||
|
||||
// A class which monkey-patches the global console and stores log lines.
|
||||
class ConsoleLogger {
|
||||
|
|
|
@ -34,6 +34,13 @@ if (!TextEncoder) {
|
|||
TextEncoder = TextEncodingUtf8.TextEncoder;
|
||||
}
|
||||
|
||||
interface IOpts {
|
||||
label?: string;
|
||||
userText?: string;
|
||||
sendLogs?: boolean;
|
||||
progressCallback?: (string) => void;
|
||||
}
|
||||
|
||||
async function collectBugReport(opts) {
|
||||
opts = opts || {};
|
||||
const progressCallback = opts.progressCallback || (() => {});
|
||||
|
@ -52,13 +59,13 @@ async function collectBugReport(opts) {
|
|||
let installedPWA = "UNKNOWN";
|
||||
try {
|
||||
// Known to work at least for desktop Chrome
|
||||
installedPWA = window.matchMedia('(display-mode: standalone)').matches;
|
||||
} catch (e) { }
|
||||
installedPWA = String(window.matchMedia('(display-mode: standalone)').matches);
|
||||
} catch (e) {}
|
||||
|
||||
let touchInput = "UNKNOWN";
|
||||
try {
|
||||
// MDN claims broad support across browsers
|
||||
touchInput = window.matchMedia('(pointer: coarse)').matches;
|
||||
touchInput = String(window.matchMedia('(pointer: coarse)').matches);
|
||||
} catch (e) { }
|
||||
|
||||
const client = MatrixClientPeg.get();
|
||||
|
@ -76,14 +83,40 @@ async function collectBugReport(opts) {
|
|||
if (client) {
|
||||
body.append('user_id', client.credentials.userId);
|
||||
body.append('device_id', client.deviceId);
|
||||
}
|
||||
|
||||
const keys = [`ed25519:${client.getDeviceEd25519Key()}`];
|
||||
if (client.getDeviceCurve25519Key) {
|
||||
keys.push(`curve25519:${client.getDeviceCurve25519Key()}`);
|
||||
if (client.isCryptoEnabled()) {
|
||||
const keys = [`ed25519:${client.getDeviceEd25519Key()}`];
|
||||
if (client.getDeviceCurve25519Key) {
|
||||
keys.push(`curve25519:${client.getDeviceCurve25519Key()}`);
|
||||
}
|
||||
body.append('device_keys', keys.join(', '));
|
||||
body.append('cross_signing_key', client.getCrossSigningId());
|
||||
|
||||
body.append('device_keys', keys.join(', '));
|
||||
|
||||
// add cross-signing status information
|
||||
const crossSigning = client._crypto._crossSigningInfo;
|
||||
const secretStorage = client._crypto._secretStorage;
|
||||
|
||||
body.append("cross_signing_key", crossSigning.getId());
|
||||
body.append("cross_signing_pk_in_ssss",
|
||||
String(!!(await crossSigning.isStoredInSecretStorage(secretStorage))));
|
||||
body.append("ssss_key_in_account", String(!!(await secretStorage.hasKey())));
|
||||
|
||||
const pkCache = client.getCrossSigningCacheCallbacks();
|
||||
body.append("self_signing_pk_cached",
|
||||
String(!!(pkCache && await pkCache.getCrossSigningKeyCache("self_signing"))));
|
||||
body.append("user_signing_pk_cached",
|
||||
String(!!(pkCache && await pkCache.getCrossSigningKeyCache("user_signing"))));
|
||||
|
||||
const sessionBackupKeyFromCache = await client._crypto.getSessionBackupPrivateKey();
|
||||
body.append("session_backup_key_cached", String(!!sessionBackupKeyFromCache));
|
||||
body.append("session_backup_key_well_formed", String(sessionBackupKeyFromCache instanceof Uint8Array));
|
||||
body.append("cross_signing_supported_by_hs",
|
||||
String(await client.doesServerSupportUnstableFeature("org.matrix.e2e_cross_signing")));
|
||||
body.append("cross_signing_ready", String(await client.isCrossSigningReady()));
|
||||
}
|
||||
}
|
||||
body.append('device_keys', keys.join(', '));
|
||||
body.append('cross_signing_key', client.getCrossSigningId());
|
||||
|
||||
if (opts.label) {
|
||||
body.append('label', opts.label);
|
||||
|
@ -94,30 +127,41 @@ async function collectBugReport(opts) {
|
|||
if (enabledLabs.length) {
|
||||
body.append('enabled_labs', enabledLabs.join(', '));
|
||||
}
|
||||
// if low bandwidth mode is enabled, say so over rageshake, it causes many issues
|
||||
if (SettingsStore.getValue("lowBandwidth")) {
|
||||
body.append("lowBandwidth", "enabled");
|
||||
}
|
||||
|
||||
// add storage persistence/quota information
|
||||
if (navigator.storage && navigator.storage.persisted) {
|
||||
try {
|
||||
body.append("storageManager_persisted", await navigator.storage.persisted());
|
||||
body.append("storageManager_persisted", String(await navigator.storage.persisted()));
|
||||
} catch (e) {}
|
||||
} else if (document.hasStorageAccess) { // Safari
|
||||
try {
|
||||
body.append("storageManager_persisted", await document.hasStorageAccess());
|
||||
body.append("storageManager_persisted", String(await document.hasStorageAccess()));
|
||||
} catch (e) {}
|
||||
}
|
||||
if (navigator.storage && navigator.storage.estimate) {
|
||||
try {
|
||||
const estimate = await navigator.storage.estimate();
|
||||
body.append("storageManager_quota", estimate.quota);
|
||||
body.append("storageManager_usage", estimate.usage);
|
||||
body.append("storageManager_quota", String(estimate.quota));
|
||||
body.append("storageManager_usage", String(estimate.usage));
|
||||
if (estimate.usageDetails) {
|
||||
Object.keys(estimate.usageDetails).forEach(k => {
|
||||
body.append(`storageManager_usage_${k}`, estimate.usageDetails[k]);
|
||||
body.append(`storageManager_usage_${k}`, String(estimate.usageDetails[k]));
|
||||
});
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
if (window.Modernizr) {
|
||||
const missingFeatures = Object.keys(window.Modernizr).filter(key => window.Modernizr[key] === false);
|
||||
if (missingFeatures.length > 0) {
|
||||
body.append("modernizr_missing_features", missingFeatures.join(", "));
|
||||
}
|
||||
}
|
||||
|
||||
if (opts.sendLogs) {
|
||||
progressCallback(_t("Collecting logs"));
|
||||
const logs = await rageshake.getLogsForReport();
|
||||
|
@ -150,7 +194,7 @@ async function collectBugReport(opts) {
|
|||
*
|
||||
* @return {Promise} Resolved when the bug report is sent.
|
||||
*/
|
||||
export default async function sendBugReport(bugReportEndpoint, opts) {
|
||||
export default async function sendBugReport(bugReportEndpoint: string, opts: IOpts) {
|
||||
if (!bugReportEndpoint) {
|
||||
throw new Error("No bug report endpoint has been set.");
|
||||
}
|
||||
|
@ -222,7 +266,7 @@ function uint8ToString(buf) {
|
|||
return out;
|
||||
}
|
||||
|
||||
function _submitReport(endpoint, body, progressCallback) {
|
||||
function _submitReport(endpoint: string, body: FormData, progressCallback: (string) => void) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const req = new XMLHttpRequest();
|
||||
req.open("POST", endpoint);
|
Loading…
Add table
Add a link
Reference in a new issue