π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
handle unsafe returns
Manav Rathi76c98bdf3268
diff --git a/desktop/.eslintrc.js b/desktop/.eslintrc.jsindex 33c458b14c..ed16db5264 100644--- a/desktop/.eslintrc.js+++ b/desktop/.eslintrc.js@@ -33,7 +33,5 @@ module.exports = {ignoreArrowShorthand: true,},],- /* Temporary (RIP) */- "@typescript-eslint/no-unsafe-return": "off",},};diff --git a/desktop/src/main/services/ml-clip.ts b/desktop/src/main/services/ml-clip.tsindex ddbfb0881d..c9378edf29 100644--- a/desktop/src/main/services/ml-clip.ts+++ b/desktop/src/main/services/ml-clip.ts@@ -64,7 +64,7 @@ const getRGBData = async (jpegFilePath: string): Promise<number[]> => {const ny2 = 224;const totalSize = 3 * nx2 * ny2;- const result = Array(totalSize).fill(0);+ const result = Array<number>(totalSize).fill(0);const scale = Math.max(nx, ny) / 224;const nx3 = Math.round(nx / scale);diff --git a/desktop/src/preload.ts b/desktop/src/preload.tsindex ecc800db3c..2b5eb8fcc3 100644--- a/desktop/src/preload.ts+++ b/desktop/src/preload.ts@@ -51,26 +51,23 @@ import type {// - General-const appVersion = (): Promise<string> => ipcRenderer.invoke("appVersion");+const appVersion = () => ipcRenderer.invoke("appVersion");const logToDisk = (message: string): void =>ipcRenderer.send("logToDisk", message);-const openDirectory = (dirPath: string): Promise<void> =>+const openDirectory = (dirPath: string) =>ipcRenderer.invoke("openDirectory", dirPath);-const openLogDirectory = (): Promise<void> =>- ipcRenderer.invoke("openLogDirectory");+const openLogDirectory = () => ipcRenderer.invoke("openLogDirectory");-const selectDirectory = (): Promise<string | undefined> =>- ipcRenderer.invoke("selectDirectory");+const selectDirectory = () => ipcRenderer.invoke("selectDirectory");const clearStores = () => ipcRenderer.send("clearStores");-const encryptionKey = (): Promise<string | undefined> =>- ipcRenderer.invoke("encryptionKey");+const encryptionKey = () => ipcRenderer.invoke("encryptionKey");-const saveEncryptionKey = (encryptionKey: string): Promise<void> =>+const saveEncryptionKey = (encryptionKey: string) =>ipcRenderer.invoke("saveEncryptionKey", encryptionKey);const onMainWindowFocus = (cb?: () => void) => {@@ -102,39 +99,36 @@ const skipAppUpdate = (version: string) => {// - FS-const fsExists = (path: string): Promise<boolean> =>- ipcRenderer.invoke("fsExists", path);+const fsExists = (path: string) => ipcRenderer.invoke("fsExists", path);-const fsMkdirIfNeeded = (dirPath: string): Promise<void> =>+const fsMkdirIfNeeded = (dirPath: string) =>ipcRenderer.invoke("fsMkdirIfNeeded", dirPath);-const fsRename = (oldPath: string, newPath: string): Promise<void> =>+const fsRename = (oldPath: string, newPath: string) =>ipcRenderer.invoke("fsRename", oldPath, newPath);-const fsRmdir = (path: string): Promise<void> =>- ipcRenderer.invoke("fsRmdir", path);+const fsRmdir = (path: string) => ipcRenderer.invoke("fsRmdir", path);-const fsRm = (path: string): Promise<void> => ipcRenderer.invoke("fsRm", path);+const fsRm = (path: string) => ipcRenderer.invoke("fsRm", path);-const fsReadTextFile = (path: string): Promise<string> =>+const fsReadTextFile = (path: string) =>ipcRenderer.invoke("fsReadTextFile", path);-const fsWriteFile = (path: string, contents: string): Promise<void> =>+const fsWriteFile = (path: string, contents: string) =>ipcRenderer.invoke("fsWriteFile", path, contents);-const fsIsDir = (dirPath: string): Promise<boolean> =>- ipcRenderer.invoke("fsIsDir", dirPath);+const fsIsDir = (dirPath: string) => ipcRenderer.invoke("fsIsDir", dirPath);// - Conversion-const convertToJPEG = (imageData: Uint8Array): Promise<Uint8Array> =>+const convertToJPEG = (imageData: Uint8Array) =>ipcRenderer.invoke("convertToJPEG", imageData);const generateImageThumbnail = (dataOrPathOrZipItem: Uint8Array | string | ZipItem,maxDimension: number,maxSize: number,-): Promise<Uint8Array> =>+) =>ipcRenderer.invoke("generateImageThumbnail",dataOrPathOrZipItem,@@ -147,7 +141,7 @@ const ffmpegExec = (dataOrPathOrZipItem: Uint8Array | string | ZipItem,outputFileExtension: string,timeoutMS: number,-): Promise<Uint8Array> =>+) =>ipcRenderer.invoke("ffmpegExec",command,@@ -158,44 +152,37 @@ const ffmpegExec = (// - ML-const clipImageEmbedding = (jpegImageData: Uint8Array): Promise<Float32Array> =>+const clipImageEmbedding = (jpegImageData: Uint8Array) =>ipcRenderer.invoke("clipImageEmbedding", jpegImageData);-const clipTextEmbeddingIfAvailable = (- text: string,-): Promise<Float32Array | undefined> =>+const clipTextEmbeddingIfAvailable = (text: string) =>ipcRenderer.invoke("clipTextEmbeddingIfAvailable", text);-const detectFaces = (input: Float32Array): Promise<Float32Array> =>+const detectFaces = (input: Float32Array) =>ipcRenderer.invoke("detectFaces", input);-const faceEmbedding = (input: Float32Array): Promise<Float32Array> =>+const faceEmbedding = (input: Float32Array) =>ipcRenderer.invoke("faceEmbedding", input);// - Watch-const watchGet = (): Promise<FolderWatch[]> => ipcRenderer.invoke("watchGet");+const watchGet = () => ipcRenderer.invoke("watchGet");-const watchAdd = (- folderPath: string,- collectionMapping: CollectionMapping,-): Promise<FolderWatch[]> =>+const watchAdd = (folderPath: string, collectionMapping: CollectionMapping) =>ipcRenderer.invoke("watchAdd", folderPath, collectionMapping);-const watchRemove = (folderPath: string): Promise<FolderWatch[]> =>+const watchRemove = (folderPath: string) =>ipcRenderer.invoke("watchRemove", folderPath);const watchUpdateSyncedFiles = (syncedFiles: FolderWatch["syncedFiles"],folderPath: string,-): Promise<void> =>- ipcRenderer.invoke("watchUpdateSyncedFiles", syncedFiles, folderPath);+) => ipcRenderer.invoke("watchUpdateSyncedFiles", syncedFiles, folderPath);const watchUpdateIgnoredFiles = (ignoredFiles: FolderWatch["ignoredFiles"],folderPath: string,-): Promise<void> =>- ipcRenderer.invoke("watchUpdateIgnoredFiles", ignoredFiles, folderPath);+) => ipcRenderer.invoke("watchUpdateIgnoredFiles", ignoredFiles, folderPath);const watchOnAddFile = (f: (path: string, watch: FolderWatch) => void) => {ipcRenderer.removeAllListeners("watchAddFile");@@ -218,34 +205,31 @@ const watchOnRemoveDir = (f: (path: string, watch: FolderWatch) => void) => {);};-const watchFindFiles = (folderPath: string): Promise<string[]> =>+const watchFindFiles = (folderPath: string) =>ipcRenderer.invoke("watchFindFiles", folderPath);// - Uploadconst pathForFile = (file: File) => webUtils.getPathForFile(file);-const listZipItems = (zipPath: string): Promise<ZipItem[]> =>+const listZipItems = (zipPath: string) =>ipcRenderer.invoke("listZipItems", zipPath);-const pathOrZipItemSize = (pathOrZipItem: string | ZipItem): Promise<number> =>+const pathOrZipItemSize = (pathOrZipItem: string | ZipItem) =>ipcRenderer.invoke("pathOrZipItemSize", pathOrZipItem);-const pendingUploads = (): Promise<PendingUploads | undefined> =>- ipcRenderer.invoke("pendingUploads");+const pendingUploads = () => ipcRenderer.invoke("pendingUploads");-const setPendingUploads = (pendingUploads: PendingUploads): Promise<void> =>+const setPendingUploads = (pendingUploads: PendingUploads) =>ipcRenderer.invoke("setPendingUploads", pendingUploads);-const markUploadedFiles = (paths: PendingUploads["filePaths"]): Promise<void> =>+const markUploadedFiles = (paths: PendingUploads["filePaths"]) =>ipcRenderer.invoke("markUploadedFiles", paths);-const markUploadedZipItems = (- items: PendingUploads["zipItems"],-): Promise<void> => ipcRenderer.invoke("markUploadedZipItems", items);+const markUploadedZipItems = (items: PendingUploads["zipItems"]) =>+ ipcRenderer.invoke("markUploadedZipItems", items);-const clearPendingUploads = (): Promise<void> =>- ipcRenderer.invoke("clearPendingUploads");+const clearPendingUploads = () => ipcRenderer.invoke("clearPendingUploads");/*** These objects exposed here will become available to the JS code in our