Skip to content

armgit / ente

Public Imported from GitHub
0

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

Dedup type

Manav Rathi2a647e3ddba5
diff --git a/web/apps/photos/src/components/Upload/Uploader.tsx b/web/apps/photos/src/components/Upload/Uploader.tsx
index 2ae077daf3..7b4bc4fa34 100644
--- a/web/apps/photos/src/components/Upload/Uploader.tsx
+++ b/web/apps/photos/src/components/Upload/Uploader.tsx
@@ -1,5 +1,6 @@
import { ensureElectron } from "@/next/electron";
import log from "@/next/log";
+import { ElectronFile } from "@/next/types/file";
import type { CollectionMapping, Electron } from "@/next/types/ipc";
import { CustomError } from "@ente/shared/error";
import { isPromise } from "@ente/shared/utils";
@@ -32,11 +33,7 @@ import {
SetLoading,
UploadTypeSelectorIntent,
} from "types/gallery";
-import {
- ElectronFile,
- FileWithCollection,
- type FileWithCollection2,
-} from "types/upload";
+import { FileWithCollection, type FileWithCollection2 } from "types/upload";
import {
InProgressUpload,
SegregatedFinishedUploads,
diff --git a/web/apps/photos/src/services/ffmpeg.ts b/web/apps/photos/src/services/ffmpeg.ts
index cce3a35abc..9f6cec0b6d 100644
--- a/web/apps/photos/src/services/ffmpeg.ts
+++ b/web/apps/photos/src/services/ffmpeg.ts
@@ -1,3 +1,4 @@
+import { ElectronFile } from "@/next/types/file";
import { ComlinkWorker } from "@/next/worker/comlink-worker";
import { validateAndGetCreationUnixTimeInMicroSeconds } from "@ente/shared/time";
import { Remote } from "comlink";
@@ -7,7 +8,7 @@ import {
outputPathPlaceholder,
} from "constants/ffmpeg";
import { NULL_LOCATION } from "constants/upload";
-import { ElectronFile, ParsedExtractedMetadata } from "types/upload";
+import { ParsedExtractedMetadata } from "types/upload";
import { type DedicatedFFmpegWorker } from "worker/ffmpeg.worker";
/** Called during upload */
@@ -30,7 +31,8 @@ export async function generateVideoThumbnail(
"scale=-1:720",
outputPathPlaceholder,
],
- file,
+ /* TODO(MR): ElectronFile changes */
+ fileOrPath as File | ElectronFile,
"thumb.jpeg",
);
} catch (e) {
@@ -168,17 +170,23 @@ const ffmpegExec = async (
): Promise<File | ElectronFile> => {
const electron = globalThis.electron;
if (electron || false) {
- return electron.ffmpegExec(
- command,
- inputDataOrPath,
- outputFileName,
- timeoutMS
- )
+ // return electron.ffmpegExec(
+ // command,
+ // /* TODO(MR): ElectronFile changes */
+ // inputFile as unknown as string,
+ // outputFileName,
+ // timeoutMS,
+ // );
} else {
return workerFactory
.instance()
.then((worker) =>
- worker.execute(command, inputFile, outputFileName, timeoutMS),
+ worker.execute(
+ command,
+ /* TODO(MR): ElectronFile changes */ inputFile as File,
+ outputFileName,
+ timeoutMS,
+ ),
);
}
};
diff --git a/web/apps/photos/src/services/readerService.ts b/web/apps/photos/src/services/readerService.ts
index e410144cfe..e30710d5ad 100644
--- a/web/apps/photos/src/services/readerService.ts
+++ b/web/apps/photos/src/services/readerService.ts
@@ -1,6 +1,6 @@
import { convertBytesToHumanReadable } from "@/next/file";
import log from "@/next/log";
-import { ElectronFile } from "types/upload";
+import { ElectronFile } from "@/next/types/file";
export async function getUint8ArrayView(
file: Blob | ElectronFile,
diff --git a/web/apps/photos/src/services/typeDetectionService.ts b/web/apps/photos/src/services/typeDetectionService.ts
index 5ff8f01692..5b53eecbc0 100644
--- a/web/apps/photos/src/services/typeDetectionService.ts
+++ b/web/apps/photos/src/services/typeDetectionService.ts
@@ -1,4 +1,5 @@
import log from "@/next/log";
+import { ElectronFile } from "@/next/types/file";
import { CustomError } from "@ente/shared/error";
import { FILE_TYPE } from "constants/file";
import {
@@ -6,7 +7,7 @@ import {
WHITELISTED_FILE_FORMATS,
} from "constants/upload";
import FileType, { FileTypeResult } from "file-type";
-import { ElectronFile, FileTypeInfo } from "types/upload";
+import { FileTypeInfo } from "types/upload";
import { getFileExtension } from "utils/file";
import { getUint8ArrayView } from "./readerService";
diff --git a/web/apps/photos/src/services/upload/metadataService.ts b/web/apps/photos/src/services/upload/metadataService.ts
index d1c98ff690..367d79bbad 100644
--- a/web/apps/photos/src/services/upload/metadataService.ts
+++ b/web/apps/photos/src/services/upload/metadataService.ts
@@ -1,6 +1,7 @@
import { ensureElectron } from "@/next/electron";
import { basename, getFileNameSize } from "@/next/file";
import log from "@/next/log";
+import { ElectronFile } from "@/next/types/file";
import { DedicatedCryptoWorker } from "@ente/shared/crypto/internal/crypto.worker";
import { CustomError } from "@ente/shared/error";
import {
@@ -17,7 +18,6 @@ import { getFileType } from "services/typeDetectionService";
import { FilePublicMagicMetadataProps } from "types/file";
import {
DataStream,
- ElectronFile,
ExtractMetadataResult,
FileTypeInfo,
LivePhotoAssets,
diff --git a/web/apps/photos/src/services/upload/thumbnail.ts b/web/apps/photos/src/services/upload/thumbnail.ts
index 91b1ea9fb3..82f4486b42 100644
--- a/web/apps/photos/src/services/upload/thumbnail.ts
+++ b/web/apps/photos/src/services/upload/thumbnail.ts
@@ -1,12 +1,13 @@
import { getFileNameSize } from "@/next/file";
import log from "@/next/log";
+import { ElectronFile } from "@/next/types/file";
import { CustomErrorMessage, type Electron } from "@/next/types/ipc";
import { CustomError } from "@ente/shared/error";
import { FILE_TYPE } from "constants/file";
import { BLACK_THUMBNAIL_BASE64 } from "constants/upload";
import * as FFmpegService from "services/ffmpeg";
import { heicToJPEG } from "services/heic-convert";
-import { ElectronFile, FileTypeInfo } from "types/upload";
+import { FileTypeInfo } from "types/upload";
import { isFileHEIC } from "utils/file";
import { getUint8ArrayView } from "../readerService";
import { getFileName } from "./uploadService";
diff --git a/web/apps/photos/src/services/upload/uploadManager.ts b/web/apps/photos/src/services/upload/uploadManager.ts
index 05a336be59..65ce7d77f2 100644
--- a/web/apps/photos/src/services/upload/uploadManager.ts
+++ b/web/apps/photos/src/services/upload/uploadManager.ts
@@ -1,5 +1,6 @@
import { ensureElectron } from "@/next/electron";
import log from "@/next/log";
+import { ElectronFile } from "@/next/types/file";
import { ComlinkWorker } from "@/next/worker/comlink-worker";
import { getDedicatedCryptoWorker } from "@ente/shared/crypto";
import { DedicatedCryptoWorker } from "@ente/shared/crypto/internal/crypto.worker";
@@ -18,7 +19,6 @@ import { Collection } from "types/collection";
import { EncryptedEnteFile, EnteFile } from "types/file";
import { SetFiles } from "types/gallery";
import {
- ElectronFile,
FileWithCollection,
ParsedMetadataJSON,
ParsedMetadataJSONMap,
diff --git a/web/apps/photos/src/services/upload/uploadService.ts b/web/apps/photos/src/services/upload/uploadService.ts
index 78953bd241..7a118d3030 100644
--- a/web/apps/photos/src/services/upload/uploadService.ts
+++ b/web/apps/photos/src/services/upload/uploadService.ts
@@ -5,6 +5,7 @@ import {
getFileNameSize,
} from "@/next/file";
import log from "@/next/log";
+import { ElectronFile } from "@/next/types/file";
import { DedicatedCryptoWorker } from "@ente/shared/crypto/internal/crypto.worker";
import {
B64EncryptionResult,
@@ -30,7 +31,6 @@ import { EncryptedMagicMetadata } from "types/magicMetadata";
import {
BackupedFile,
DataStream,
- ElectronFile,
EncryptedFile,
ExtractMetadataResult,
FileInMemory,
diff --git a/web/apps/photos/src/types/upload/index.ts b/web/apps/photos/src/types/upload/index.ts
index 78b46670c6..175af6824f 100644
--- a/web/apps/photos/src/types/upload/index.ts
+++ b/web/apps/photos/src/types/upload/index.ts
@@ -1,3 +1,4 @@
+import type { ElectronFile } from "@/next/types/file";
import {
B64EncryptionResult,
LocalFileAttributes,
@@ -70,24 +71,6 @@ export interface FileTypeInfo {
videoType?: string;
}
-/*
- * ElectronFile is a custom interface that is used to represent
- * any file on disk as a File-like object in the Electron desktop app.
- *
- * This was added to support the auto-resuming of failed uploads
- * which needed absolute paths to the files which the
- * normal File interface does not provide.
- */
-export interface ElectronFile {
- name: string;
- path: string;
- size: number;
- lastModified: number;
- stream: () => Promise<ReadableStream<Uint8Array>>;
- blob: () => Promise<Blob>;
- arrayBuffer: () => Promise<Uint8Array>;
-}
-
export interface UploadAsset {
isLivePhoto?: boolean;
file?: File | ElectronFile;
diff --git a/web/apps/photos/src/utils/upload/index.ts b/web/apps/photos/src/utils/upload/index.ts
index 7d082166cf..ac05122aa9 100644
--- a/web/apps/photos/src/utils/upload/index.ts
+++ b/web/apps/photos/src/utils/upload/index.ts
@@ -1,11 +1,11 @@
import { basename, dirname } from "@/next/file";
+import { ElectronFile } from "@/next/types/file";
import { FILE_TYPE } from "constants/file";
import { PICKED_UPLOAD_TYPE } from "constants/upload";
import isElectron from "is-electron";
import { exportMetadataDirectoryName } from "services/export";
import { EnteFile } from "types/file";
import {
- ElectronFile,
FileWithCollection,
Metadata,
type FileWithCollection2,