mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 00:03:56 +00:00
[PM-7646][PM-5506] Revert IPC changes (#10946)
* Revert "Remove unnecessary plist keys in desktop_proxy (#10933)" This reverts commit4dbb036df1. * Revert "Fix TestFlight errors caused by desktop_proxy (#10928)" This reverts commit40cb4b5353. * Revert "[PM-5506] Enable electron fuses (#10073)" This reverts commit78c5e9c706. * Revert "[PM-7846] Implement a rust based native messaging proxy and IPC system (#9894)" This reverts commit55874b72bf.
This commit is contained in:
@@ -1,33 +1,31 @@
|
||||
import { spawn } from "child_process";
|
||||
import * as path from "path";
|
||||
import { NativeMessagingProxy } from "./proxy/native-messaging-proxy";
|
||||
|
||||
import { app } from "electron";
|
||||
// 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.
|
||||
|
||||
if (
|
||||
process.platform === "darwin" &&
|
||||
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.
|
||||
if (process.platform === "darwin") {
|
||||
// eslint-disable-next-line
|
||||
const app = require("electron").app;
|
||||
|
||||
app.on("ready", () => {
|
||||
app.dock.hide();
|
||||
app.on("ready", () => {
|
||||
app.dock.hide();
|
||||
});
|
||||
}
|
||||
|
||||
process.stdout.on("error", (e) => {
|
||||
if (e.code === "EPIPE") {
|
||||
process.exit(0);
|
||||
}
|
||||
});
|
||||
|
||||
const proc = spawn(path.join(process.execPath, "..", "desktop_proxy"), process.argv.slice(1), {
|
||||
cwd: process.cwd(),
|
||||
stdio: "inherit",
|
||||
shell: false,
|
||||
});
|
||||
|
||||
proc.on("exit", () => {
|
||||
process.exit(0);
|
||||
});
|
||||
proc.on("error", () => {
|
||||
process.exit(1);
|
||||
});
|
||||
const proxy = new NativeMessagingProxy();
|
||||
proxy.run();
|
||||
} else {
|
||||
// eslint-disable-next-line
|
||||
const Main = require("./main").Main;
|
||||
|
||||
Reference in New Issue
Block a user