2020-10-05 15:11:37 +02:00
|
|
|
import NativeMessage from './nativemessage';
|
|
|
|
import IPC from './ipc';
|
|
|
|
|
|
|
|
const args = process.argv.slice(2);
|
|
|
|
|
2020-10-21 16:48:40 +02:00
|
|
|
// Proxy is a lightweight application which provides bi-directional communication
|
|
|
|
// between the browser extension and a running desktop application.
|
|
|
|
//
|
|
|
|
// Browser extension <-[native messaging]-> proxy <-[ipc]-> desktop
|
2020-10-05 15:11:37 +02:00
|
|
|
class Proxy {
|
2020-10-12 18:03:16 +02:00
|
|
|
private ipc: IPC;
|
|
|
|
private nativeMessage: NativeMessage;
|
2020-10-05 15:11:37 +02:00
|
|
|
|
|
|
|
constructor() {
|
|
|
|
this.ipc = new IPC();
|
|
|
|
this.nativeMessage = new NativeMessage(this.ipc);
|
|
|
|
}
|
|
|
|
|
|
|
|
run() {
|
|
|
|
this.ipc.connect();
|
|
|
|
this.nativeMessage.listen();
|
2020-10-11 20:41:10 +02:00
|
|
|
|
|
|
|
this.ipc.onMessage = this.nativeMessage.send;
|
2020-10-05 15:11:37 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const proxy = new Proxy();
|
|
|
|
proxy.run();
|