Skip to content

armgit / ente

Public Imported from GitHub
0

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

Clean unused

Manav Rathi154fffd62022
diff --git a/desktop/src/main/ipc.ts b/desktop/src/main/ipc.ts
index 6b837d8b4d..6c4020d6ee 100644
--- a/desktop/src/main/ipc.ts
+++ b/desktop/src/main/ipc.ts
@@ -44,7 +44,6 @@ import {
import { convertToJPEG, generateImageThumbnail } from "./services/image";
import { logout } from "./services/logout";
import { createMLWorker } from "./services/ml";
-
import {
encryptionKey,
lastShownChangelogVersion,
diff --git a/desktop/src/main/services/ml-worker.ts b/desktop/src/main/services/ml-worker.ts
index bc788a9fad..f4b9221f64 100644
--- a/desktop/src/main/services/ml-worker.ts
+++ b/desktop/src/main/services/ml-worker.ts
@@ -95,46 +95,6 @@ const parseInitData = (data: unknown) => {
}
};
-/**
- * Our hand-rolled RPC handler and router - the Node.js utility process end.
- *
- * Sibling of the electronMLWorker function (in `ml/worker.ts`) in the web code.
- *
- * [Note: Node.js ML worker RPC protocol]
- *
- * - Each RPC call (i.e. request message) has a "method" (string), "id"
- * (number) and "p" (arbitrary param).
- *
- * - Each RPC result (i.e. response message) has an "id" (number) that is the
- * same as the "id" for the request which it corresponds to.
- *
- * - If the RPC call was a success, then the response messege will have an
- * "result" (arbitrary result) property. Otherwise it will have a "error"
- * (string) property describing what went wrong.
- */
-export const handleMessageFromRenderer = (m: unknown) => {
- if (m && typeof m == "object" && "method" in m && "id" in m && "p" in m) {
- const id = m.id;
- // const p = m.p;
- try {
- switch (m.method) {
- case "foo":
- // if (p && typeof p == "string")
- // return { id, result: await foo(p) };
- break;
- }
- } catch (e) {
- return { id, error: e instanceof Error ? e.message : String(e) };
- }
- return { id, error: "Unknown message" };
- }
-
- // We don't even have an "id", so at least log it lest the renderer also
- // ignore the "id"-less response.
- log.info("Ignoring unknown message", m);
- return { error: "Unknown message" };
-};
-
/**
* Return a function that can be used to trigger a download of the specified
* model, and the creating of an ONNX inference session initialized using it.
diff --git a/desktop/src/preload.ts b/desktop/src/preload.ts
index 5bd2f28987..5b83e441ad 100644
--- a/desktop/src/preload.ts
+++ b/desktop/src/preload.ts
@@ -202,24 +202,12 @@ const createMLWorker = () => {
ipcRenderer.send("createMLWorker");
ipcRenderer.on("createMLWorker/port", (event) => {
void windowLoaded.then(() => {
- // "*"" is the origin
+ // "*"" is the origin to send to.
window.postMessage("createMLWorker/port", "*", event.ports);
});
});
};
-const computeCLIPImageEmbedding = (input: Float32Array) =>
- ipcRenderer.invoke("computeCLIPImageEmbedding", input);
-
-const computeCLIPTextEmbeddingIfAvailable = (text: string) =>
- ipcRenderer.invoke("computeCLIPTextEmbeddingIfAvailable", text);
-
-const detectFaces = (input: Float32Array) =>
- ipcRenderer.invoke("detectFaces", input);
-
-const computeFaceEmbeddings = (input: Float32Array) =>
- ipcRenderer.invoke("computeFaceEmbeddings", input);
-
// - Watch
const watchGet = () => ipcRenderer.invoke("watchGet");
@@ -385,10 +373,6 @@ contextBridge.exposeInMainWorld("electron", {
// - ML
createMLWorker,
- computeCLIPImageEmbedding,
- computeCLIPTextEmbeddingIfAvailable,
- detectFaces,
- computeFaceEmbeddings,
// - Watch