π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Rename for incoming increased scope
Manav Rathid95864be1cde
diff --git a/desktop/src/main/services/ffmpeg.ts b/desktop/src/main/services/ffmpeg.tsindex c80d595744..4da85851c4 100644--- a/desktop/src/main/services/ffmpeg.ts+++ b/desktop/src/main/services/ffmpeg.ts@@ -7,7 +7,7 @@ import log from "../log";import { execAsync } from "../utils/electron";import {deleteTempFileIgnoringErrors,- makeFileForDataOrPathOrZipItem,+ makeFileForDataOrStreamOrPathOrZipItem,makeTempFilePath,} from "../utils/temp";@@ -52,7 +52,7 @@ export const ffmpegExec = async (path: inputFilePath,isFileTemporary: isInputFileTemporary,writeToTemporaryFile: writeToTemporaryInputFile,- } = await makeFileForDataOrPathOrZipItem(dataOrPathOrZipItem);+ } = await makeFileForDataOrStreamOrPathOrZipItem(dataOrPathOrZipItem);const outputFilePath = await makeTempFilePath(outputFileExtension);try {diff --git a/desktop/src/main/services/image.ts b/desktop/src/main/services/image.tsindex 1c8574d287..7daa101d2a 100644--- a/desktop/src/main/services/image.ts+++ b/desktop/src/main/services/image.ts@@ -6,7 +6,7 @@ import { type ZipItem } from "../../types/ipc";import { execAsync, isDev } from "../utils/electron";import {deleteTempFileIgnoringErrors,- makeFileForDataOrPathOrZipItem,+ makeFileForDataOrStreamOrPathOrZipItem,makeTempFilePath,} from "../utils/temp";@@ -69,7 +69,7 @@ export const generateImageThumbnail = async (path: inputFilePath,isFileTemporary: isInputFileTemporary,writeToTemporaryFile: writeToTemporaryInputFile,- } = await makeFileForDataOrPathOrZipItem(dataOrPathOrZipItem);+ } = await makeFileForDataOrStreamOrPathOrZipItem(dataOrPathOrZipItem);const outputFilePath = await makeTempFilePath("jpeg");diff --git a/desktop/src/main/utils/temp.ts b/desktop/src/main/utils/temp.tsindex ab9b602aac..9a9b800535 100644--- a/desktop/src/main/utils/temp.ts+++ b/desktop/src/main/utils/temp.ts@@ -79,7 +79,7 @@ export const deleteTempFileIgnoringErrors = async (tempFilePath: string) => {}};-/** The result of {@link makeFileForDataOrPathOrZipItem}. */+/** The result of {@link makeFileForDataOrStreamOrPathOrZipItem}. */interface FileForDataOrPathOrZipItem {/*** The path to the file (possibly temporary).@@ -104,14 +104,14 @@ interface FileForDataOrPathOrZipItem {/*** Return the path to a file, a boolean indicating if this is a temporary path* that needs to be deleted after processing, and a function to write the given- * {@link dataOrPathOrZipItem} into that temporary file if needed.+ * {@link item} into that temporary file if needed.*- * @param dataOrPathOrZipItem The contents of the file, or the path to an- * existing file, or a (path to a zip file, name of an entry within that zip- * file) tuple.+ * @param item The contents of the file (bytes), or a {@link ReadableStream}+ * with the contents of the file, or the path to an existing file, or a (path to+ * a zip file, name of an entry within that zip file) tuple.*/-export const makeFileForDataOrPathOrZipItem = async (- dataOrPathOrZipItem: Uint8Array | string | ZipItem,+export const makeFileForDataOrStreamOrPathOrZipItem = async (+ item: Uint8Array | string | ZipItem,): Promise<FileForDataOrPathOrZipItem> => {let path: string;let isFileTemporary: boolean;@@ -119,18 +119,17 @@ export const makeFileForDataOrPathOrZipItem = async (/* no-op */};- if (typeof dataOrPathOrZipItem == "string") {- path = dataOrPathOrZipItem;+ if (typeof item == "string") {+ path = item;isFileTemporary = false;} else {path = await makeTempFilePath();isFileTemporary = true;- if (dataOrPathOrZipItem instanceof Uint8Array) {- writeToTemporaryFile = () =>- fs.writeFile(path, dataOrPathOrZipItem);+ if (item instanceof Uint8Array) {+ writeToTemporaryFile = () => fs.writeFile(path, item);} else {writeToTemporaryFile = async () => {- const [zipPath, entryName] = dataOrPathOrZipItem;+ const [zipPath, entryName] = item;const zip = openZip(zipPath);try {await zip.extract(entryName, path);