1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 17:23:37 +00:00

Generate app manifests and add install scripts for windows

This commit is contained in:
Hinton
2020-10-05 19:48:51 +02:00
parent f09a788103
commit 24ef7e1ef6
6 changed files with 154 additions and 26 deletions

View File

@@ -1,8 +1,5 @@
/* tslint:disable:no-console */
import * as ipc from 'node-ipc';
import { spawn } from 'child_process';
const StartDesktopCooldown = 60 * 1000; // 1 minute delay between attempts to start desktop
ipc.config.id = 'proxy';
ipc.config.retry = 1500;
@@ -10,7 +7,6 @@ ipc.config.logger = console.warn; // Stdout is used for native messaging
export default class IPC {
private connected = false;
private lastStartedDesktop = 0;
connect() {
ipc.connectTo('bitwarden', () => {
@@ -32,30 +28,19 @@ export default class IPC {
console.error('got a message from world : ', data);
});
/*
ipc.of.bitwarden.on('error', (err: any) => {
if (err.syscall === 'connect' && this.lastStartedDesktop + StartDesktopCooldown < Date.now()) {
this.lastStartedDesktop = Date.now();
console.error('Attempting to start Bitwarden desktop application');
this.startDesktop();
}
console.error('error', err);
});
*/
});
}
isConnected() {
isConnected(): boolean {
return this.connected;
}
send(json: object) {
ipc.of.bitwarden.emit('message', json);
}
// TODO: Do we want to start the desktop application? How do we get the install path?
private startDesktop() {
spawn(
'C:\\Users\\Oscar\\Documents\\Projects\\Bitwarden\\desktop\\dist\\Bitwarden-Portable-1.22.2.exe',
{ detached: true }
);
}
}