Skip to content

armgit / ente

Public Imported from GitHub
0

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

Remove unused code paths

Manav Rathi476edd8cf53f
diff --git a/desktop/src/main.ts b/desktop/src/main.ts
index 262dceb798..463774dc2b 100644
--- a/desktop/src/main.ts
+++ b/desktop/src/main.ts
@@ -315,32 +315,18 @@ const setupTrayItem = (mainWindow: BrowserWindow) => {
/**
* Older versions of our app used to maintain a cache dir using the main
- * process. This has been removed in favor of cache on the web layer.
+ * process. This has been removed in favor of cache on the web layer. Delete the
+ * old cache dir if it exists.
*
- * Delete the old cache dir if it exists.
- *
- * This will happen in two phases. The cache had three subdirectories:
- *
- * - Two of them, "thumbs" and "files", will be removed now (v1.7.0, May 2024).
- *
- * - The third one, "face-crops" will be removed once we finish the face search
- * changes. See: [Note: Legacy face crops].
- *
- * This migration code can be removed after some time once most people have
- * upgraded to newer versions.
+ * Added May 2024, v1.7.0. This migration code can be removed after some time
+ * once most people have upgraded to newer versions.
*/
const deleteLegacyDiskCacheDirIfExists = async () => {
- const removeIfExists = async (dirPath: string) => {
- if (existsSync(dirPath)) {
- log.info(`Removing legacy disk cache from ${dirPath}`);
- await fs.rm(dirPath, { recursive: true });
- }
- };
// [Note: Getting the cache path]
//
// The existing code was passing "cache" as a parameter to getPath.
//
- // However, "cache" is not a valid parameter to getPath. It works! (for
+ // However, "cache" is not a valid parameter to getPath. It works (for
// example, on macOS I get `~/Library/Caches`), but it is intentionally not
// documented as part of the public API:
//
@@ -353,8 +339,8 @@ const deleteLegacyDiskCacheDirIfExists = async () => {
// @ts-expect-error "cache" works but is not part of the public API.
const cacheDir = path.join(app.getPath("cache"), "ente");
if (existsSync(cacheDir)) {
- await removeIfExists(path.join(cacheDir, "thumbs"));
- await removeIfExists(path.join(cacheDir, "files"));
+ log.info(`Removing legacy disk cache from ${cacheDir}`);
+ await fs.rm(cacheDir, { recursive: true });
}
};
diff --git a/desktop/src/main/ipc.ts b/desktop/src/main/ipc.ts
index e74d5e9d2e..b96c8f1e1a 100644
--- a/desktop/src/main/ipc.ts
+++ b/desktop/src/main/ipc.ts
@@ -24,7 +24,6 @@ import {
updateOnNextRestart,
} from "./services/app-update";
import {
- legacyFaceCrop,
openDirectory,
openLogDirectory,
selectDirectory,
@@ -186,10 +185,6 @@ export const attachIPCHandlers = () => {
faceEmbeddings(input),
);
- ipcMain.handle("legacyFaceCrop", (_, faceID: string) =>
- legacyFaceCrop(faceID),
- );
-
// - Upload
ipcMain.handle("listZipItems", (_, zipPath: string) =>
diff --git a/desktop/src/main/services/dir.ts b/desktop/src/main/services/dir.ts
index d97cad6fb2..9473be7c9e 100644
--- a/desktop/src/main/services/dir.ts
+++ b/desktop/src/main/services/dir.ts
@@ -1,7 +1,5 @@
import { shell } from "electron/common";
import { app, dialog } from "electron/main";
-import { existsSync } from "fs";
-import fs from "node:fs/promises";
import path from "node:path";
import { posixPath } from "../utils/electron";
@@ -78,16 +76,3 @@ export const openLogDirectory = () => openDirectory(logDirectoryPath());
* - Windows: %USERPROFILE%\AppData\Roaming\ente\logs\ente.log
*/
const logDirectoryPath = () => app.getPath("logs");
-
-/**
- * See: [Note: Legacy face crops]
- */
-export const legacyFaceCrop = async (
- faceID: string,
-): Promise<Uint8Array | undefined> => {
- // See: [Note: Getting the cache path]
- // @ts-expect-error "cache" works but is not part of the public API.
- const cacheDir = path.join(app.getPath("cache"), "ente");
- const filePath = path.join(cacheDir, "face-crops", faceID);
- return existsSync(filePath) ? await fs.readFile(filePath) : undefined;
-};
diff --git a/desktop/src/preload.ts b/desktop/src/preload.ts
index c5a1d0d317..6ff01e59ea 100644
--- a/desktop/src/preload.ts
+++ b/desktop/src/preload.ts
@@ -165,9 +165,6 @@ const detectFaces = (input: Float32Array) =>
const faceEmbeddings = (input: Float32Array) =>
ipcRenderer.invoke("faceEmbeddings", input);
-const legacyFaceCrop = (faceID: string) =>
- ipcRenderer.invoke("legacyFaceCrop", faceID);
-
// - Watch
const watchGet = () => ipcRenderer.invoke("watchGet");
@@ -344,7 +341,6 @@ contextBridge.exposeInMainWorld("electron", {
clipTextEmbeddingIfAvailable,
detectFaces,
faceEmbeddings,
- legacyFaceCrop,
// - Watch