Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Extract shared function

Manav Rathi7704b902c44e
diff --git a/web/apps/cast/src/services/wasm/ffmpeg.ts b/web/apps/cast/src/services/wasm/ffmpeg.ts
index ce6f871ed7..bd567f07e9 100644
--- a/web/apps/cast/src/services/wasm/ffmpeg.ts
+++ b/web/apps/cast/src/services/wasm/ffmpeg.ts
@@ -1,10 +1,10 @@
import { addLogLine } from "@ente/shared/logging";
import { promiseWithTimeout } from "@ente/shared/promise";
import { logError } from "@ente/shared/sentry";
+import { generateTempName } from "@ente/shared/utils/temp";
import { createFFmpeg, FFmpeg } from "ffmpeg-wasm";
import QueueProcessor from "services/queueProcessor";
import { getUint8ArrayView } from "services/readerService";
-import { generateTempName } from "utils/temp";
const INPUT_PATH_PLACEHOLDER = "INPUT";
const FFMPEG_PLACEHOLDER = "FFMPEG";
diff --git a/web/apps/photos/src/services/wasm/ffmpeg.ts b/web/apps/photos/src/services/wasm/ffmpeg.ts
index 93413e5811..ae6ad1498e 100644
--- a/web/apps/photos/src/services/wasm/ffmpeg.ts
+++ b/web/apps/photos/src/services/wasm/ffmpeg.ts
@@ -1,10 +1,10 @@
import { addLogLine } from "@ente/shared/logging";
import { logError } from "@ente/shared/sentry";
+import { generateTempName } from "@ente/shared/utils/temp";
import { createFFmpeg, FFmpeg } from "ffmpeg-wasm";
import QueueProcessor from "services/queueProcessor";
import { getUint8ArrayView } from "services/readerService";
import { promiseWithTimeout } from "utils/common";
-import { generateTempName } from "utils/temp";
const INPUT_PATH_PLACEHOLDER = "INPUT";
const FFMPEG_PLACEHOLDER = "FFMPEG";
diff --git a/web/apps/photos/src/utils/temp/index.ts b/web/apps/photos/src/utils/temp/index.ts
deleted file mode 100644
index 984f4abb05..0000000000
--- a/web/apps/photos/src/utils/temp/index.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-const CHARACTERS =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
-
-export function generateTempName(length: number, suffix: string) {
- let tempName = "";
-
- const charactersLength = CHARACTERS.length;
- for (let i = 0; i < length; i++) {
- tempName += CHARACTERS.charAt(
- Math.floor(Math.random() * charactersLength),
- );
- }
- return `${tempName}-${suffix}`;
-}
diff --git a/web/apps/cast/src/utils/temp/index.ts b/web/packages/shared/utils/temp.ts
similarity index 100%
rename from web/apps/cast/src/utils/temp/index.ts
rename to web/packages/shared/utils/temp.ts