mv element.io @types __mocks__/ debian docker module_system/ playwright res src test webapp Dockerfile .dockerignore .eslintignore .stylelintrc.cjs babel.config.cjs recorder-worklet-loader.cjs .modernizr.json components.json config.json config.sample.json package.json project.json tsconfig.json tsconfig.module_system.json jest.config.ts playwright.config.ts webpack.config.ts build_config.sample.yaml apps/web/

mkdir apps/web/scripts
mv scripts/{cleanup.sh,ci_package.sh,copy-res.ts,deploy.py,package.sh} apps/web/scripts

And a couple of gitignore tweaks

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski
2026-02-24 15:43:58 +00:00
parent e7509c92a1
commit 91a3cb03c1
3408 changed files with 28 additions and 32 deletions
+59
View File
@@ -0,0 +1,59 @@
/*
Copyright 2024 New Vector Ltd.
Copyright 2023 The Matrix.org Foundation C.I.C.
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE files in the repository root for full details.
*/
import { type Device, type MatrixClient } from "matrix-js-sdk/src/matrix";
/**
* Get crypto information on a specific device.
*
* Only devices with Crypto support are returned. If the MatrixClient doesn't support cryptography, `undefined` is
* returned.
*
* @param client - Matrix Client.
* @param userId - ID of the user owning the device.
* @param deviceId - ID of the device.
* @param downloadUncached - If true, download the device list for users whose device list we are not
* currently tracking. Defaults to false.
*
* @returns Information on the device if it is known.
*/
export async function getDeviceCryptoInfo(
client: MatrixClient,
userId: string,
deviceId: string,
downloadUncached?: boolean,
): Promise<Device | undefined> {
const crypto = client.getCrypto();
if (!crypto) {
// no crypto support, no device.
return undefined;
}
const deviceMap = await crypto.getUserDeviceInfo([userId], downloadUncached);
return deviceMap.get(userId)?.get(deviceId);
}
/**
* Get the IDs of the given user's devices.
*
* Only devices with Crypto support are returned. If the MatrixClient doesn't support cryptography, an empty Set is
* returned.
*
* @param client - Matrix Client.
* @param userId - ID of the user to query.
*/
export async function getUserDeviceIds(client: MatrixClient, userId: string): Promise<Set<string>> {
const crypto = client.getCrypto();
if (!crypto) {
return new Set();
}
const deviceMap = await crypto.getUserDeviceInfo([userId]);
return new Set(deviceMap.get(userId)?.keys() ?? []);
}
+11
View File
@@ -0,0 +1,11 @@
/*
Copyright 2024 New Vector Ltd.
Copyright 2024 The Matrix.org Foundation C.I.C.
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE files in the repository root for full details.
*/
/** The `algorithm` property used in `m.room.encrypted` state events for encrypted rooms.
*/
export const MEGOLM_ENCRYPTION_ALGORITHM = "m.megolm.v1.aes-sha2";
@@ -0,0 +1,20 @@
/*
Copyright 2025 Element Creations Ltd.
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE files in the repository root for full details.
*/
import { type CryptoApi } from "matrix-js-sdk/src/crypto-api";
/**
* Creates a new key backup version, and wait until it is enabled.
*
* This is typically used within a {@link DeviceListener.pause()} call, to
* ensure that the device listener doesn't check the backup status until after the
* key backup is active.
*/
export async function resetKeyBackupAndWait(crypto: CryptoApi): Promise<void> {
await crypto.resetKeyBackup();
await crypto.checkKeyBackupAndEnable();
}
@@ -0,0 +1,31 @@
/*
Copyright 2024 New Vector Ltd.
Copyright 2023 The Matrix.org Foundation C.I.C.
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE files in the repository root for full details.
*/
import { type MatrixClient } from "matrix-js-sdk/src/matrix";
import { getE2EEWellKnown } from "../WellKnownUtils";
/**
* Check e2ee io.element.e2ee setting
* Returns true when .well-known e2ee config force_disable is TRUE
* When true all new rooms should be created with encryption disabled
* Can be overriden by synapse option encryption_enabled_by_default_for_room_type ( :/ )
* https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#encryption_enabled_by_default_for_room_type
*
* @param client
* @returns whether well-known config forces encryption to DISABLED
*/
export function shouldForceDisableEncryption(client: MatrixClient): boolean {
const e2eeWellKnown = getE2EEWellKnown(client);
if (e2eeWellKnown) {
const shouldForceDisable = e2eeWellKnown["force_disable"] === true;
return shouldForceDisable;
}
return false;
}
@@ -0,0 +1,29 @@
/*
Copyright 2024 New Vector Ltd.
Copyright 2023 The Matrix.org Foundation C.I.C.
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE files in the repository root for full details.
*/
import { type MatrixClient } from "matrix-js-sdk/src/matrix";
import { shouldForceDisableEncryption } from "./shouldForceDisableEncryption";
import { asyncSomeParallel } from "../arrays.ts";
/**
* If encryption is force disabled AND the user is not in any encrypted rooms
* skip setting up encryption
* @param client
* @returns {boolean} true when we can skip settings up encryption
*/
export const shouldSkipSetupEncryption = async (client: MatrixClient): Promise<boolean> => {
const isEncryptionForceDisabled = shouldForceDisableEncryption(client);
const crypto = client.getCrypto();
if (!crypto) return true;
return (
isEncryptionForceDisabled &&
!(await asyncSomeParallel(client.getRooms(), ({ roomId }) => crypto.isEncryptionEnabledInRoom(roomId)))
);
};