mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-11 10:10:25 +01:00
34 lines
1.0 KiB
TypeScript
34 lines
1.0 KiB
TypeScript
|
import { NativeMessagingProxy } from './proxy/native-messaging-proxy';
|
||
|
|
||
|
// We need to import the other dependencies using `reqiuire` 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.argv.some(arg => arg.indexOf('chrome-extension://') !== -1 || arg.indexOf('{') !== -1)) {
|
||
|
if (process.platform === 'darwin') {
|
||
|
// tslint:disable-next-line
|
||
|
const app = require('electron').app;
|
||
|
|
||
|
app.on('ready', () => {
|
||
|
app.dock.hide();
|
||
|
});
|
||
|
}
|
||
|
|
||
|
process.stdout.on('error', (e) => {
|
||
|
if (e.code === 'EPIPE') {
|
||
|
process.exit(0);
|
||
|
}
|
||
|
});
|
||
|
|
||
|
const proxy = new NativeMessagingProxy();
|
||
|
proxy.run();
|
||
|
} else {
|
||
|
// tslint:disable-next-line
|
||
|
const Main = require('./main').Main;
|
||
|
|
||
|
const main = new Main();
|
||
|
main.bootstrap();
|
||
|
}
|