Skip to content

armgit / ente

Public Imported from GitHub
0

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

tail

Manav Rathi3a5843f5324c
diff --git a/web/packages/new/photos/services/ml/blob.ts b/web/packages/new/photos/services/ml/blob.ts
index 015dc7462d..d52772b6a4 100644
--- a/web/packages/new/photos/services/ml/blob.ts
+++ b/web/packages/new/photos/services/ml/blob.ts
@@ -1,4 +1,5 @@
import { basename } from "@/base/file";
+import type { ElectronMLWorker } from "@/base/types/ipc";
import { FileType } from "@/media/file-type";
import { decodeLivePhoto } from "@/media/live-photo";
import { ensure } from "@/utils/ensure";
@@ -7,7 +8,6 @@ import { renderableImageBlob } from "../../utils/file";
import { readStream } from "../../utils/native-stream";
import DownloadManager from "../download";
import type { UploadItem } from "../upload/types";
-import type { MLWorkerElectron } from "./worker-types";
/**
* A pair of blobs - the original, and a possibly converted "renderable" one -
@@ -103,13 +103,14 @@ export const imageBitmapAndData = async (
* be set to the {@link UploadItem} that was uploaded. This way, we can directly
* use the on-disk file instead of needing to download the original from remote.
*
- * @param electron The {@link MLWorkerElectron} instance that allows us to call
- * our Node.js layer for various functionality.
+ * @param electron The {@link ElectronMLWorker} instance that stands as a
+ * witness that we're actually running in our desktop app (and thus can safely
+ * call our Node.js layer for various functionality).
*/
export const indexableBlobs = async (
enteFile: EnteFile,
uploadItem: UploadItem | undefined,
- electron: MLWorkerElectron,
+ electron: ElectronMLWorker,
): Promise<IndexableBlobs> =>
uploadItem
? await indexableUploadItemBlobs(enteFile, uploadItem, electron)
@@ -118,7 +119,7 @@ export const indexableBlobs = async (
const indexableUploadItemBlobs = async (
enteFile: EnteFile,
uploadItem: UploadItem,
- electron: MLWorkerElectron,
+ electron: ElectronMLWorker,
) => {
const fileType = enteFile.metadata.fileType;
let originalImageBlob: Blob | undefined;
@@ -149,7 +150,7 @@ const indexableUploadItemBlobs = async (
*/
const readNonVideoUploadItem = async (
uploadItem: UploadItem,
- electron: MLWorkerElectron,
+ electron: ElectronMLWorker,
): Promise<File> => {
if (typeof uploadItem == "string" || Array.isArray(uploadItem)) {
const { response, lastModifiedMs } = await readStream(
diff --git a/web/packages/new/photos/utils/native-stream.ts b/web/packages/new/photos/utils/native-stream.ts
index 6f61656597..6aee016c0c 100644
--- a/web/packages/new/photos/utils/native-stream.ts
+++ b/web/packages/new/photos/utils/native-stream.ts
@@ -6,8 +6,7 @@
* See: [Note: IPC streams].
*/
-import type { Electron, ZipItem } from "@/base/types/ipc";
-import type { MLWorkerElectron } from "../services/ml/worker-types";
+import type { Electron, ElectronMLWorker, ZipItem } from "@/base/types/ipc";
/**
* Stream the given file or zip entry from the user's local file system.
@@ -18,7 +17,7 @@ import type { MLWorkerElectron } from "../services/ml/worker-types";
*
* To avoid accidentally invoking it in a non-desktop app context, it requires
* the {@link Electron} (or a functionally similar) object as a parameter (even
- * though it doesn't use it).
+ * though it doesn't need or use it).
*
* @param pathOrZipItem Either the path on the file on the user's local file
* system whose contents we want to stream. Or a tuple containing the path to a
@@ -36,7 +35,7 @@ import type { MLWorkerElectron } from "../services/ml/worker-types";
* reading, expressed as epoch milliseconds.
*/
export const readStream = async (
- _: Electron | MLWorkerElectron,
+ _: Electron | ElectronMLWorker,
pathOrZipItem: string | ZipItem,
): Promise<{ response: Response; size: number; lastModifiedMs: number }> => {
let url: URL;