Skip to content

armgit / ente

Public Imported from GitHub
0

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

Remove unused

Manav Rathi8ba952c3b8a3
diff --git a/desktop/src/main/dialogs.ts b/desktop/src/main/dialogs.ts
index 2f91f5c400..f119e3d133 100644
--- a/desktop/src/main/dialogs.ts
+++ b/desktop/src/main/dialogs.ts
@@ -1,7 +1,8 @@
import { dialog } from "electron/main";
+import fs from "node:fs/promises";
import path from "node:path";
import type { ElectronFile } from "../types/ipc";
-import { getDirFilePaths, getElectronFile } from "./services/fs";
+import { getElectronFile } from "./services/fs";
import { getElectronFilesFromGoogleZip } from "./services/upload";
export const selectDirectory = async () => {
@@ -34,6 +35,23 @@ export const showUploadDirsDialog = async () => {
return await Promise.all(filePaths.map(getElectronFile));
};
+// https://stackoverflow.com/a/63111390
+const getDirFilePaths = async (dirPath: string) => {
+ if (!(await fs.stat(dirPath)).isDirectory()) {
+ return [dirPath];
+ }
+
+ let files: string[] = [];
+ const filePaths = await fs.readdir(dirPath);
+
+ for (const filePath of filePaths) {
+ const absolute = path.join(dirPath, filePath);
+ files = [...files, ...(await getDirFilePaths(absolute))];
+ }
+
+ return files;
+};
+
export const showUploadZipDialog = async () => {
const selectedFiles = await dialog.showOpenDialog({
properties: ["openFile", "multiSelections"],
diff --git a/desktop/src/main/ipc.ts b/desktop/src/main/ipc.ts
index 2475d77892..825a2ed32b 100644
--- a/desktop/src/main/ipc.ts
+++ b/desktop/src/main/ipc.ts
@@ -40,7 +40,6 @@ import {
updateOnNextRestart,
} from "./services/app-update";
import { ffmpegExec } from "./services/ffmpeg";
-import { getDirFiles } from "./services/fs";
import { convertToJPEG, generateImageThumbnail } from "./services/image";
import {
clipImageEmbedding,
@@ -216,8 +215,6 @@ export const attachIPCHandlers = () => {
ipcMain.handle("getElectronFilesFromGoogleZip", (_, filePath: string) =>
getElectronFilesFromGoogleZip(filePath),
);
-
- ipcMain.handle("getDirFiles", (_, dirPath: string) => getDirFiles(dirPath));
};
/**
diff --git a/desktop/src/main/services/fs.ts b/desktop/src/main/services/fs.ts
index 30ccf146ba..609fc82d7e 100644
--- a/desktop/src/main/services/fs.ts
+++ b/desktop/src/main/services/fs.ts
@@ -7,29 +7,6 @@ import log from "../log";
const FILE_STREAM_CHUNK_SIZE: number = 4 * 1024 * 1024;
-export async function getDirFiles(dirPath: string) {
- const files = await getDirFilePaths(dirPath);
- const electronFiles = await Promise.all(files.map(getElectronFile));
- return electronFiles;
-}
-
-// https://stackoverflow.com/a/63111390
-export const getDirFilePaths = async (dirPath: string) => {
- if (!(await fs.stat(dirPath)).isDirectory()) {
- return [dirPath];
- }
-
- let files: string[] = [];
- const filePaths = await fs.readdir(dirPath);
-
- for (const filePath of filePaths) {
- const absolute = path.join(dirPath, filePath);
- files = [...files, ...(await getDirFilePaths(absolute))];
- }
-
- return files;
-};
-
const getFileStream = async (filePath: string) => {
const file = await fs.open(filePath, "r");
let offset = 0;
diff --git a/desktop/src/preload.ts b/desktop/src/preload.ts
index 68308aea9f..18fb550130 100644
--- a/desktop/src/preload.ts
+++ b/desktop/src/preload.ts
@@ -261,9 +261,6 @@ const getElectronFilesFromGoogleZip = (
): Promise<ElectronFile[]> =>
ipcRenderer.invoke("getElectronFilesFromGoogleZip", filePath);
-const getDirFiles = (dirPath: string): Promise<ElectronFile[]> =>
- ipcRenderer.invoke("getDirFiles", dirPath);
-
/**
* These objects exposed here will become available to the JS code in our
* renderer (the web/ code) as `window.ElectronAPIs.*`
@@ -380,5 +377,4 @@ contextBridge.exposeInMainWorld("electron", {
// -
getElectronFilesFromGoogleZip,
- getDirFiles,
});
diff --git a/web/packages/next/types/ipc.ts b/web/packages/next/types/ipc.ts
index 91a9927f2c..1622a820d9 100644
--- a/web/packages/next/types/ipc.ts
+++ b/web/packages/next/types/ipc.ts
@@ -503,7 +503,6 @@ export interface Electron {
getElectronFilesFromGoogleZip: (
filePath: string,
) => Promise<ElectronFile[]>;
- getDirFiles: (dirPath: string) => Promise<ElectronFile[]>;
}
/**