1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-21 16:18:28 +01:00
bitwarden-browser/apps/desktop/src/entry.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

38 lines
975 B
TypeScript
Raw Normal View History

import { spawn } from "child_process";
import * as path from "path";
2020-12-29 20:53:29 +01:00
import { app } from "electron";
2020-12-29 20:53:29 +01:00
if (
process.platform === "darwin" &&
2020-12-29 20:53:29 +01:00
process.argv.some((arg) => arg.indexOf("chrome-extension://") !== -1 || arg.indexOf("{") !== -1)
) {
// 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
app.on("ready", () => {
app.dock.hide();
});
2020-12-29 20:53:29 +01: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
});
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();
}