Skip to content

armgit / ente

Public Imported from GitHub
0

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

Start using it

Manav Rathi72dea7eca6f3
diff --git a/web/packages/next/global-electron.d.ts b/web/packages/next/global-electron.d.ts
index a79cbc1913..05a6838e1c 100644
--- a/web/packages/next/global-electron.d.ts
+++ b/web/packages/next/global-electron.d.ts
@@ -14,5 +14,9 @@ declare global {
* {@link Electron}) that allow us to communicate with the Node.js layer of
* our desktop app.
*/
- const electron: Electron | undefined;
+ // This needs to be a var for it to be recognized as a property of
+ // globalThis, so we unfortunately need to hush eslint for the next line.
+ //
+ // eslint-disable-next-line no-var
+ var electron: Electron | undefined;
}
diff --git a/web/packages/next/log.ts b/web/packages/next/log.ts
index 9d58184432..3dadbd2887 100644
--- a/web/packages/next/log.ts
+++ b/web/packages/next/log.ts
@@ -1,6 +1,4 @@
import { inWorker } from "@/next/env";
-import isElectron from "is-electron";
-import ElectronAPIs from "./electron";
import { isDevBuild } from "./env";
import { logToDisk as webLogToDisk } from "./log-web";
import { workerBridge } from "./worker/worker-bridge";
@@ -12,7 +10,8 @@ import { workerBridge } from "./worker/worker-bridge";
* in the log that is saved on disk.
*/
export const logToDisk = (message: string) => {
- if (isElectron()) ElectronAPIs.logToDisk(message);
+ const electron = globalThis.electron;
+ if (electron) electron.logToDisk(message);
else if (inWorker()) workerLogToDisk(message);
else webLogToDisk(message);
};