π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
The remaining 2
Manav Rathia9ccec6398f3
diff --git a/desktop/src/main/ipc.ts b/desktop/src/main/ipc.tsindex 429582d996..eab2e8b591 100644--- a/desktop/src/main/ipc.ts+++ b/desktop/src/main/ipc.ts@@ -59,12 +59,12 @@ import {setPendingUploadFiles,} from "./services/upload";import {- updateWatchMappingIgnoredFiles,- updateWatchMappingSyncedFiles,watchAdd,watchFindFiles,watchGet,watchRemove,+ watchUpdateIgnoredFiles,+ watchUpdateSyncedFiles,} from "./services/watch";import { openDirectory, openLogDirectory } from "./util";@@ -236,19 +236,19 @@ export const attachFSWatchIPCHandlers = (watcher: FSWatcher) => {watchRemove(watcher, folderPath),);- ipcMain.handle("watchFindFiles", (_, folderPath: string) =>- watchFindFiles(folderPath),+ ipcMain.handle(+ "watchUpdateSyncedFiles",+ (_, syncedFiles: FolderWatch["syncedFiles"], folderPath: string) =>+ watchUpdateSyncedFiles(syncedFiles, folderPath),);ipcMain.handle(- "updateWatchMappingSyncedFiles",- (_, folderPath: string, files: FolderWatch["syncedFiles"]) =>- updateWatchMappingSyncedFiles(folderPath, files),+ "watchUpdateIgnoredFiles",+ (_, ignoredFiles: FolderWatch["ignoredFiles"], folderPath: string) =>+ watchUpdateIgnoredFiles(ignoredFiles, folderPath),);- ipcMain.handle(- "updateWatchMappingIgnoredFiles",- (_, folderPath: string, files: FolderWatch["ignoredFiles"]) =>- updateWatchMappingIgnoredFiles(folderPath, files),+ ipcMain.handle("watchFindFiles", (_, folderPath: string) =>+ watchFindFiles(folderPath),);};diff --git a/desktop/src/main/services/watch.ts b/desktop/src/main/services/watch.tsindex 3a71c28af6..73a13c5455 100644--- a/desktop/src/main/services/watch.ts+++ b/desktop/src/main/services/watch.ts@@ -100,6 +100,8 @@ export const watchAdd = async (setFolderWatches(watches);watcher.add(folderPath);++ return watches;};export const watchRemove = async (watcher: FSWatcher, folderPath: string) => {@@ -114,39 +116,33 @@ export const watchRemove = async (watcher: FSWatcher, folderPath: string) => {return filtered;};-export function updateWatchMappingSyncedFiles(+export const watchUpdateSyncedFiles = (+ syncedFiles: FolderWatch["syncedFiles"],folderPath: string,- files: FolderWatch["syncedFiles"],-): void {- const watchMappings = getWatchMappings();- const watchMapping = watchMappings.find(- (mapping) => mapping.folderPath === folderPath,+) => {+ setFolderWatches(+ folderWatches().map((watch) => {+ if (watch.folderPath == folderPath) {+ watch.syncedFiles = syncedFiles;+ }+ return watch;+ }),);+};- if (!watchMapping) {- throw Error(`Watch mapping not found`);- }-- watchMapping.syncedFiles = files;- setWatchMappings(watchMappings);-}--export function updateWatchMappingIgnoredFiles(+export const watchUpdateIgnoredFiles = (+ ignoredFiles: FolderWatch["ignoredFiles"],folderPath: string,- files: FolderWatch["ignoredFiles"],-): void {- const watchMappings = getWatchMappings();- const watchMapping = watchMappings.find(- (mapping) => mapping.folderPath === folderPath,+) => {+ setFolderWatches(+ folderWatches().map((watch) => {+ if (watch.folderPath == folderPath) {+ watch.ignoredFiles = ignoredFiles;+ }+ return watch;+ }),);-- if (!watchMapping) {- throw Error(`Watch mapping not found`);- }-- watchMapping.ignoredFiles = files;- setWatchMappings(watchMappings);-}+};export const watchFindFiles = async (dirPath: string) => {const items = await fs.readdir(dirPath, { withFileTypes: true });diff --git a/desktop/src/preload.ts b/desktop/src/preload.tsindex 7af959256b..7d0df41d57 100644--- a/desktop/src/preload.ts+++ b/desktop/src/preload.ts@@ -192,16 +192,28 @@ const showUploadZipDialog = (): Promise<{// - Watch+const watchGet = (): Promise<FolderWatch[]> => ipcRenderer.invoke("watchGet");+const watchAdd = (folderPath: string,collectionMapping: CollectionMapping,-): Promise<void> =>+): Promise<FolderWatch[]> =>ipcRenderer.invoke("watchAdd", folderPath, collectionMapping);-const watchRemove = (folderPath: string): Promise<void> =>+const watchRemove = (folderPath: string): Promise<FolderWatch[]> =>ipcRenderer.invoke("watchRemove", folderPath);-const watchGet = (): Promise<FolderWatch[]> => ipcRenderer.invoke("watchGet");+const watchUpdateSyncedFiles = (+ syncedFiles: FolderWatch["syncedFiles"],+ folderPath: string,+): Promise<void> =>+ ipcRenderer.invoke("watchUpdateSyncedFiles", syncedFiles, folderPath);++const watchUpdateIgnoredFiles = (+ ignoredFiles: FolderWatch["ignoredFiles"],+ folderPath: string,+): Promise<void> =>+ ipcRenderer.invoke("watchUpdateIgnoredFiles", ignoredFiles, folderPath);const watchOnAddFile = (f: (path: string, watch: FolderWatch) => void) => {ipcRenderer.removeAllListeners("watchAddFile");@@ -227,18 +239,6 @@ const watchOnRemoveDir = (f: (path: string, watch: FolderWatch) => void) => {const watchFindFiles = (folderPath: string): Promise<string[]> =>ipcRenderer.invoke("watchFindFiles", folderPath);-const updateWatchMappingSyncedFiles = (- folderPath: string,- files: FolderWatch["syncedFiles"],-): Promise<void> =>- ipcRenderer.invoke("updateWatchMappingSyncedFiles", folderPath, files);--const updateWatchMappingIgnoredFiles = (- folderPath: string,- files: FolderWatch["ignoredFiles"],-): Promise<void> =>- ipcRenderer.invoke("updateWatchMappingIgnoredFiles", folderPath, files);-// - Uploadconst pendingUploads = (): Promise<PendingUploads | undefined> =>@@ -361,9 +361,9 @@ contextBridge.exposeInMainWorld("electron", {onRemoveFile: watchOnRemoveFile,onRemoveDir: watchOnRemoveDir,findFiles: watchFindFiles,+ updateSyncedFiles: watchUpdateSyncedFiles,+ updateIgnoredFiles: watchUpdateIgnoredFiles,},- updateWatchMappingSyncedFiles,- updateWatchMappingIgnoredFiles,// - Uploaddiff --git a/web/packages/next/types/ipc.ts b/web/packages/next/types/ipc.tsindex 098263e2d7..0628bb0ca5 100644--- a/web/packages/next/types/ipc.ts+++ b/web/packages/next/types/ipc.ts@@ -308,19 +308,41 @@ export interface Electron {** @param collectionMapping Determines how nested directories (if any)* get mapped to Ente collections.+ *+ * @returns The updated list of watches.*/add: (folderPath: string,collectionMapping: CollectionMapping,- ) => Promise<void>;+ ) => Promise<FolderWatch[]>;/*** Remove the pre-existing watch for the given {@link folderPath}.** Persist this removal, and also stop listening for file system events* that happen within the {@link folderPath}.+ *+ * @returns The updated list of watches.*/- remove: (folderPath: string) => Promise<void>;+ remove: (folderPath: string) => Promise<FolderWatch[]>;++ /**+ * Update the list of synced files for the folder watch associated+ * with the given {@link folderPath}.+ */+ updateSyncedFiles: (+ syncedFiles: FolderWatch["syncedFiles"],+ folderPath: string,+ ) => Promise<void>;++ /**+ * Update the list of ignored file paths for the folder watch+ * associated with the given {@link folderPath}.+ */+ updateIgnoredFiles: (+ ignoredFiles: FolderWatch["ignoredFiles"],+ folderPath: string,+ ) => Promise<void>;/*** Register the function to invoke when a file is added in one of the@@ -368,16 +390,6 @@ export interface Electron {findFiles: (folderPath: string) => Promise<string[]>;};- updateWatchMappingSyncedFiles: (- folderPath: string,- files: FolderWatch["syncedFiles"],- ) => Promise<void>;-- updateWatchMappingIgnoredFiles: (- folderPath: string,- files: FolderWatch["ignoredFiles"],- ) => Promise<void>;-// - Upload/**