2024-10-01 16:28:56 +02:00
|
|
|
import { spawn } from "child_process";
|
|
|
|
import * as path from "path";
|
2020-12-29 20:53:29 +01:00
|
|
|
|
2024-10-01 16:28:56 +02:00
|
|
|
import { app } from "electron";
|
2020-12-29 20:53:29 +01:00
|
|
|
|
|
|
|
if (
|
2024-10-01 16:28:56 +02:00
|
|
|
process.platform === "darwin" &&
|
2020-12-29 20:53:29 +01:00
|
|
|
process.argv.some((arg) => arg.indexOf("chrome-extension://") !== -1 || arg.indexOf("{") !== -1)
|
|
|
|
) {
|
2024-10-01 16:28:56 +02:00
|
|
|
// If we're on MacOS, we need to support DuckDuckGo's IPC communication,
|
|
|
|
// which for the moment is launching the Bitwarden process.
|
|
|
|
// Ideally the browser would instead startup the desktop_proxy process
|
|
|
|
// when available, but for now we'll just launch it here.
|
2020-12-29 20:53:29 +01:00
|
|
|
|
2024-10-01 16:28:56 +02:00
|
|
|
app.on("ready", () => {
|
|
|
|
app.dock.hide();
|
|
|
|
});
|
2020-12-29 20:53:29 +01:00
|
|
|
|
2024-10-01 16:28:56 +02:00
|
|
|
const proc = spawn(path.join(process.execPath, "..", "desktop_proxy"), process.argv.slice(1), {
|
|
|
|
cwd: process.cwd(),
|
|
|
|
stdio: "inherit",
|
|
|
|
shell: false,
|
2021-12-20 15:47:17 +01:00
|
|
|
});
|
|
|
|
|
2024-10-01 16:28:56 +02:00
|
|
|
proc.on("exit", () => {
|
|
|
|
process.exit(0);
|
|
|
|
});
|
|
|
|
proc.on("error", () => {
|
|
|
|
process.exit(1);
|
|
|
|
});
|
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();
|
|
|
|
}
|