Format code

This commit is contained in:
Robin
2023-10-11 10:42:04 -04:00
parent b28e465122
commit 614bc82402
112 changed files with 628 additions and 602 deletions

View File

@@ -57,7 +57,7 @@ export const FeedbackSettingsTab: FC<Props> = ({ roomId }) => {
sendRageshakeRequest(roomId, rageshakeRequestId);
}
},
[submitRageshake, roomId, sendRageshakeRequest]
[submitRageshake, roomId, sendRageshakeRequest],
);
return (
@@ -65,7 +65,7 @@ export const FeedbackSettingsTab: FC<Props> = ({ roomId }) => {
<h4 className={styles.label}>{t("Submit feedback")}</h4>
<Body>
{t(
"If you are experiencing issues or simply would like to provide some feedback, please send us a short description below."
"If you are experiencing issues or simply would like to provide some feedback, please send us a short description below.",
)}
</Body>
<form onSubmit={onSubmitFeedback}>

View File

@@ -69,7 +69,7 @@ export const SettingsModal: FC<Props> = (props) => {
// Generate a `SelectInput` with a list of devices for a given device kind.
const generateDeviceSelection = (
devices: MediaDevice,
caption: string
caption: string,
): ReactNode => {
if (devices.available.length == 0) return null;
@@ -100,7 +100,7 @@ export const SettingsModal: FC<Props> = (props) => {
(tab: Key) => {
setSelectedTab(tab.toString());
},
[setSelectedTab]
[setSelectedTab],
);
const optInDescription = (

View File

@@ -133,7 +133,7 @@ class IndexedDBLogStore {
public constructor(
private indexedDB: IDBFactory,
private loggerInstance: ConsoleLogger
private loggerInstance: ConsoleLogger,
) {
this.id = "instance-" + randomString(16);
@@ -177,7 +177,7 @@ class IndexedDBLogStore {
logObjStore.createIndex("id", "id", { unique: false });
logObjStore.add(
this.generateLogEntry(new Date() + " ::: Log database was created.")
this.generateLogEntry(new Date() + " ::: Log database was created."),
);
// This records the last time each instance ID generated a log message, such
@@ -208,7 +208,7 @@ class IndexedDBLogStore {
{
leading: false,
trailing: true,
}
},
);
/**
@@ -366,8 +366,8 @@ class IndexedDBLogStore {
txn.onerror = (): void => {
reject(
new Error(
"Failed to delete logs for " + `'${id}' : ${txn?.error?.message}`
)
"Failed to delete logs for " + `'${id}' : ${txn?.error?.message}`,
),
);
};
// delete last modified entries
@@ -410,7 +410,7 @@ class IndexedDBLogStore {
},
(err) => {
logger.error(err);
}
},
);
}
return logs;
@@ -445,7 +445,7 @@ class IndexedDBLogStore {
function selectQuery<T>(
store: IDBObjectStore,
keyRange: IDBKeyRange | undefined,
resultMapper: (cursor: IDBCursorWithValue) => T
resultMapper: (cursor: IDBCursorWithValue) => T,
): Promise<T[]> {
const query = store.openCursor(keyRange);
return new Promise((resolve, reject) => {
@@ -510,7 +510,7 @@ function tryInitStorage(): Promise<void> {
if (indexedDB) {
global.mx_rage_store = new IndexedDBLogStore(
indexedDB,
global.mx_rage_logger
global.mx_rage_logger,
);
global.mx_rage_initStoragePromise = global.mx_rage_store.connect();
return global.mx_rage_initStoragePromise;
@@ -547,7 +547,7 @@ export async function getLogsForReport(): Promise<LogEntry[]> {
type StringifyReplacer = (
this: unknown,
key: string,
value: unknown
value: unknown,
) => unknown;
// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Cyclic_object_value#circular_references
@@ -600,7 +600,7 @@ export function setLogExtension(extension: LogExtensionFunc): void {
logger.methodFactory = function (
methodName,
configLevel,
loggerName
loggerName,
): LoggingMethod {
const rawMethod = originalFactory(methodName, configLevel, loggerName);

View File

@@ -95,12 +95,12 @@ export function useSubmitRageshake(): {
const body = new FormData();
body.append(
"text",
description ?? "User did not supply any additional text."
description ?? "User did not supply any additional text.",
);
body.append("app", "matrix-video-chat");
body.append(
"version",
(import.meta.env.VITE_APP_VERSION as string) || "dev"
(import.meta.env.VITE_APP_VERSION as string) || "dev",
);
body.append("user_agent", userAgent);
body.append("installed_pwa", "false");
@@ -132,22 +132,22 @@ export function useSubmitRageshake(): {
body.append(
"cross_signing_ready",
String(await client.isCrossSigningReady())
String(await client.isCrossSigningReady()),
);
body.append(
"cross_signing_supported_by_hs",
String(
await client.doesServerSupportUnstableFeature(
"org.matrix.e2e_cross_signing"
)
)
"org.matrix.e2e_cross_signing",
),
),
);
body.append("cross_signing_key", crossSigning.getId()!);
body.append(
"cross_signing_privkey_in_secret_storage",
String(
!!(await crossSigning.isStoredInSecretStorage(secretStorage))
)
!!(await crossSigning.isStoredInSecretStorage(secretStorage)),
),
);
const pkCache = client.getCrossSigningCacheCallbacks();
@@ -157,8 +157,8 @@ export function useSubmitRageshake(): {
!!(
pkCache?.getCrossSigningKeyCache &&
(await pkCache.getCrossSigningKeyCache("master"))
)
)
),
),
);
body.append(
"cross_signing_self_signing_privkey_cached",
@@ -166,8 +166,8 @@ export function useSubmitRageshake(): {
!!(
pkCache?.getCrossSigningKeyCache &&
(await pkCache.getCrossSigningKeyCache("self_signing"))
)
)
),
),
);
body.append(
"cross_signing_user_signing_privkey_cached",
@@ -175,32 +175,32 @@ export function useSubmitRageshake(): {
!!(
pkCache?.getCrossSigningKeyCache &&
(await pkCache.getCrossSigningKeyCache("user_signing"))
)
)
),
),
);
body.append(
"secret_storage_ready",
String(await client.isSecretStorageReady())
String(await client.isSecretStorageReady()),
);
body.append(
"secret_storage_key_in_account",
String(!!(await secretStorage.hasKey()))
String(!!(await secretStorage.hasKey())),
);
body.append(
"session_backup_key_in_secret_storage",
String(!!(await client.isKeyBackupKeyStored()))
String(!!(await client.isKeyBackupKeyStored())),
);
const sessionBackupKeyFromCache =
await client.crypto!.getSessionBackupPrivateKey();
body.append(
"session_backup_key_cached",
String(!!sessionBackupKeyFromCache)
String(!!sessionBackupKeyFromCache),
);
body.append(
"session_backup_key_well_formed",
String(sessionBackupKeyFromCache instanceof Uint8Array)
String(sessionBackupKeyFromCache instanceof Uint8Array),
);
}
}
@@ -214,7 +214,7 @@ export function useSubmitRageshake(): {
try {
body.append(
"storageManager_persisted",
String(await navigator.storage.persisted())
String(await navigator.storage.persisted()),
);
} catch (e) {}
} else if (document.hasStorageAccess) {
@@ -222,7 +222,7 @@ export function useSubmitRageshake(): {
try {
body.append(
"storageManager_persisted",
String(await document.hasStorageAccess())
String(await document.hasStorageAccess()),
);
} catch (e) {}
}
@@ -240,7 +240,7 @@ export function useSubmitRageshake(): {
Object.keys(estimate.usageDetails).forEach((k) => {
body.append(
`storageManager_usage_${k}`,
String(estimate.usageDetails![k])
String(estimate.usageDetails![k]),
);
});
}
@@ -257,14 +257,14 @@ export function useSubmitRageshake(): {
body.append(
"file",
gzip(ElementCallOpenTelemetry.instance.rageshakeProcessor!.dump()),
"traces.json.gz"
"traces.json.gz",
);
}
if (opts.rageshakeRequestId) {
body.append(
"group_call_rageshake_request_id",
opts.rageshakeRequestId
opts.rageshakeRequestId,
);
}
@@ -279,7 +279,7 @@ export function useSubmitRageshake(): {
logger.error(error);
}
},
[client, sending]
[client, sending],
);
return {
@@ -292,7 +292,7 @@ export function useSubmitRageshake(): {
export function useRageshakeRequest(): (
roomId: string,
rageshakeRequestId: string
rageshakeRequestId: string,
) => void {
const { client } = useClient();
@@ -302,14 +302,14 @@ export function useRageshakeRequest(): (
request_id: rageshakeRequestId,
});
},
[client]
[client],
);
return sendRageshakeRequest;
}
export function useRageshakeRequestModal(
roomId: string
roomId: string,
): ComponentProps<typeof RageshakeRequestModal> {
const [open, setOpen] = useState(false);
const onDismiss = useCallback(() => setOpen(false), [setOpen]);

View File

@@ -38,13 +38,13 @@ export const useSetting = <T>(name: string, defaultValue: T): Setting<T> => {
const value = useMemo(
() => (item == null ? defaultValue : JSON.parse(item)),
[item, defaultValue]
[item, defaultValue],
);
const setValue = useCallback(
(value: T) => {
setItem(JSON.stringify(value));
},
[setItem]
[setItem],
);
return [value, setValue];
@@ -94,7 +94,7 @@ export const useOptInAnalytics = (): DisableableSetting<boolean | null> => {
export const useEnableE2EE = (): DisableableSetting<boolean | null> => {
const settingVal = useSetting<boolean | null>(
"enable-end-to-end-encryption",
true
true,
);
if (isE2EESupported()) return settingVal;