Apply prettier formatting
This commit is contained in:
parent
1cac306093
commit
526645c791
1576 changed files with 65385 additions and 62478 deletions
|
@ -75,7 +75,8 @@ async function getStorageContext(): Promise<StorageContext> {
|
|||
try {
|
||||
result["storageManager_persisted"] = String(await navigator.storage.persisted());
|
||||
} catch (e) {}
|
||||
} else if (document.hasStorageAccess) { // Safari
|
||||
} else if (document.hasStorageAccess) {
|
||||
// Safari
|
||||
try {
|
||||
result["storageManager_persisted"] = String(await document.hasStorageAccess());
|
||||
} catch (e) {}
|
||||
|
@ -87,7 +88,7 @@ async function getStorageContext(): Promise<StorageContext> {
|
|||
result["storageManager_usage"] = String(estimate.usage);
|
||||
if (estimate.usageDetails) {
|
||||
const usageDetails = [];
|
||||
Object.keys(estimate.usageDetails).forEach(k => {
|
||||
Object.keys(estimate.usageDetails).forEach((k) => {
|
||||
usageDetails.push(`${k}: ${String(estimate.usageDetails[k])}`);
|
||||
});
|
||||
result[`storageManager_usage`] = usageDetails.join(", ");
|
||||
|
@ -100,14 +101,14 @@ async function getStorageContext(): Promise<StorageContext> {
|
|||
|
||||
function getUserContext(client: MatrixClient): UserContext {
|
||||
return {
|
||||
"username": client.credentials.userId,
|
||||
"enabled_labs": getEnabledLabs(),
|
||||
"low_bandwidth": SettingsStore.getValue("lowBandwidth") ? "enabled" : "disabled",
|
||||
username: client.credentials.userId,
|
||||
enabled_labs: getEnabledLabs(),
|
||||
low_bandwidth: SettingsStore.getValue("lowBandwidth") ? "enabled" : "disabled",
|
||||
};
|
||||
}
|
||||
|
||||
function getEnabledLabs(): string {
|
||||
const enabledLabs = SettingsStore.getFeatureSettingNames().filter(f => SettingsStore.getValue(f));
|
||||
const enabledLabs = SettingsStore.getFeatureSettingNames().filter((f) => SettingsStore.getValue(f));
|
||||
if (enabledLabs.length) {
|
||||
return enabledLabs.join(", ");
|
||||
}
|
||||
|
@ -128,33 +129,33 @@ async function getCryptoContext(client: MatrixClient): Promise<CryptoContext> {
|
|||
const sessionBackupKeyFromCache = await client.crypto.getSessionBackupPrivateKey();
|
||||
|
||||
return {
|
||||
"device_keys": keys.join(', '),
|
||||
"cross_signing_ready": String(await client.isCrossSigningReady()),
|
||||
"cross_signing_supported_by_hs":
|
||||
String(await client.doesServerSupportUnstableFeature("org.matrix.e2e_cross_signing")),
|
||||
"cross_signing_key": crossSigning.getId(),
|
||||
"cross_signing_privkey_in_secret_storage": String(
|
||||
!!(await crossSigning.isStoredInSecretStorage(secretStorage))),
|
||||
"cross_signing_master_privkey_cached": String(
|
||||
!!(pkCache && (await pkCache.getCrossSigningKeyCache("master")))),
|
||||
"cross_signing_user_signing_privkey_cached": String(
|
||||
!!(pkCache && (await pkCache.getCrossSigningKeyCache("user_signing")))),
|
||||
"secret_storage_ready": String(await client.isSecretStorageReady()),
|
||||
"secret_storage_key_in_account": String(!!(await secretStorage.hasKey())),
|
||||
"session_backup_key_in_secret_storage": String(!!(await client.isKeyBackupKeyStored())),
|
||||
"session_backup_key_cached": String(!!sessionBackupKeyFromCache),
|
||||
"session_backup_key_well_formed": String(sessionBackupKeyFromCache instanceof Uint8Array),
|
||||
device_keys: keys.join(", "),
|
||||
cross_signing_ready: String(await client.isCrossSigningReady()),
|
||||
cross_signing_supported_by_hs: String(
|
||||
await client.doesServerSupportUnstableFeature("org.matrix.e2e_cross_signing"),
|
||||
),
|
||||
cross_signing_key: crossSigning.getId(),
|
||||
cross_signing_privkey_in_secret_storage: String(!!(await crossSigning.isStoredInSecretStorage(secretStorage))),
|
||||
cross_signing_master_privkey_cached: String(!!(pkCache && (await pkCache.getCrossSigningKeyCache("master")))),
|
||||
cross_signing_user_signing_privkey_cached: String(
|
||||
!!(pkCache && (await pkCache.getCrossSigningKeyCache("user_signing"))),
|
||||
),
|
||||
secret_storage_ready: String(await client.isSecretStorageReady()),
|
||||
secret_storage_key_in_account: String(!!(await secretStorage.hasKey())),
|
||||
session_backup_key_in_secret_storage: String(!!(await client.isKeyBackupKeyStored())),
|
||||
session_backup_key_cached: String(!!sessionBackupKeyFromCache),
|
||||
session_backup_key_well_formed: String(sessionBackupKeyFromCache instanceof Uint8Array),
|
||||
};
|
||||
}
|
||||
|
||||
function getDeviceContext(client: MatrixClient): DeviceContext {
|
||||
const result = {
|
||||
"device_id": client?.deviceId,
|
||||
"mx_local_settings": localStorage.getItem('mx_local_settings'),
|
||||
device_id: client?.deviceId,
|
||||
mx_local_settings: localStorage.getItem("mx_local_settings"),
|
||||
};
|
||||
|
||||
if (window.Modernizr) {
|
||||
const missingFeatures = Object.keys(window.Modernizr).filter(key => window.Modernizr[key] === false);
|
||||
const missingFeatures = Object.keys(window.Modernizr).filter((key) => window.Modernizr[key] === false);
|
||||
if (missingFeatures.length > 0) {
|
||||
result["modernizr_missing_features"] = missingFeatures.join(", ");
|
||||
}
|
||||
|
@ -166,10 +167,10 @@ function getDeviceContext(client: MatrixClient): DeviceContext {
|
|||
async function getContexts(): Promise<Contexts> {
|
||||
const client = MatrixClientPeg.get();
|
||||
return {
|
||||
"user": getUserContext(client),
|
||||
"crypto": await getCryptoContext(client),
|
||||
"device": getDeviceContext(client),
|
||||
"storage": await getStorageContext(),
|
||||
user: getUserContext(client),
|
||||
crypto: await getCryptoContext(client),
|
||||
device: getDeviceContext(client),
|
||||
storage: await getStorageContext(),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -178,10 +179,10 @@ export async function sendSentryReport(userText: string, issueUrl: string, error
|
|||
if (!sentryConfig) return;
|
||||
|
||||
const captureContext = {
|
||||
"contexts": await getContexts(),
|
||||
"extra": {
|
||||
"user_text": userText,
|
||||
"issue_url": issueUrl,
|
||||
contexts: await getContexts(),
|
||||
extra: {
|
||||
user_text: userText,
|
||||
issue_url: issueUrl,
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -211,8 +212,7 @@ export async function initSentry(sentryConfig: IConfigOptions["sentry"]): Promis
|
|||
];
|
||||
|
||||
if (SettingsStore.getValue("automaticErrorReporting")) {
|
||||
integrations.push(new Sentry.Integrations.GlobalHandlers(
|
||||
{ onerror: false, onunhandledrejection: true }));
|
||||
integrations.push(new Sentry.Integrations.GlobalHandlers({ onerror: false, onunhandledrejection: true }));
|
||||
integrations.push(new Sentry.Integrations.TryCatch());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue