Skip to content

armgit / ente

Public Imported from GitHub
0

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

Get to a mergeable state

Manav Rathi51a1c77720c3
diff --git a/web/apps/photos/src/services/ffmpeg.ts b/web/apps/photos/src/services/ffmpeg.ts
index 2778efb26f..58b182e73b 100644
--- a/web/apps/photos/src/services/ffmpeg.ts
+++ b/web/apps/photos/src/services/ffmpeg.ts
@@ -212,6 +212,8 @@ const ffmpegExecWeb = async (
*
* See also: {@link ffmpegExecWeb}.
*/
+/*
+TODO(MR): Remove me
const ffmpegExecNative = async (
electron: Electron,
command: string[],
@@ -227,6 +229,7 @@ const ffmpegExecNative = async (
return await worker.exec(command, blob, timeoutMs);
}
};
+*/
const ffmpegExec2 = async (
command: string[],
diff --git a/web/apps/photos/src/services/upload/metadata.ts b/web/apps/photos/src/services/upload/metadata.ts
index c3ccea0e28..4cda767a03 100644
--- a/web/apps/photos/src/services/upload/metadata.ts
+++ b/web/apps/photos/src/services/upload/metadata.ts
@@ -18,7 +18,6 @@ import {
FileTypeInfo,
Metadata,
ParsedExtractedMetadata,
- type DataStream,
type LivePhotoAssets2,
type UploadAsset2,
} from "types/upload";
@@ -30,6 +29,7 @@ import {
type ParsedMetadataJSON,
} from "./takeout";
import { getFileName } from "./uploadService";
+import type { DataStream } from "@ente/shared/utils/data-stream";
const EXIF_TAGS_NEEDED = [
"DateTimeOriginal",
diff --git a/web/apps/photos/src/services/upload/uploadService.ts b/web/apps/photos/src/services/upload/uploadService.ts
index 5e4ee0b008..b27843186f 100644
--- a/web/apps/photos/src/services/upload/uploadService.ts
+++ b/web/apps/photos/src/services/upload/uploadService.ts
@@ -34,8 +34,6 @@ import {
UploadAsset,
UploadFile,
UploadURL,
- isDataStream,
- type DataStream,
type FileWithCollection2,
type LivePhotoAssets,
type LivePhotoAssets2,
@@ -61,6 +59,7 @@ import {
} from "./thumbnail";
import uploadCancelService from "./uploadCancelService";
import UploadHttpClient from "./uploadHttpClient";
+import { isDataStream, type DataStream } from "@ente/shared/utils/data-stream";
/** Upload files to cloud storage */
class UploadService {
diff --git a/web/apps/photos/src/types/upload/index.ts b/web/apps/photos/src/types/upload/index.ts
index aef7474a4c..c687911c71 100644
--- a/web/apps/photos/src/types/upload/index.ts
+++ b/web/apps/photos/src/types/upload/index.ts
@@ -3,6 +3,7 @@ import {
B64EncryptionResult,
LocalFileAttributes,
} from "@ente/shared/crypto/types";
+import type { DataStream } from "@ente/shared/utils/data-stream";
import { FILE_TYPE } from "constants/file";
import { Collection } from "types/collection";
import {
@@ -92,15 +93,6 @@ export interface UploadURL {
objectKey: string;
}
-export interface DataStream {
- stream: ReadableStream<Uint8Array>;
- chunkCount: number;
-}
-
-export function isDataStream(object: any): object is DataStream {
- return "stream" in object;
-}
-
export interface FileInMemory {
filedata: Uint8Array | DataStream;
/** The JPEG data of the generated thumbnail */
diff --git a/web/apps/photos/tests/zip-file-reading.test.ts b/web/apps/photos/tests/zip-file-reading.test.ts
index 07d70f067d..ea7511d0b4 100644
--- a/web/apps/photos/tests/zip-file-reading.test.ts
+++ b/web/apps/photos/tests/zip-file-reading.test.ts
@@ -1,7 +1,7 @@
import { getFileNameSize } from "@/next/file";
+import type { DataStream } from "@ente/shared/utils/data-stream";
import { FILE_READER_CHUNK_SIZE, PICKED_UPLOAD_TYPE } from "constants/upload";
import { getElectronFileStream, getFileStream } from "services/readerService";
-import { DataStream } from "types/upload";
import { getImportSuggestion } from "utils/upload";
// This was for used to verify that converting from the browser readable stream
diff --git a/web/packages/shared/crypto/types.ts b/web/packages/shared/crypto/types.ts
index 4cf4c56b1f..47bfa8b2ce 100644
--- a/web/packages/shared/crypto/types.ts
+++ b/web/packages/shared/crypto/types.ts
@@ -1,4 +1,4 @@
-import { DataStream } from "@/next/types/file";
+import type { DataStream } from "../utils/data-stream";
export interface LocalFileAttributes<
T extends string | Uint8Array | DataStream,
diff --git a/web/packages/shared/utils/data-stream.ts b/web/packages/shared/utils/data-stream.ts
new file mode 100644
index 0000000000..d072dfe7ec
--- /dev/null
+++ b/web/packages/shared/utils/data-stream.ts
@@ -0,0 +1,8 @@
+export interface DataStream {
+ stream: ReadableStream<Uint8Array>;
+ chunkCount: number;
+}
+
+export function isDataStream(object: any): object is DataStream {
+ return "stream" in object;
+}