2024-09-09 15:09:17 +02:00
|
|
|
import { NativeMessagingProxy } from "./proxy/native-messaging-proxy";
|
2020-12-29 20:53:29 +01:00
|
|
|
|
2024-09-09 15:09:17 +02:00
|
|
|
// We need to import the other dependencies using `require` since `import` will
|
|
|
|
// generate `Error: Cannot find module 'electron'`. The cause of this error is
|
|
|
|
// due to native messaging setting the ELECTRON_RUN_AS_NODE env flag on windows
|
|
|
|
// which removes the electron module. This flag is needed for stdin/out to work
|
|
|
|
// properly on Windows.
|
2020-12-29 20:53:29 +01:00
|
|
|
|
|
|
|
if (
|
|
|
|
process.argv.some((arg) => arg.indexOf("chrome-extension://") !== -1 || arg.indexOf("{") !== -1)
|
|
|
|
) {
|
2024-09-09 15:09:17 +02:00
|
|
|
if (process.platform === "darwin") {
|
|
|
|
// eslint-disable-next-line
|
|
|
|
const app = require("electron").app;
|
2020-12-29 20:53:29 +01:00
|
|
|
|
2024-09-09 15:09:17 +02:00
|
|
|
app.on("ready", () => {
|
|
|
|
app.dock.hide();
|
|
|
|
});
|
|
|
|
}
|
2020-12-29 20:53:29 +01:00
|
|
|
|
2024-09-09 15:09:17 +02:00
|
|
|
process.stdout.on("error", (e) => {
|
|
|
|
if (e.code === "EPIPE") {
|
|
|
|
process.exit(0);
|
|
|
|
}
|
2021-12-20 15:47:17 +01:00
|
|
|
});
|
|
|
|
|
2024-09-09 15:09:17 +02:00
|
|
|
const proxy = new NativeMessagingProxy();
|
|
|
|
proxy.run();
|
2020-12-29 20:53:29 +01:00
|
|
|
} else {
|
2022-02-24 20:50:19 +01:00
|
|
|
// eslint-disable-next-line
|
2020-12-29 20:53:29 +01:00
|
|
|
const Main = require("./main").Main;
|
|
|
|
|
|
|
|
const main = new Main();
|
|
|
|
main.bootstrap();
|
|
|
|
}
|