Remove dependency on uuid (#33230)
* Remove dependency on `uuid` * Delint
This commit is contained in:
committed by
GitHub
parent
86ea6bd6b9
commit
354a05d89f
@@ -104,7 +104,6 @@
|
||||
"sanitize-html": "2.17.3",
|
||||
"tar-js": "^0.3.0",
|
||||
"ua-parser-js": "1.0.40",
|
||||
"uuid": "^13.0.0",
|
||||
"what-input": "^5.2.10"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -9,7 +9,6 @@ import React, { type ChangeEvent, useContext, useEffect, useMemo, useState } fro
|
||||
import { Pill } from "@element-hq/web-shared-components";
|
||||
import { MatrixEvent, type IContent, RoomStickyEventsEvent } from "matrix-js-sdk/src/matrix";
|
||||
import { Alert, Form, SettingsToggleInput } from "@vector-im/compound-web";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
|
||||
import BaseTool, { DevtoolsContext, type IDevtoolsProps } from "./BaseTool.tsx";
|
||||
import { _t, _td, UserFriendlyError } from "../../../../languageHandler.tsx";
|
||||
@@ -330,7 +329,7 @@ export const StickyEventEditor: React.FC<IEditorProps> = ({ mxEvent, onBack }) =
|
||||
const defaultContent = mxEvent
|
||||
? stringify(mxEvent.getContent())
|
||||
: stringify({
|
||||
msc4354_sticky_key: uuidv4(),
|
||||
msc4354_sticky_key: window.crypto.randomUUID(),
|
||||
});
|
||||
return <EventEditor fieldDefs={fields} defaultContent={defaultContent} onSend={onSend} onBack={onBack} />;
|
||||
};
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
* Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
|
||||
import { SettingLevel } from "../../settings/SettingLevel";
|
||||
import SettingsStore from "../../settings/SettingsStore";
|
||||
import Modal from "../../Modal";
|
||||
@@ -43,7 +41,7 @@ export async function createSection(): Promise<boolean> {
|
||||
const [shouldCreateSection, sectionName] = await modal.finished;
|
||||
if (!shouldCreateSection || !sectionName) return false;
|
||||
|
||||
const tag = `element.io.section.${uuidv4()}`;
|
||||
const tag = `element.io.section.${window.crypto.randomUUID()}`;
|
||||
const newSection: CustomSection = { tag, name: sectionName };
|
||||
|
||||
// Save the new section data
|
||||
|
||||
@@ -7,7 +7,6 @@ Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
|
||||
/*
|
||||
* Functionality for checking that only one instance is running at once
|
||||
@@ -107,7 +106,7 @@ export function checkSessionLockFree(): boolean {
|
||||
*/
|
||||
export async function getSessionLock(onNewInstance: () => Promise<void>): Promise<boolean> {
|
||||
/** unique ID for this session */
|
||||
const sessionIdentifier = uuidv4();
|
||||
const sessionIdentifier = window.crypto.randomUUID();
|
||||
|
||||
const prefixedLogger = logger.getChild(`getSessionLock[${sessionIdentifier}]`);
|
||||
|
||||
|
||||
@@ -253,8 +253,6 @@ describe("SessionLock", () => {
|
||||
|
||||
// import the dependencies of getSessionLock into the new context
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||
window2._uuid = require("uuid");
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||
window2._logger = require("matrix-js-sdk/src/logger");
|
||||
window2.SESSION_LOCK_CONSTANTS = SESSION_LOCK_CONSTANTS;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user